Skip to contentSkip to conversation

perf record: reset event name when falling back to cpu-clock

PATCH In review David Ahern 1 participant 2 messages May 8, 2012 – May 11, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 perf record: reset event name when falling back to cpu-clock

perf-record defaults to the H/W cycles event and if it is not supported falls back to cpu-clock. Reset the event name as well.

---
 tools/perf/builtin-record.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tools/perf/builtin-record.c +4 -0
index 42e2414..42d0fcf 100644
@@ -252,6 +252,10 @@ try_again:
 						    "trying to fall back to cpu-clock-ticks\n");
 				attr->type = PERF_TYPE_SOFTWARE;
 				attr->config = PERF_COUNT_SW_CPU_CLOCK;
+				if (pos->name) {
+					free(pos->name);
+					pos->name = NULL;
+				}
 				goto try_again;
 			}
 
Signature · 1 line
1.7.5.4
#1 lore raw

[tip:perf/core] perf record: Reset event name when falling back to cpu-clock

Commit-ID:  d1cae34d6fda59391e1b06ac1642ef4a740ba3ef
Gitweb:     http://git.kernel.org/tip/d1cae34d6fda59391e1b06ac1642ef4a740ba3ef
Author:     David Ahern <[email protected]>
AuthorDate: Tue, 8 May 2012 10:50:11 -0600
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 9 May 2012 12:02:10 -0300

perf record: Reset event name when falling back to cpu-clock

perf-record defaults to the H/W cycles event and if it is not supported falls back to cpu-clock. Reset the event name as well.

---
 tools/perf/builtin-record.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tools/perf/builtin-record.c +4 -0
index 1a9098c..d19058a 100644
@@ -256,6 +256,10 @@ try_again:
 						    "trying to fall back to cpu-clock-ticks\n");
 				attr->type = PERF_TYPE_SOFTWARE;
 				attr->config = PERF_COUNT_SW_CPU_CLOCK;
+				if (pos->name) {
+					free(pos->name);
+					pos->name = NULL;
+				}
 				goto try_again;
 			}