Skip to contentSkip to conversation

perf top: error handling for counter creation should parallel perf-record

PATCH In review David Ahern 1 participant 2 messages Jul 30, 2012 – Aug 5, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf top: error handling for counter creation should parallel perf-record

5a7ed29 fixed up perf-record but not perf-top. Similar argument holds for it -- fallback to PMU only if it does not exist and handle invalid attributes separately.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Robert Richter <[email protected]>
---
 tools/perf/builtin-top.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/builtin-top.c +4 -2
index 35e86c6..534ac3a 100644
@@ -943,8 +943,10 @@ try_again:
 			 * based cpu-clock-tick sw counter, which
 			 * is always available even if no PMU support:
 			 */
-			if (attr->type == PERF_TYPE_HARDWARE &&
-			    attr->config == PERF_COUNT_HW_CPU_CYCLES) {
+			if ((err == ENOENT || err == ENXIO) &&
+			    (attr->type == PERF_TYPE_HARDWARE) &&
+			    (attr->config == PERF_COUNT_HW_CPU_CYCLES)) {
+
 				if (verbose)
 					ui__warning("Cycles event not supported,\n"
 						    "trying to fall back to cpu-clock-ticks\n");
Signature · 1 line
1.7.10.1
#1 lore raw

[tip:perf/urgent] perf top: Error handling for counter creation should parallel perf-record

Commit-ID:  1a31fc904f1c897e4aaf7c3176e6aafa49f5d395
Gitweb:     http://git.kernel.org/tip/1a31fc904f1c897e4aaf7c3176e6aafa49f5d395
Author:     David Ahern <[email protected]>
AuthorDate: Sun, 29 Jul 2012 20:53:03 -0600
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 3 Aug 2012 10:30:18 -0300

perf top: Error handling for counter creation should parallel perf-record

5a7ed29 fixed up perf-record but not perf-top. Similar argument holds for it -- fallback to PMU only if it does not exist and handle invalid attributes separately.

---
 tools/perf/builtin-top.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/builtin-top.c +4 -2
index 40264ea..3409627 100644
@@ -943,8 +943,10 @@ try_again:
 			 * based cpu-clock-tick sw counter, which
 			 * is always available even if no PMU support:
 			 */
-			if (attr->type == PERF_TYPE_HARDWARE &&
-			    attr->config == PERF_COUNT_HW_CPU_CYCLES) {
+			if ((err == ENOENT || err == ENXIO) &&
+			    (attr->type == PERF_TYPE_HARDWARE) &&
+			    (attr->config == PERF_COUNT_HW_CPU_CYCLES)) {
+
 				if (verbose)
 					ui__warning("Cycles event not supported,\n"
 						    "trying to fall back to cpu-clock-ticks\n");