18 #define SNPRINTF(buf, size, fmt, args...) \ 20 size_t r = snprintf(buf, size, fmt, ## args); \ 21 r > size ? size : r; \ 26 float samples_per_sec;
27 float ksamples_per_sec;
28 float esamples_percent;
38 samples_per_sec = ksamples_per_sec = esamples_percent = 0.0;
42 float ksamples_percent = 0.0;
45 ksamples_percent = (100.0 * ksamples_per_sec) /
48 " PerfTop:%8.0f irqs/sec kernel:%4.1f%%" 49 " exact: %4.1f%% [", samples_per_sec,
50 ksamples_percent, esamples_percent);
57 " PerfTop:%8.0f irqs/sec kernel:%4.1f%% us:%4.1f%%" 58 " guest kernel:%4.1f%% guest us:%4.1f%%" 59 " exact: %4.1f%% [", samples_per_sec,
60 100.0 - (100.0 * ((samples_per_sec - ksamples_per_sec) /
62 100.0 - (100.0 * ((samples_per_sec - us_samples_per_sec) /
64 100.0 - (100.0 * ((samples_per_sec -
65 guest_kernel_samples_per_sec) /
67 100.0 - (100.0 * ((samples_per_sec -
68 guest_us_samples_per_sec) /
75 ret +=
SNPRINTF(bf + ret, size - ret,
"%" PRIu64
"%s ",
76 (uint64_t)first->
attr.sample_period,
77 opts->
freq ?
"Hz" :
"");
82 ret +=
SNPRINTF(bf + ret, size - ret,
"], ");
85 ret +=
SNPRINTF(bf + ret, size - ret,
" (target_pid: %s",
88 ret +=
SNPRINTF(bf + ret, size - ret,
" (target_tid: %s",
90 else if (target->
uid_str != NULL)
91 ret +=
SNPRINTF(bf + ret, size - ret,
" (uid: %s",
94 ret +=
SNPRINTF(bf + ret, size - ret,
" (all");
97 ret +=
SNPRINTF(bf + ret, size - ret,
", CPU%s: %s)",
102 ret +=
SNPRINTF(bf + ret, size - ret,
")");
104 ret +=
SNPRINTF(bf + ret, size - ret,
", %d CPU%s)",
#define SNPRINTF(buf, size, fmt, args...)
struct perf_evsel * sym_evsel
void perf_top__reset_sample_counters(struct perf_top *top)
struct record_opts record_opts
const char * perf_evsel__name(struct perf_evsel *evsel)
size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
static struct perf_evsel * perf_evlist__first(struct perf_evlist *evlist)
struct perf_evlist * evlist
struct perf_event_attr attr