Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf top: Save and display the drop count stats

Add drop count to 'perf top' headers:

# perf top --stdio
PerfTop: 3549 irqs/sec kernel:51.8% exact: 100.0% lost: 0/0 drop: 0/0 [4000Hz cycles:ppp], (all, 8 CPUs)

# perf top
Samples: 0 of event 'cycles:ppp', 4000 Hz, Event count (approx.): 0 lost: 0/0 drop: 0/0

The format is: <current period drop>/<total drop>

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-2lj87zz8tq9ye1ntax3ulw0n@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
97f7e0b3 d63b9f6f

+13 -5
+4 -1
tools/perf/builtin-top.c
··· 1112 1112 struct machine *machine; 1113 1113 int ret = -1; 1114 1114 1115 - if (should_drop(qevent, top)) 1115 + if (should_drop(qevent, top)) { 1116 + top->drop++; 1117 + top->drop_total++; 1116 1118 return 0; 1119 + } 1117 1120 1118 1121 ret = perf_evlist__parse_sample(evlist, event, &sample); 1119 1122 if (ret) {
+4
tools/perf/ui/browsers/hists.c
··· 2223 2223 " lost: %" PRIu64 "/%" PRIu64, 2224 2224 top->lost, top->lost_total); 2225 2225 2226 + printed += scnprintf(bf + printed, size - printed, 2227 + " drop: %" PRIu64 "/%" PRIu64, 2228 + top->drop, top->drop_total); 2229 + 2226 2230 if (top->zero) 2227 2231 printed += scnprintf(bf + printed, size - printed, " [z]"); 2228 2232 }
+4 -3
tools/perf/util/top.c
··· 46 46 samples_per_sec; 47 47 ret = SNPRINTF(bf, size, 48 48 " PerfTop:%8.0f irqs/sec kernel:%4.1f%%" 49 - " exact: %4.1f%% lost: %" PRIu64 "/%" PRIu64 " [", samples_per_sec, 50 - ksamples_percent, esamples_percent, top->lost, top->lost_total); 49 + " exact: %4.1f%% lost: %" PRIu64 "/%" PRIu64 " drop: %" PRIu64 "/%" PRIu64 " [", 50 + samples_per_sec, ksamples_percent, esamples_percent, 51 + top->lost, top->lost_total, top->drop, top->drop_total); 51 52 } else { 52 53 float us_samples_per_sec = top->us_samples / top->delay_secs; 53 54 float guest_kernel_samples_per_sec = top->guest_kernel_samples / top->delay_secs; ··· 114 113 { 115 114 top->samples = top->us_samples = top->kernel_samples = 116 115 top->exact_samples = top->guest_kernel_samples = 117 - top->guest_us_samples = top->lost = 0; 116 + top->guest_us_samples = top->lost = top->drop = 0; 118 117 }
+1 -1
tools/perf/util/top.h
··· 22 22 * Symbols will be added here in perf_event__process_sample and will 23 23 * get out after decayed. 24 24 */ 25 - u64 samples, lost, lost_total; 25 + u64 samples, lost, lost_total, drop, drop_total; 26 26 u64 kernel_samples, us_samples; 27 27 u64 exact_samples; 28 28 u64 guest_us_samples, guest_kernel_samples;