add file_system_usage.disk_time
This commit is contained in:
parent
f55cb9cfba
commit
8fb0941eca
|
@ -444,7 +444,8 @@ typedef struct {
|
||||||
disk_writes,
|
disk_writes,
|
||||||
disk_write_bytes,
|
disk_write_bytes,
|
||||||
disk_read_bytes,
|
disk_read_bytes,
|
||||||
disk_queue;
|
disk_queue,
|
||||||
|
disk_time;
|
||||||
double use_percent;
|
double use_percent;
|
||||||
} sigar_file_system_usage_t;
|
} sigar_file_system_usage_t;
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ int sigar_group_name_get(sigar_t *sigar, int gid, char *buf, int buflen);
|
||||||
#define SIGAR_DISK_STATS_NOTIMPL(fsusage) \
|
#define SIGAR_DISK_STATS_NOTIMPL(fsusage) \
|
||||||
fsusage->disk_reads = fsusage->disk_writes = \
|
fsusage->disk_reads = fsusage->disk_writes = \
|
||||||
fsusage->disk_read_bytes = fsusage->disk_write_bytes = \
|
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)
|
#if defined(WIN32) || defined(NETWARE)
|
||||||
int sigar_get_iftype(const char *name, int *type, int *inst);
|
int sigar_get_iftype(const char *name, int *type, int *inst);
|
||||||
|
|
|
@ -1402,6 +1402,8 @@ static int get_iostat_proc_dstat(sigar_t *sigar,
|
||||||
fsusage->disk_read_bytes *= 512;
|
fsusage->disk_read_bytes *= 512;
|
||||||
fsusage->disk_write_bytes *= 512;
|
fsusage->disk_write_bytes *= 512;
|
||||||
|
|
||||||
|
fsusage->disk_time = use;
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -1459,9 +1461,10 @@ static int get_iostat_procp(sigar_t *sigar,
|
||||||
ptr = sigar_skip_token(ptr); /* wmerge */
|
ptr = sigar_skip_token(ptr); /* wmerge */
|
||||||
fsusage->disk_write_bytes = sigar_strtoull(ptr); /* wsect */
|
fsusage->disk_write_bytes = sigar_strtoull(ptr); /* wsect */
|
||||||
fsusage->disk_writes = sigar_strtoull(ptr); /* wio */
|
fsusage->disk_writes = sigar_strtoull(ptr); /* wio */
|
||||||
/* wuse, running, use */
|
ptr = sigar_skip_token(ptr); /* wuse */
|
||||||
ptr = sigar_skip_multiple_token(ptr, 3);
|
ptr = sigar_skip_token(ptr); /* running */
|
||||||
fsusage->disk_queue = sigar_strtoull(ptr); /* aveq */
|
fsusage->disk_time = sigar_strtoull(ptr); /* use */
|
||||||
|
fsusage->disk_queue = sigar_strtoull(ptr); /* aveq */
|
||||||
fsusage->disk_queue /= 1000;
|
fsusage->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) */
|
||||||
|
@ -1501,6 +1504,8 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
||||||
fsusage->free_files = buf.f_ffree;
|
fsusage->free_files = buf.f_ffree;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
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.2 has metrics /proc/stat, but wtf is the device mapping?
|
||||||
* 2.4 has /proc/partitions w/ the metrics.
|
* 2.4 has /proc/partitions w/ the metrics.
|
||||||
|
@ -1532,8 +1537,6 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SIGAR_DISK_STATS_NOTIMPL(fsusage);
|
|
||||||
|
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue