[SIGAR-93] fix disk.queue

This commit is contained in:
Doug MacEachern 2008-04-26 23:29:22 +00:00
parent 9c184c6102
commit d6a245fa0f
1 changed files with 11 additions and 4 deletions

View File

@ -1223,13 +1223,13 @@ static int get_iostat_proc_dstat(sigar_t *sigar,
disk->rtime = ruse; disk->rtime = ruse;
disk->wtime = wuse; disk->wtime = wuse;
disk->time = use; disk->time = use;
disk->queue = aveq / 1000; disk->qtime = aveq;
} }
else if (num == 4) { else if (num == 4) {
wio = rsect; wio = rsect;
rsect = rmerge; rsect = rmerge;
wsect = ruse; wsect = ruse;
disk->time = disk->queue = SIGAR_FIELD_NOTIMPL; disk->time = disk->qtime = SIGAR_FIELD_NOTIMPL;
} }
else { else {
status = ENOENT; status = ENOENT;
@ -1308,8 +1308,7 @@ static int get_iostat_procp(sigar_t *sigar,
disk->wtime = sigar_strtoull(ptr); /* wuse */ disk->wtime = sigar_strtoull(ptr); /* wuse */
ptr = sigar_skip_token(ptr); /* running */ ptr = sigar_skip_token(ptr); /* running */
disk->time = sigar_strtoull(ptr); /* use */ disk->time = sigar_strtoull(ptr); /* use */
disk->queue = sigar_strtoull(ptr); /* aveq */ disk->qtime = sigar_strtoull(ptr); /* aveq */
disk->queue /= 1000;
/* convert sectors to bytes (512 is fixed size in 2.6 kernels) */ /* convert sectors to bytes (512 is fixed size in 2.6 kernels) */
disk->read_bytes *= 512; disk->read_bytes *= 512;
@ -1397,10 +1396,18 @@ int sigar_disk_usage_get(sigar_t *sigar, const char *name,
util = ((double)(disk->time - iodev->disk.time)) / interval * HZ; util = ((double)(disk->time - iodev->disk.time)) / interval * HZ;
disk->service_time = tput ? util / tput : 0.0; disk->service_time = tput ? util / tput : 0.0;
} }
if (disk->qtime == SIGAR_FIELD_NOTIMPL) {
disk->queue = SIGAR_FIELD_NOTIMPL;
}
else {
util = ((double)(disk->qtime - iodev->disk.qtime)) / interval;
disk->queue = util / 1000.0;
}
memcpy(&iodev->disk, disk, sizeof(iodev->disk)); memcpy(&iodev->disk, disk, sizeof(iodev->disk));
if (partition_usage) { if (partition_usage) {
partition_usage->service_time = disk->service_time; partition_usage->service_time = disk->service_time;
partition_usage->queue = disk->queue;
} }
} }