aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-06-12 12:35:44 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-06-19 12:06:21 -0400
commit5bff01f66db1753abcae03a06b21e56e7e9d9fa9 (patch)
tree360516797db0c19a191e4aab86f7e5314b992313
parent7289f83cceb437ca56c77eb45b8b1cda15e2e476 (diff)
perf script: Replace __event_name uses with perf_evsel__name
No logic change, just remove one more user of __event_name(). Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-e4f0vuy3283hmzfjjvkgm7fo@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-script.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 8e395a538eb9..8f9f9b6140db 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -137,10 +137,11 @@ static const char *output_field2str(enum perf_output_field field)
137 137
138#define PRINT_FIELD(x) (output[attr->type].fields & PERF_OUTPUT_##x) 138#define PRINT_FIELD(x) (output[attr->type].fields & PERF_OUTPUT_##x)
139 139
140static int perf_event_attr__check_stype(struct perf_event_attr *attr, 140static int perf_evsel__check_stype(struct perf_evsel *evsel,
141 u64 sample_type, const char *sample_msg, 141 u64 sample_type, const char *sample_msg,
142 enum perf_output_field field) 142 enum perf_output_field field)
143{ 143{
144 struct perf_event_attr *attr = &evsel->attr;
144 int type = attr->type; 145 int type = attr->type;
145 const char *evname; 146 const char *evname;
146 147
@@ -148,7 +149,7 @@ static int perf_event_attr__check_stype(struct perf_event_attr *attr,
148 return 0; 149 return 0;
149 150
150 if (output[type].user_set) { 151 if (output[type].user_set) {
151 evname = __event_name(attr->type, attr->config); 152 evname = perf_evsel__name(evsel);
152 pr_err("Samples for '%s' event do not have %s attribute set. " 153 pr_err("Samples for '%s' event do not have %s attribute set. "
153 "Cannot print '%s' field.\n", 154 "Cannot print '%s' field.\n",
154 evname, sample_msg, output_field2str(field)); 155 evname, sample_msg, output_field2str(field));
@@ -157,7 +158,7 @@ static int perf_event_attr__check_stype(struct perf_event_attr *attr,
157 158
158 /* user did not ask for it explicitly so remove from the default list */ 159 /* user did not ask for it explicitly so remove from the default list */
159 output[type].fields &= ~field; 160 output[type].fields &= ~field;
160 evname = __event_name(attr->type, attr->config); 161 evname = perf_evsel__name(evsel);
161 pr_debug("Samples for '%s' event do not have %s attribute set. " 162 pr_debug("Samples for '%s' event do not have %s attribute set. "
162 "Skipping '%s' field.\n", 163 "Skipping '%s' field.\n",
163 evname, sample_msg, output_field2str(field)); 164 evname, sample_msg, output_field2str(field));
@@ -175,8 +176,8 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
175 return -EINVAL; 176 return -EINVAL;
176 177
177 if (PRINT_FIELD(IP)) { 178 if (PRINT_FIELD(IP)) {
178 if (perf_event_attr__check_stype(attr, PERF_SAMPLE_IP, "IP", 179 if (perf_evsel__check_stype(evsel, PERF_SAMPLE_IP, "IP",
179 PERF_OUTPUT_IP)) 180 PERF_OUTPUT_IP))
180 return -EINVAL; 181 return -EINVAL;
181 182
182 if (!no_callchain && 183 if (!no_callchain &&
@@ -185,8 +186,8 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
185 } 186 }
186 187
187 if (PRINT_FIELD(ADDR) && 188 if (PRINT_FIELD(ADDR) &&
188 perf_event_attr__check_stype(attr, PERF_SAMPLE_ADDR, "ADDR", 189 perf_evsel__check_stype(evsel, PERF_SAMPLE_ADDR, "ADDR",
189 PERF_OUTPUT_ADDR)) 190 PERF_OUTPUT_ADDR))
190 return -EINVAL; 191 return -EINVAL;
191 192
192 if (PRINT_FIELD(SYM) && !PRINT_FIELD(IP) && !PRINT_FIELD(ADDR)) { 193 if (PRINT_FIELD(SYM) && !PRINT_FIELD(IP) && !PRINT_FIELD(ADDR)) {
@@ -208,18 +209,18 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
208 } 209 }
209 210
210 if ((PRINT_FIELD(PID) || PRINT_FIELD(TID)) && 211 if ((PRINT_FIELD(PID) || PRINT_FIELD(TID)) &&
211 perf_event_attr__check_stype(attr, PERF_SAMPLE_TID, "TID", 212 perf_evsel__check_stype(evsel, PERF_SAMPLE_TID, "TID",
212 PERF_OUTPUT_TID|PERF_OUTPUT_PID)) 213 PERF_OUTPUT_TID|PERF_OUTPUT_PID))
213 return -EINVAL; 214 return -EINVAL;
214 215
215 if (PRINT_FIELD(TIME) && 216 if (PRINT_FIELD(TIME) &&
216 perf_event_attr__check_stype(attr, PERF_SAMPLE_TIME, "TIME", 217 perf_evsel__check_stype(evsel, PERF_SAMPLE_TIME, "TIME",
217 PERF_OUTPUT_TIME)) 218 PERF_OUTPUT_TIME))
218 return -EINVAL; 219 return -EINVAL;
219 220
220 if (PRINT_FIELD(CPU) && 221 if (PRINT_FIELD(CPU) &&
221 perf_event_attr__check_stype(attr, PERF_SAMPLE_CPU, "CPU", 222 perf_evsel__check_stype(evsel, PERF_SAMPLE_CPU, "CPU",
222 PERF_OUTPUT_CPU)) 223 PERF_OUTPUT_CPU))
223 return -EINVAL; 224 return -EINVAL;
224 225
225 return 0; 226 return 0;
@@ -258,9 +259,10 @@ static int perf_session__check_output_opt(struct perf_session *session)
258 259
259static void print_sample_start(struct perf_sample *sample, 260static void print_sample_start(struct perf_sample *sample,
260 struct thread *thread, 261 struct thread *thread,
261 struct perf_event_attr *attr) 262 struct perf_evsel *evsel)
262{ 263{
263 int type; 264 int type;
265 struct perf_event_attr *attr = &evsel->attr;
264 struct event_format *event; 266 struct event_format *event;
265 const char *evname = NULL; 267 const char *evname = NULL;
266 unsigned long secs; 268 unsigned long secs;
@@ -305,7 +307,7 @@ static void print_sample_start(struct perf_sample *sample,
305 if (event) 307 if (event)
306 evname = event->name; 308 evname = event->name;
307 } else 309 } else
308 evname = __event_name(attr->type, attr->config); 310 evname = perf_evsel__name(evsel);
309 311
310 printf("%s: ", evname ? evname : "[unknown]"); 312 printf("%s: ", evname ? evname : "[unknown]");
311 } 313 }
@@ -412,7 +414,7 @@ static void process_event(union perf_event *event __unused,
412 if (output[attr->type].fields == 0) 414 if (output[attr->type].fields == 0)
413 return; 415 return;
414 416
415 print_sample_start(sample, thread, attr); 417 print_sample_start(sample, thread, evsel);
416 418
417 if (is_bts_event(attr)) { 419 if (is_bts_event(attr)) {
418 print_sample_bts(event, sample, evsel, machine, thread); 420 print_sample_bts(event, sample, evsel, machine, thread);