淘宝商城(天猫)高级技术专家.3年研发+3年性能测试调优/系统测试+4年团队管理与测试架构、研发系统实践. 新舞台新气象, 深化测试基础架构及研发架构,希望能在某个技术领域成为真正的技术大牛。欢迎荐才http://bbs.51testing.com/viewthread.php?tid=120496&extra=&page=1 .邮件: jianzhao.liangjz@alibaba-inc.com,MSN:liangjianzhao@163.com.微博:http://t.sina.com.cn/1674816524

unix 计数器disk traffic含义

上一篇 / 下一篇  2007-03-16 20:56:39 / 个人分类:loadrunner性能测试经验

controller->tools->options

可知如下为每3秒采样一次。

 

等价

iostat –d  3  n 输出的tps

或者iostat –x  3 中的 r/s+w/s

源码分析

http://nchc.dl.sourceforge.net/sourceforge/rstatd/rpc.rstatd-4.0.1.tar.gz下载

getdata.c ->函数getdata_setup,划分不同的版本如get_disk24

 

unsigned long long   rio;

  unsigned long long wio;

  char line[1024];

  char device[128];

  int    diskno;

  /* open the /proc/partitions file */

  partitions = fopen("/proc/partitions", "r");

  if (NULL == partitions) {

         return;

  }

  /* skip two lines */

  fgets(buffer, sizeof(buffer), partitions);       /* 1. line */

  fgets(buffer, sizeof(buffer), partitions);       /* 2. line */

 

  /* accumulate all the io statistics */

  diskno = 0;

  while ((diskno < 4) && (line == fgets(line, sizeof(line), partitions))) {

         sscanf(line, " %*d %*d %*d %s "

                "%lld %*d %*d %*d "

                "%lld %*d %*d %*d "

                "%*d %*d %*d\n",

                device, &rio, &wio);

         if (isdisk(device)) {

                s->dk_xfer[diskno++] = rio + wio;

         }

  }

 

输出如:major minor  #blocks  name     rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

 

   8     0  143114240 sda 20157282 76396662 781266460 1674746 51521287 557414054 576721790 18033503 0 16683724 23108039

   8     1     104391 sda1 420 989 2818 1640 412 387 1598 22310 0 20060 23950

   8     2    4192965 sda2 1693441 294 13549472 5620720 1368359 1659202 24230064 28566661 0 9972060 34221911

   8     3  138809632 sda3 18463289 76394995 767713138 39002769 50152516 555754465 552490128 32396225 0 7951734 31784871

 

device, &rio, &wio分别取

name     rio   wio。这些值都是read io/write operations since boot以来的值。To compute the io statistics for a disk, use the rio and wio operations,

as they are closest to what we used to know as unix io operations. Use

the wsect and rsect numbers to report block reads/writes.

 

rio完成的读 I/O 设备总次数。指真正向 I/O 设备发起并完成的读操作数目,
也就是那些放到 I/O 队列中的读请求。注意很多进程发起的读操作
(read())
很可能会和其他的操作进行 merge,不一定每个 read() 调用
都引起一个 I/O 请求。


TAG:

引用 删除 xuebao_zx   /   2008-08-08 10:52:42
我的CPU正常.disk traffic一直为0。感觉没有监控到..实际上IO一直很忙..
QQ:274906097
 

评分:0

我来说两句

Open Toolbar