[PATCH 1/2] perf top: update event name when falling back to cpu-clock
From: David Ahern
Date: Tue May 08 2012 - 12:49:52 EST
perf-top falls back to cpu-clock if the H/W cycles event is not
supported, but the event name is not updated leading to a
misleading header:
PerfTop: 8 irqs/sec kernel:75.0% exact: 0.0% [1000Hz cycles], ...
Update the event name when the event type is changed so that the
header displays correctly:
PerfTop: 794 irqs/sec kernel:100.0% exact: 0.0% [1000Hz cpu-clock], ...
Signed-off-by: David Ahern <dsahern@xxxxxxxxx>
---
tools/perf/builtin-top.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index c53cdab..79481c1 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -948,6 +948,11 @@ try_again:
attr->type = PERF_TYPE_SOFTWARE;
attr->config = PERF_COUNT_SW_CPU_CLOCK;
+ if (counter->name) {
+ free(counter->name);
+ counter->name = NULL;
+ counter->name = strdup(event_name(counter));
+ }
goto try_again;
}
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/