diff options
author | Colin Cross <ccross@android.com> | 2015-09-16 16:31:31 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2015-09-17 18:12:57 +0000 |
commit | 42a075379e6e3e3547a8d0d0d4229c192e537612 (patch) | |
tree | ab16d9db65391a59e29179438b66ae656956866d /iotop | |
parent | 53133315827837d913ed126914e3489ba06429fb (diff) | |
download | extras-42a075379e6e3e3547a8d0d0d4229c192e537612.tar.gz |
Fix output when -m is not passed
limit == -1 was being treated as limit == 0, and no tasks were being
printed.
Change-Id: Ie4ec278249bc750a3494e55d483dd983bf7bbdc3
Diffstat (limited to 'iotop')
-rw-r--r-- | iotop/iotop.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/iotop/iotop.cpp b/iotop/iotop.cpp index 645490df..a7d569bd 100644 --- a/iotop/iotop.cpp +++ b/iotop/iotop.cpp @@ -247,20 +247,23 @@ int main(int argc, char* argv[]) { total_write += statistics.write(); total_read_write += statistics.read_write(); - if (n > 0) { + if (n == 0) { + continue; + } else if (n > 0) { n--; - printf("%6d %-16s %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, - 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("%6d %-16s %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, + 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", BytesToKB(total_read) / delay_div, |