.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> |
---|
3 | 4 | * |
---|
4 | 5 | * Refactored from builtin-top.c, see that files for further copyright notes. |
---|
5 | | - * |
---|
6 | | - * Released under the GPL v2. (and only v2, not any later version) |
---|
7 | 6 | */ |
---|
8 | 7 | |
---|
9 | | -#include "cpumap.h" |
---|
10 | 8 | #include "event.h" |
---|
11 | 9 | #include "evlist.h" |
---|
12 | 10 | #include "evsel.h" |
---|
13 | 11 | #include "parse-events.h" |
---|
14 | 12 | #include "symbol.h" |
---|
15 | 13 | #include "top.h" |
---|
| 14 | +#include "../perf.h" |
---|
16 | 15 | #include <inttypes.h> |
---|
17 | 16 | |
---|
18 | 17 | #define SNPRINTF(buf, size, fmt, args...) \ |
---|
.. | .. |
---|
46 | 45 | samples_per_sec; |
---|
47 | 46 | ret = SNPRINTF(bf, size, |
---|
48 | 47 | " PerfTop:%8.0f irqs/sec kernel:%4.1f%%" |
---|
49 | | - " exact: %4.1f%% [", samples_per_sec, |
---|
50 | | - ksamples_percent, esamples_percent); |
---|
| 48 | + " exact: %4.1f%% lost: %" PRIu64 "/%" PRIu64 " drop: %" PRIu64 "/%" PRIu64 " [", |
---|
| 49 | + samples_per_sec, ksamples_percent, esamples_percent, |
---|
| 50 | + top->lost, top->lost_total, top->drop, top->drop_total); |
---|
51 | 51 | } else { |
---|
52 | 52 | float us_samples_per_sec = top->us_samples / top->delay_secs; |
---|
53 | 53 | float guest_kernel_samples_per_sec = top->guest_kernel_samples / top->delay_secs; |
---|
.. | .. |
---|
70 | 70 | esamples_percent); |
---|
71 | 71 | } |
---|
72 | 72 | |
---|
73 | | - if (top->evlist->nr_entries == 1) { |
---|
74 | | - struct perf_evsel *first = perf_evlist__first(top->evlist); |
---|
| 73 | + if (top->evlist->core.nr_entries == 1) { |
---|
| 74 | + struct evsel *first = evlist__first(top->evlist); |
---|
75 | 75 | ret += SNPRINTF(bf + ret, size - ret, "%" PRIu64 "%s ", |
---|
76 | | - (uint64_t)first->attr.sample_period, |
---|
| 76 | + (uint64_t)first->core.attr.sample_period, |
---|
77 | 77 | opts->freq ? "Hz" : ""); |
---|
78 | 78 | } |
---|
79 | 79 | |
---|
80 | | - ret += SNPRINTF(bf + ret, size - ret, "%s", perf_evsel__name(top->sym_evsel)); |
---|
| 80 | + ret += SNPRINTF(bf + ret, size - ret, "%s", evsel__name(top->sym_evsel)); |
---|
81 | 81 | |
---|
82 | 82 | ret += SNPRINTF(bf + ret, size - ret, "], "); |
---|
83 | 83 | |
---|
.. | .. |
---|
95 | 95 | |
---|
96 | 96 | if (target->cpu_list) |
---|
97 | 97 | ret += SNPRINTF(bf + ret, size - ret, ", CPU%s: %s)", |
---|
98 | | - top->evlist->cpus->nr > 1 ? "s" : "", |
---|
| 98 | + top->evlist->core.cpus->nr > 1 ? "s" : "", |
---|
99 | 99 | target->cpu_list); |
---|
100 | 100 | else { |
---|
101 | 101 | if (target->tid) |
---|
102 | 102 | ret += SNPRINTF(bf + ret, size - ret, ")"); |
---|
103 | 103 | else |
---|
104 | 104 | ret += SNPRINTF(bf + ret, size - ret, ", %d CPU%s)", |
---|
105 | | - top->evlist->cpus->nr, |
---|
106 | | - top->evlist->cpus->nr > 1 ? "s" : ""); |
---|
| 105 | + top->evlist->core.cpus->nr, |
---|
| 106 | + top->evlist->core.cpus->nr > 1 ? "s" : ""); |
---|
107 | 107 | } |
---|
108 | 108 | |
---|
| 109 | + perf_top__reset_sample_counters(top); |
---|
109 | 110 | return ret; |
---|
110 | 111 | } |
---|
111 | 112 | |
---|
.. | .. |
---|
113 | 114 | { |
---|
114 | 115 | top->samples = top->us_samples = top->kernel_samples = |
---|
115 | 116 | top->exact_samples = top->guest_kernel_samples = |
---|
116 | | - top->guest_us_samples = 0; |
---|
| 117 | + top->guest_us_samples = top->lost = top->drop = 0; |
---|
117 | 118 | } |
---|