aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/system-stats/report.cpp41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/system-stats/report.cpp b/src/system-stats/report.cpp
index 2ab3916..42a053f 100644
--- a/src/system-stats/report.cpp
+++ b/src/system-stats/report.cpp
@@ -467,7 +467,7 @@ std::string dumpReport()
dumpPercent("idle", diff.idle, ncpu.idle);
dumpPercent("iowait", diff.iowait, ncpu.iowait);
if (ncpu.irq) dumpPercent("irq", diff.irq, ncpu.irq);
- if (ncpu.softirq) dumpPercent("softirq", diff.softirq, ncpu.softirq);
+ if (ncpu.softirq) dumpPercent("swirq", diff.softirq, ncpu.softirq);
if (ncpu.steal) dumpPercent("steal", diff.steal, ncpu.steal);
if (ncpu.guest) dumpPercent("guest", diff.guest, ncpu.guest);
if (ncpu.guestnice) dumpPercent("guestnice", diff.guestnice, ncpu.guestnice);
@@ -484,19 +484,24 @@ std::string dumpReport()
}
}
+ auto dumpRam = [&] (const char * const title, uint64_t size) {
+ report << "mem" << "\t" << title << "\t" << size << std::endl;
+ };
+
if (new_Memory) { // RAM report
- if (new_CPU)
- report << "mem\t" << new_Memory->ram.total
- << "\tavail:" << new_Memory->ram.available
- << "\tcache:" << new_Memory->ram.cached + new_Memory->ram.buffers;
+ if (new_CPU) {
+ dumpRam("total", new_Memory->ram.total);
+ dumpRam("avail", new_Memory->ram.available);
+ dumpRam("cache", new_Memory->ram.cached + new_Memory->ram.buffers);
+ }
if (new_Memory->ram.shared)
- report << "\tshare:" << new_Memory->ram.shared;
+ dumpRam("share", new_Memory->ram.shared);
- if (new_Memory->ram.swapTotal)
- report << "\tswap:" << new_Memory->ram.swapTotal - new_Memory->ram.swapFree << "/"
- << new_Memory->ram.swapTotal;
- report << std::endl;
+ if (new_Memory->ram.swapTotal) {
+ dumpRam("tswap", new_Memory->ram.swapTotal);
+ dumpRam("uswap", new_Memory->ram.swapTotal - new_Memory->ram.swapFree);
+ }
}
if (new_Health) { // TEMP report
@@ -531,14 +536,18 @@ std::string dumpReport()
its->second.avg = (prevTotal + itt.second.tempMilliCelsius) / its->second.count;
}
+ auto dumpTemp = [&](const char * const title, int32_t temp) {
+ report << "tmp" << "\t" << title << "\t" << temp / 1000 << std::endl;
+ };
+
for (auto its = statByCategory.crbegin(); its != statByCategory.crend(); ++its) {
if (its->second.count == 1)
- report << "tmp\t" << its->second.firstName << "\tcur:" << its->second.max / 1000 << "\t";
- else
- report << "max:" << its->second.max / 1000
- << "\tmin:" << its->second.min / 1000
- << "\tavg:" << its->second.avg / 1000
- << std::endl;
+ dumpTemp("cur", its->second.max);
+ else {
+ dumpTemp("max", its->second.max);
+ dumpTemp("min", its->second.min);
+ dumpTemp("avg", its->second.avg);
+ }
}
}
return report.str();