diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 17:08:35 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 17:08:35 +0200 |
commit | f1c783dc1c66b8868f011f327bf4e113a05f18f7 (patch) | |
tree | 103817295fe7850655ae13652ebaeabf50ec4474 | |
parent | 40ce5afc8528afde98aa7d434538c231d4a5814f (diff) |
ifpps: make '+' to '-' sort more clear
If will now look like the following:
cpu6 +: 237357 irqs
cpu2 |: 117538 irqs
cpu0 |: 8419 irqs
cpu7 |: 4523 irqs
cpu5 |: 4312 irqs
cpu1 -: 1432 irqs
avg: 47606.8
This makes it a bit more precise/intuitive that we sort from max
to min.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r-- | ifpps.c | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -777,11 +777,11 @@ static void screen_percpu_states_one(WINDOW *screen, const struct ifstat *rel, rel->cpu_idle[idx] + rel->cpu_iow[idx]; mvwprintw(screen, (*voff)++, 2, - "cpu%*d%s:%s %12.1lf%% usr/t " - "%9.1lf%% sys/t " - "%10.1lf%% idl/t " - "%11.1lf%% iow/t", max_padd, idx, - tag, strlen(tag) == 0 ? " " : "", + "cpu%*d %s: %11.1lf%% usr/t " + "%9.1lf%% sys/t " + "%10.1lf%% idl/t " + "%11.1lf%% iow/t", + max_padd, idx, tag, 100.0 * (rel->cpu_user[idx] + rel->cpu_nice[idx]) / all, 100.0 * rel->cpu_sys[idx] / all, 100.0 * rel->cpu_idle[idx] / all, @@ -807,7 +807,7 @@ static void screen_percpu_states(WINDOW *screen, const struct ifstat *rel, top_cpus--; for (i = 1; i < top_cpus; ++i) - screen_percpu_states_one(screen, rel, voff, cpu_hits[i].idx, ""); + screen_percpu_states_one(screen, rel, voff, cpu_hits[i].idx, "|"); /* Display minimum hitter */ if (cpus != 1) @@ -831,10 +831,10 @@ static void screen_percpu_irqs_rel_one(WINDOW *screen, const struct ifstat *rel, int max_padd = padding_from_num(get_number_cpus()); mvwprintw(screen, (*voff)++, 2, - "cpu%*d%s:%s %13llu irqs/t " - "%17llu sirq rx/t " - "%17llu sirq tx/t", max_padd, idx, - tag, strlen(tag) == 0 ? " " : "", + "cpu%*d %s: %12llu irqs/t " + "%17llu sirq rx/t " + "%17llu sirq tx/t", + max_padd, idx, tag, rel->irqs[idx], rel->irqs_srx[idx], rel->irqs_stx[idx]); @@ -853,7 +853,7 @@ static void screen_percpu_irqs_rel(WINDOW *screen, const struct ifstat *rel, top_cpus--; for (i = 1; i < top_cpus; ++i) - screen_percpu_irqs_rel_one(screen, rel, voff, cpu_hits[i].idx, ""); + screen_percpu_irqs_rel_one(screen, rel, voff, cpu_hits[i].idx, "|"); if (cpus != 1) screen_percpu_irqs_rel_one(screen, rel, voff, cpu_hits[cpus - 1].idx, "-"); @@ -871,9 +871,8 @@ static void screen_percpu_irqs_abs_one(WINDOW *screen, const struct ifstat *abs, int max_padd = padding_from_num(get_number_cpus()); mvwprintw(screen, (*voff)++, 2, - "cpu%*d%s:%s %13llu irqs", max_padd, idx, - tag, strlen(tag) == 0 ? " " : "", - abs->irqs[idx]); + "cpu%*d %s: %12llu irqs", + max_padd, idx, tag, abs->irqs[idx]); } static void screen_percpu_irqs_abs(WINDOW *screen, const struct ifstat *abs, @@ -889,7 +888,7 @@ static void screen_percpu_irqs_abs(WINDOW *screen, const struct ifstat *abs, top_cpus--; for (i = 1; i < top_cpus; ++i) - screen_percpu_irqs_abs_one(screen, abs, voff, cpu_hits[i].idx, ""); + screen_percpu_irqs_abs_one(screen, abs, voff, cpu_hits[i].idx, "|"); if (cpus != 1) screen_percpu_irqs_abs_one(screen, abs, voff, cpu_hits[cpus - 1].idx, "-"); |