impl new disk metrics

This commit is contained in:
Doug MacEachern 2005-04-07 01:50:46 +00:00
parent d8b55e8c52
commit 009d51854c
2 changed files with 22 additions and 16 deletions

View File

@ -1643,14 +1643,28 @@ static int get_perfstat_disk_metrics(sigar_t *sigar,
fsusage->disk_reads = disk.rblks; fsusage->disk_reads = disk.rblks;
fsusage->disk_writes = disk.wblks; fsusage->disk_writes = disk.wblks;
fsusage->disk_read_bytes = disk.rblks * disk.bsize;
fsusage->disk_read_bytes = SIGAR_FIELD_NOTIMPL; fsusage->disk_write_bytes = disk.wblks * disk.bsize;
fsusage->disk_write_bytes = SIGAR_FIELD_NOTIMPL; fsusage->disk_queue = disk.qdepth;
fsusage->disk_queue = SIGAR_FIELD_NOTIMPL;
return SIGAR_OK; return SIGAR_OK;
} }
static void set_disk_metrics(struct dkstat *dkstat,
sigar_file_system_usage_t *fsusage)
{
fsusage->disk_reads = dkstat->dk_rblks;
fsusage->disk_writes = dkstat->dk_wblks;
fsusage->disk_read_bytes = dkstat->dk_rblks * dkstat->dk_bsize;
fsusage->disk_write_bytes = dkstat->dk_wblks * dkstat->dk_bsize;
if (dkstat->dk_qd_magic == dk_q_depth_magic) {
fsusage->disk_queue = dkstat->dk_q_depth;
}
else {
fsusage->disk_queue = SIGAR_FIELD_NOTIMPL;
}
}
static int get_disk_metrics(sigar_t *sigar, static int get_disk_metrics(sigar_t *sigar,
sigar_file_system_usage_t *fsusage, sigar_file_system_usage_t *fsusage,
aix_diskio_t *diskio) aix_diskio_t *diskio)
@ -1681,11 +1695,7 @@ static int get_disk_metrics(sigar_t *sigar,
read(fd, &dkstat, sizeof(dkstat)); read(fd, &dkstat, sizeof(dkstat));
if (strEQ(diskio->name, dkstat.diskname)) { if (strEQ(diskio->name, dkstat.diskname)) {
fsusage->disk_reads = dkstat.dk_rblks; set_disk_metrics(&dkstat, fsusage);
fsusage->disk_writes = dkstat.dk_wblks;
fsusage->disk_read_bytes = SIGAR_FIELD_NOTIMPL;
fsusage->disk_write_bytes = SIGAR_FIELD_NOTIMPL;
fsusage->disk_queue = SIGAR_FIELD_NOTIMPL;
status = SIGAR_OK; status = SIGAR_OK;
} }
else { else {
@ -1715,11 +1725,7 @@ static int get_disk_metrics(sigar_t *sigar,
read(fd, &dkstat, sizeof(dkstat)); read(fd, &dkstat, sizeof(dkstat));
if (strEQ(diskio->name, dkstat.diskname)) { if (strEQ(diskio->name, dkstat.diskname)) {
fsusage->disk_reads = dkstat.dk_rblks; set_disk_metrics(&dkstat, fsusage);
fsusage->disk_writes = dkstat.dk_wblks;
fsusage->disk_read_bytes = SIGAR_FIELD_NOTIMPL;
fsusage->disk_write_bytes = SIGAR_FIELD_NOTIMPL;
fsusage->disk_queue = SIGAR_FIELD_NOTIMPL;
diskio->addr = (long)dp; diskio->addr = (long)dp;
break; break;
} }

View File

@ -627,8 +627,8 @@ int sigar_file_system_usage_get(sigar_t *sigar,
if (retval == 1) { if (retval == 1) {
fsusage->disk_reads = lv.psl_rxfer; fsusage->disk_reads = lv.psl_rxfer;
fsusage->disk_writes = lv.psl_wxfer; fsusage->disk_writes = lv.psl_wxfer;
fsusage->disk_read_bytes = SIGAR_FIELD_NOTIMPL; fsusage->disk_read_bytes = lv.psl_rcount;
fsusage->disk_write_bytes = SIGAR_FIELD_NOTIMPL; fsusage->disk_write_bytes = lv.psl_wcount;
fsusage->disk_queue = SIGAR_FIELD_NOTIMPL; fsusage->disk_queue = SIGAR_FIELD_NOTIMPL;
} }
} }