add file_system_usage.disk_time

This commit is contained in:
Doug MacEachern 2007-10-09 21:48:50 +00:00
parent f55cb9cfba
commit 8fb0941eca
3 changed files with 11 additions and 7 deletions

View File

@ -444,7 +444,8 @@ typedef struct {
disk_writes,
disk_write_bytes,
disk_read_bytes,
disk_queue;
disk_queue,
disk_time;
double use_percent;
} sigar_file_system_usage_t;

View File

@ -312,7 +312,7 @@ int sigar_group_name_get(sigar_t *sigar, int gid, char *buf, int buflen);
#define SIGAR_DISK_STATS_NOTIMPL(fsusage) \
fsusage->disk_reads = fsusage->disk_writes = \
fsusage->disk_read_bytes = fsusage->disk_write_bytes = \
fsusage->disk_queue = SIGAR_FIELD_NOTIMPL;
fsusage->disk_queue = fsusage->disk_time = SIGAR_FIELD_NOTIMPL;
#if defined(WIN32) || defined(NETWARE)
int sigar_get_iftype(const char *name, int *type, int *inst);

View File

@ -1402,6 +1402,8 @@ static int get_iostat_proc_dstat(sigar_t *sigar,
fsusage->disk_read_bytes *= 512;
fsusage->disk_write_bytes *= 512;
fsusage->disk_time = use;
fclose(fp);
return status;
}
@ -1459,9 +1461,10 @@ static int get_iostat_procp(sigar_t *sigar,
ptr = sigar_skip_token(ptr); /* wmerge */
fsusage->disk_write_bytes = sigar_strtoull(ptr); /* wsect */
fsusage->disk_writes = sigar_strtoull(ptr); /* wio */
/* wuse, running, use */
ptr = sigar_skip_multiple_token(ptr, 3);
fsusage->disk_queue = sigar_strtoull(ptr); /* aveq */
ptr = sigar_skip_token(ptr); /* wuse */
ptr = sigar_skip_token(ptr); /* running */
fsusage->disk_time = sigar_strtoull(ptr); /* use */
fsusage->disk_queue = sigar_strtoull(ptr); /* aveq */
fsusage->disk_queue /= 1000;
/* convert sectors to bytes (512 is fixed size in 2.6 kernels) */
@ -1501,6 +1504,8 @@ int sigar_file_system_usage_get(sigar_t *sigar,
fsusage->free_files = buf.f_ffree;
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
SIGAR_DISK_STATS_NOTIMPL(fsusage); /* init */
/*
* 2.2 has metrics /proc/stat, but wtf is the device mapping?
* 2.4 has /proc/partitions w/ the metrics.
@ -1532,8 +1537,6 @@ int sigar_file_system_usage_get(sigar_t *sigar,
break;
}
SIGAR_DISK_STATS_NOTIMPL(fsusage);
return SIGAR_OK;
}