From dc73c77d7317951235d741ac404a9ab5dde1d171 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Tue, 28 Jun 2022 12:27:50 +0200 Subject: [PATCH] cpumf/pai: Omit detailed event information when summary flag selected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the summary flag is selected do not print detailed information on every single event. Just print the summary information on each non-zero counter value. Suggested-by: Christian Borntraeger Signed-off-by: Thomas Richter Signed-off-by: Jan Höppner --- cpumf/pai.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cpumf/pai.c b/cpumf/pai.c index aeb1f507..67b9e8f1 100644 --- a/cpumf/pai.c +++ b/cpumf/pai.c @@ -57,6 +57,7 @@ static cpu_set_t cpu_online_mask; static int verbose, humantime; static struct util_list list_pai_event; static struct util_list list_pmu_event; +static bool summary; /* System call to perf_event_open(2) */ static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, @@ -392,7 +393,10 @@ static int evtraw_show(__u64 evtnum, unsigned char *p) offset += sizeof(ctr); value = *(__u64 *)(p + offset); offset += sizeof(value); - printf("%c%hd:%#llx", offset > 14 ? ',' : ' ', ctr, value); + if (!summary) { + printf("%c%hd:%#llx", offset > 14 ? ',' : ' ', ctr, + value); + } lookup_event(evtnum, ctr, value); if (offset + sizeof(ctr) + sizeof(value) > bytes) break; @@ -421,6 +425,12 @@ static const char *evt_selector(struct perf_event_attr *pa) static void evt_show(__u64 evtnum, const char *evtsel, struct pai_event_out *ev) { + if (summary) { + if (ev->type == PERF_RECORD_SAMPLE) + evtraw_show(evtnum, ev->raw); + return; + } + timestamp(ev->time); printf("%d ", ev->cpu); @@ -999,7 +1009,7 @@ static unsigned long check_mapsize(unsigned long n) int main(int argc, char **argv) { - bool crypto_record = false, report = false, summary = false; + bool crypto_record = false, report = false; bool nnpa_record = false; unsigned long loop_count = 1; int ch, group = 0;