diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-06-22 14:32:04 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-06-22 14:32:04 -0400 |
commit | 0e789314f8c0b50bd19bf08dc5624b9604d60183 (patch) | |
tree | 64b6b9655e944284937f5eeff643f0754f35d0af /tools/perf | |
parent | f5dec51172b81db226a23f309bc737ad021af35b (diff) | |
parent | 7e27d6e778cd87b6f2415515d7127eba53fe5d02 (diff) |
Merge commit 'v2.6.35-rc3' into for-linus
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-buildid-list.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-sched.c | 1 | ||||
-rw-r--r-- | tools/perf/scripts/python/check-perf-trace.py | 3 | ||||
-rw-r--r-- | tools/perf/util/event.c | 13 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 2 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 50 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 8 |
8 files changed, 51 insertions, 33 deletions
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index 44a47e13bd67..99890728409e 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c | |||
@@ -43,8 +43,10 @@ static int __cmd_buildid_list(void) | |||
43 | if (session == NULL) | 43 | if (session == NULL) |
44 | return -1; | 44 | return -1; |
45 | 45 | ||
46 | if (with_hits) | 46 | if (with_hits) { |
47 | symbol_conf.full_paths = true; | ||
47 | perf_session__process_events(session, &build_id__mark_dso_hit_ops); | 48 | perf_session__process_events(session, &build_id__mark_dso_hit_ops); |
49 | } | ||
48 | 50 | ||
49 | perf_session__fprintf_dsos_buildid(session, stdout, with_hits); | 51 | perf_session__fprintf_dsos_buildid(session, stdout, with_hits); |
50 | 52 | ||
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 9bc89050e6f8..dc3435e18bde 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -503,7 +503,6 @@ static int __cmd_record(int argc, const char **argv) | |||
503 | { | 503 | { |
504 | int i, counter; | 504 | int i, counter; |
505 | struct stat st; | 505 | struct stat st; |
506 | pid_t pid = 0; | ||
507 | int flags; | 506 | int flags; |
508 | int err; | 507 | int err; |
509 | unsigned long waking = 0; | 508 | unsigned long waking = 0; |
@@ -572,7 +571,7 @@ static int __cmd_record(int argc, const char **argv) | |||
572 | 571 | ||
573 | if (forks) { | 572 | if (forks) { |
574 | child_pid = fork(); | 573 | child_pid = fork(); |
575 | if (pid < 0) { | 574 | if (child_pid < 0) { |
576 | perror("failed to fork"); | 575 | perror("failed to fork"); |
577 | exit(-1); | 576 | exit(-1); |
578 | } | 577 | } |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index f67bce2a83b4..55f3b5dcc731 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -1645,6 +1645,7 @@ static struct perf_event_ops event_ops = { | |||
1645 | .sample = process_sample_event, | 1645 | .sample = process_sample_event, |
1646 | .comm = event__process_comm, | 1646 | .comm = event__process_comm, |
1647 | .lost = event__process_lost, | 1647 | .lost = event__process_lost, |
1648 | .fork = event__process_task, | ||
1648 | .ordered_samples = true, | 1649 | .ordered_samples = true, |
1649 | }; | 1650 | }; |
1650 | 1651 | ||
diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py index 964d934395ff..d9f7893e315c 100644 --- a/tools/perf/scripts/python/check-perf-trace.py +++ b/tools/perf/scripts/python/check-perf-trace.py | |||
@@ -51,8 +51,7 @@ def kmem__kmalloc(event_name, context, common_cpu, | |||
51 | 51 | ||
52 | flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)), | 52 | flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)), |
53 | 53 | ||
54 | def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs, | 54 | def trace_unhandled(event_name, context, event_fields_dict): |
55 | common_pid, common_comm): | ||
56 | try: | 55 | try: |
57 | unhandled[event_name] += 1 | 56 | unhandled[event_name] += 1 |
58 | except TypeError: | 57 | except TypeError: |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 50771b5813ee..1f08f008d289 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -370,9 +370,9 @@ static int thread__set_comm_adjust(struct thread *self, const char *comm) | |||
370 | 370 | ||
371 | int event__process_comm(event_t *self, struct perf_session *session) | 371 | int event__process_comm(event_t *self, struct perf_session *session) |
372 | { | 372 | { |
373 | struct thread *thread = perf_session__findnew(session, self->comm.pid); | 373 | struct thread *thread = perf_session__findnew(session, self->comm.tid); |
374 | 374 | ||
375 | dump_printf(": %s:%d\n", self->comm.comm, self->comm.pid); | 375 | dump_printf(": %s:%d\n", self->comm.comm, self->comm.tid); |
376 | 376 | ||
377 | if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) { | 377 | if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) { |
378 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); | 378 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); |
@@ -532,16 +532,11 @@ out_problem: | |||
532 | 532 | ||
533 | int event__process_task(event_t *self, struct perf_session *session) | 533 | int event__process_task(event_t *self, struct perf_session *session) |
534 | { | 534 | { |
535 | struct thread *thread = perf_session__findnew(session, self->fork.pid); | 535 | struct thread *thread = perf_session__findnew(session, self->fork.tid); |
536 | struct thread *parent = perf_session__findnew(session, self->fork.ppid); | 536 | struct thread *parent = perf_session__findnew(session, self->fork.ptid); |
537 | 537 | ||
538 | dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid, | 538 | dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid, |
539 | self->fork.ppid, self->fork.ptid); | 539 | self->fork.ppid, self->fork.ptid); |
540 | /* | ||
541 | * A thread clone will have the same PID for both parent and child. | ||
542 | */ | ||
543 | if (thread == parent) | ||
544 | return 0; | ||
545 | 540 | ||
546 | if (self->header.type == PERF_RECORD_EXIT) | 541 | if (self->header.type == PERF_RECORD_EXIT) |
547 | return 0; | 542 | return 0; |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index cbf7eae2ce09..07f89b66b318 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -965,7 +965,7 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file, | |||
965 | * Parse hexa addresses followed by ':' | 965 | * Parse hexa addresses followed by ':' |
966 | */ | 966 | */ |
967 | line_ip = strtoull(tmp, &tmp2, 16); | 967 | line_ip = strtoull(tmp, &tmp2, 16); |
968 | if (*tmp2 != ':') | 968 | if (*tmp2 != ':' || tmp == tmp2) |
969 | line_ip = -1; | 969 | line_ip = -1; |
970 | } | 970 | } |
971 | 971 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 81f39cab3aaa..33a632523743 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -208,7 +208,7 @@ static void python_process_event(int cpu, void *data, | |||
208 | int size __unused, | 208 | int size __unused, |
209 | unsigned long long nsecs, char *comm) | 209 | unsigned long long nsecs, char *comm) |
210 | { | 210 | { |
211 | PyObject *handler, *retval, *context, *t, *obj; | 211 | PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; |
212 | static char handler_name[256]; | 212 | static char handler_name[256]; |
213 | struct format_field *field; | 213 | struct format_field *field; |
214 | unsigned long long val; | 214 | unsigned long long val; |
@@ -232,6 +232,14 @@ static void python_process_event(int cpu, void *data, | |||
232 | 232 | ||
233 | sprintf(handler_name, "%s__%s", event->system, event->name); | 233 | sprintf(handler_name, "%s__%s", event->system, event->name); |
234 | 234 | ||
235 | handler = PyDict_GetItemString(main_dict, handler_name); | ||
236 | if (handler && !PyCallable_Check(handler)) | ||
237 | handler = NULL; | ||
238 | if (!handler) { | ||
239 | dict = PyDict_New(); | ||
240 | if (!dict) | ||
241 | Py_FatalError("couldn't create Python dict"); | ||
242 | } | ||
235 | s = nsecs / NSECS_PER_SEC; | 243 | s = nsecs / NSECS_PER_SEC; |
236 | ns = nsecs - s * NSECS_PER_SEC; | 244 | ns = nsecs - s * NSECS_PER_SEC; |
237 | 245 | ||
@@ -242,12 +250,20 @@ static void python_process_event(int cpu, void *data, | |||
242 | PyTuple_SetItem(t, n++, PyString_FromString(handler_name)); | 250 | PyTuple_SetItem(t, n++, PyString_FromString(handler_name)); |
243 | PyTuple_SetItem(t, n++, | 251 | PyTuple_SetItem(t, n++, |
244 | PyCObject_FromVoidPtr(scripting_context, NULL)); | 252 | PyCObject_FromVoidPtr(scripting_context, NULL)); |
245 | PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); | ||
246 | PyTuple_SetItem(t, n++, PyInt_FromLong(s)); | ||
247 | PyTuple_SetItem(t, n++, PyInt_FromLong(ns)); | ||
248 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); | ||
249 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); | ||
250 | 253 | ||
254 | if (handler) { | ||
255 | PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); | ||
256 | PyTuple_SetItem(t, n++, PyInt_FromLong(s)); | ||
257 | PyTuple_SetItem(t, n++, PyInt_FromLong(ns)); | ||
258 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); | ||
259 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); | ||
260 | } else { | ||
261 | PyDict_SetItemString(dict, "common_cpu", PyInt_FromLong(cpu)); | ||
262 | PyDict_SetItemString(dict, "common_s", PyInt_FromLong(s)); | ||
263 | PyDict_SetItemString(dict, "common_ns", PyInt_FromLong(ns)); | ||
264 | PyDict_SetItemString(dict, "common_pid", PyInt_FromLong(pid)); | ||
265 | PyDict_SetItemString(dict, "common_comm", PyString_FromString(comm)); | ||
266 | } | ||
251 | for (field = event->format.fields; field; field = field->next) { | 267 | for (field = event->format.fields; field; field = field->next) { |
252 | if (field->flags & FIELD_IS_STRING) { | 268 | if (field->flags & FIELD_IS_STRING) { |
253 | int offset; | 269 | int offset; |
@@ -272,27 +288,31 @@ static void python_process_event(int cpu, void *data, | |||
272 | obj = PyLong_FromUnsignedLongLong(val); | 288 | obj = PyLong_FromUnsignedLongLong(val); |
273 | } | 289 | } |
274 | } | 290 | } |
275 | PyTuple_SetItem(t, n++, obj); | 291 | if (handler) |
292 | PyTuple_SetItem(t, n++, obj); | ||
293 | else | ||
294 | PyDict_SetItemString(dict, field->name, obj); | ||
295 | |||
276 | } | 296 | } |
297 | if (!handler) | ||
298 | PyTuple_SetItem(t, n++, dict); | ||
277 | 299 | ||
278 | if (_PyTuple_Resize(&t, n) == -1) | 300 | if (_PyTuple_Resize(&t, n) == -1) |
279 | Py_FatalError("error resizing Python tuple"); | 301 | Py_FatalError("error resizing Python tuple"); |
280 | 302 | ||
281 | handler = PyDict_GetItemString(main_dict, handler_name); | 303 | if (handler) { |
282 | if (handler && PyCallable_Check(handler)) { | ||
283 | retval = PyObject_CallObject(handler, t); | 304 | retval = PyObject_CallObject(handler, t); |
284 | if (retval == NULL) | 305 | if (retval == NULL) |
285 | handler_call_die(handler_name); | 306 | handler_call_die(handler_name); |
286 | } else { | 307 | } else { |
287 | handler = PyDict_GetItemString(main_dict, "trace_unhandled"); | 308 | handler = PyDict_GetItemString(main_dict, "trace_unhandled"); |
288 | if (handler && PyCallable_Check(handler)) { | 309 | if (handler && PyCallable_Check(handler)) { |
289 | if (_PyTuple_Resize(&t, N_COMMON_FIELDS) == -1) | ||
290 | Py_FatalError("error resizing Python tuple"); | ||
291 | 310 | ||
292 | retval = PyObject_CallObject(handler, t); | 311 | retval = PyObject_CallObject(handler, t); |
293 | if (retval == NULL) | 312 | if (retval == NULL) |
294 | handler_call_die("trace_unhandled"); | 313 | handler_call_die("trace_unhandled"); |
295 | } | 314 | } |
315 | Py_DECREF(dict); | ||
296 | } | 316 | } |
297 | 317 | ||
298 | Py_DECREF(t); | 318 | Py_DECREF(t); |
@@ -548,12 +568,10 @@ static int python_generate_script(const char *outfile) | |||
548 | } | 568 | } |
549 | 569 | ||
550 | fprintf(ofp, "def trace_unhandled(event_name, context, " | 570 | fprintf(ofp, "def trace_unhandled(event_name, context, " |
551 | "common_cpu, common_secs, common_nsecs,\n\t\t" | 571 | "event_fields_dict):\n"); |
552 | "common_pid, common_comm):\n"); | ||
553 | 572 | ||
554 | fprintf(ofp, "\t\tprint_header(event_name, common_cpu, " | 573 | fprintf(ofp, "\t\tprint ' '.join(['%%s=%%s'%%(k,str(v))" |
555 | "common_secs, common_nsecs,\n\t\tcommon_pid, " | 574 | "for k,v in sorted(event_fields_dict.items())])\n\n"); |
556 | "common_comm)\n\n"); | ||
557 | 575 | ||
558 | fprintf(ofp, "def print_header(" | 576 | fprintf(ofp, "def print_header(" |
559 | "event_name, cpu, secs, nsecs, pid, comm):\n" | 577 | "event_name, cpu, secs, nsecs, pid, comm):\n" |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 7fd6b151feb5..b63e5713849f 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1745,7 +1745,12 @@ static int dso__load_kernel_sym(struct dso *self, struct map *map, | |||
1745 | if (symbol_conf.vmlinux_name != NULL) { | 1745 | if (symbol_conf.vmlinux_name != NULL) { |
1746 | err = dso__load_vmlinux(self, map, | 1746 | err = dso__load_vmlinux(self, map, |
1747 | symbol_conf.vmlinux_name, filter); | 1747 | symbol_conf.vmlinux_name, filter); |
1748 | goto out_try_fixup; | 1748 | if (err > 0) { |
1749 | dso__set_long_name(self, | ||
1750 | strdup(symbol_conf.vmlinux_name)); | ||
1751 | goto out_fixup; | ||
1752 | } | ||
1753 | return err; | ||
1749 | } | 1754 | } |
1750 | 1755 | ||
1751 | if (vmlinux_path != NULL) { | 1756 | if (vmlinux_path != NULL) { |
@@ -1806,7 +1811,6 @@ do_kallsyms: | |||
1806 | pr_debug("Using %s for symbols\n", kallsyms_filename); | 1811 | pr_debug("Using %s for symbols\n", kallsyms_filename); |
1807 | free(kallsyms_allocated_filename); | 1812 | free(kallsyms_allocated_filename); |
1808 | 1813 | ||
1809 | out_try_fixup: | ||
1810 | if (err > 0) { | 1814 | if (err > 0) { |
1811 | out_fixup: | 1815 | out_fixup: |
1812 | if (kallsyms_filename != NULL) | 1816 | if (kallsyms_filename != NULL) |