diff options
Diffstat (limited to 'iotop/iotop.cpp')
-rw-r--r-- | iotop/iotop.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/iotop/iotop.cpp b/iotop/iotop.cpp index a292bcfe..fe476bf5 100644 --- a/iotop/iotop.cpp +++ b/iotop/iotop.cpp @@ -48,7 +48,7 @@ static void usage(char* myname) { " -n Set the number of refreshes before exiting.\n" " -P Show processes instead of the default threads.\n" " -s Set the column to sort by:\n" - " pid, read, write, total, io, swap, sched, mem or delay.\n", + " pid, read, write, total, io, swap, faults, sched, mem or delay.\n", myname); } @@ -85,6 +85,7 @@ static Sorter GetSorter(const std::string& field) { {"total", make_sorter(&TaskStatistics::read_write, true)}, {"io", make_sorter(&TaskStatistics::delay_io, true)}, {"swap", make_sorter(&TaskStatistics::delay_swap, true)}, + {"faults", make_sorter(&TaskStatistics::faults, true)}, {"sched", make_sorter(&TaskStatistics::delay_sched, true)}, {"mem", make_sorter(&TaskStatistics::delay_mem, true)}, {"delay", make_sorter(&TaskStatistics::delay_total, true)}, @@ -223,18 +224,20 @@ int main(int argc, char* argv[]) { printf("\n"); } if (accumulated) { - printf("%6s %-16s %20s %34s\n", "", "", - "---- IO (KiB) ----", "----------- delayed on ----------"); + printf("%6s %-16s %20s %14s %34s\n", "", "", + "---- IO (KiB) ----", "--- faults ---", "----------- delayed on ----------"); } else { - printf("%6s %-16s %20s %34s\n", "", "", - "--- IO (KiB/s) ---", "----------- delayed on ----------"); + printf("%6s %-16s %20s %14s %34s\n", "", "", + "--- IO (KiB/s) ---", "--- faults ---", "----------- delayed on ----------"); } - printf("%6s %-16s %6s %6s %6s %-5s %-5s %-5s %-5s %-5s\n", + printf("%6s %-16s %6s %6s %6s %6s %6s %-5s %-5s %-5s %-5s %-5s\n", "PID", "Command", "read", "write", "total", + "major", + "minor", "IO", "swap", "sched", @@ -245,10 +248,14 @@ int main(int argc, char* argv[]) { uint64_t total_read = 0; uint64_t total_write = 0; uint64_t total_read_write = 0; + uint64_t total_minflt = 0; + uint64_t total_majflt = 0; for (const TaskStatistics& statistics : stats) { total_read += statistics.read(); total_write += statistics.write(); total_read_write += statistics.read_write(); + total_minflt += statistics.minflt(); + total_majflt += statistics.majflt(); if (n == 0) { continue; @@ -256,22 +263,24 @@ int main(int argc, char* argv[]) { n--; } - printf("%6d %-16s %6" PRIu64 " %6" PRIu64 " %6" PRIu64 " %5.2f%% %5.2f%% %5.2f%% %5.2f%% %5.2f%%\n", + printf("%6d %-16s %6" PRIu64 " %6" PRIu64 " %6" PRIu64 " %6" PRIu64 " %6" PRIu64" %5.2f%% %5.2f%% %5.2f%% %5.2f%% %5.2f%%\n", statistics.pid(), statistics.comm().c_str(), BytesToKB(statistics.read()) / delay_div, BytesToKB(statistics.write()) / delay_div, BytesToKB(statistics.read_write()) / delay_div, + statistics.majflt(), statistics.minflt(), TimeToTgidPercent(statistics.delay_io(), delay, statistics), TimeToTgidPercent(statistics.delay_swap(), delay, statistics), TimeToTgidPercent(statistics.delay_sched(), delay, statistics), TimeToTgidPercent(statistics.delay_mem(), delay, statistics), TimeToTgidPercent(statistics.delay_total(), delay, statistics)); } - printf("%6s %-16s %6" PRIu64 " %6" PRIu64 " %6" PRIu64 "\n", "", "TOTAL", + printf("%6s %-16s %6" PRIu64 " %6" PRIu64 " %6" PRIu64 " %6" PRIu64 " %6" PRIu64"\n", "", "TOTAL", BytesToKB(total_read) / delay_div, BytesToKB(total_write) / delay_div, - BytesToKB(total_read_write) / delay_div); + BytesToKB(total_read_write) / delay_div, + total_majflt / delay_div, total_minflt / delay_div); second = false; |