summaryrefslogtreecommitdiffstats
path: root/linux/Platform.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-03-01 12:10:18 +1100
committerNathan Scott <nathans@redhat.com>2021-03-01 12:10:18 +1100
commit00339087b0ec7ab951eb65b03a2d1d66d97517f0 (patch)
tree5a2319e2d95c208ab2d99b66ec83eb035d567d00 /linux/Platform.c
parent379421d3b2a5a1cf718b555663ec873ef7ea90d8 (diff)
Fix integer sizing issues in the DiskIO Meter
On Linux kernels the size of the values exported for block device bytes has used a 64 bit integer for quite some time (2.6+ IIRC). Make the procfs value extraction use correct types and change internal types used to rate convert these counters (within the DiskIO Meter) 64 bit integers, where appropriate.
Diffstat (limited to 'linux/Platform.c')
-rw-r--r--linux/Platform.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/linux/Platform.c b/linux/Platform.c
index da2ae606..662a62ce 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -494,12 +494,12 @@ bool Platform_getDiskIO(DiskIOData* data) {
if (!fd)
return false;
- unsigned long int read_sum = 0, write_sum = 0, timeSpend_sum = 0;
+ unsigned long long int read_sum = 0, write_sum = 0, timeSpend_sum = 0;
char lineBuffer[256];
while (fgets(lineBuffer, sizeof(lineBuffer), fd)) {
char diskname[32];
- unsigned long int read_tmp, write_tmp, timeSpend_tmp;
- if (sscanf(lineBuffer, "%*d %*d %31s %*u %*u %lu %*u %*u %*u %lu %*u %*u %lu", diskname, &read_tmp, &write_tmp, &timeSpend_tmp) == 4) {
+ unsigned long long int read_tmp, write_tmp, timeSpend_tmp;
+ if (sscanf(lineBuffer, "%*d %*d %31s %*u %*u %llu %*u %*u %*u %llu %*u %*u %llu", diskname, &read_tmp, &write_tmp, &timeSpend_tmp) == 4) {
if (String_startsWith(diskname, "dm-"))
continue;

© 2014-2024 Faster IT GmbH | imprint | privacy policy