aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-record.c11
-rw-r--r--tools/perf/builtin-top.c4
-rw-r--r--tools/perf/util/machine.c20
-rw-r--r--tools/perf/util/thread.c6
4 files changed, 37 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 25cf6b404e8a..a660022f2c92 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -521,6 +521,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
521 goto out_child; 521 goto out_child;
522 } 522 }
523 523
524 /*
525 * Normally perf_session__new would do this, but it doesn't have the
526 * evlist.
527 */
528 if (rec->tool.ordered_events && !perf_evlist__sample_id_all(rec->evlist)) {
529 pr_warning("WARNING: No sample_id_all support, falling back to unordered processing\n");
530 rec->tool.ordered_events = false;
531 }
532
524 if (!rec->evlist->nr_groups) 533 if (!rec->evlist->nr_groups)
525 perf_header__clear_feat(&session->header, HEADER_GROUP_DESC); 534 perf_header__clear_feat(&session->header, HEADER_GROUP_DESC);
526 535
@@ -970,9 +979,11 @@ static struct record record = {
970 .tool = { 979 .tool = {
971 .sample = process_sample_event, 980 .sample = process_sample_event,
972 .fork = perf_event__process_fork, 981 .fork = perf_event__process_fork,
982 .exit = perf_event__process_exit,
973 .comm = perf_event__process_comm, 983 .comm = perf_event__process_comm,
974 .mmap = perf_event__process_mmap, 984 .mmap = perf_event__process_mmap,
975 .mmap2 = perf_event__process_mmap2, 985 .mmap2 = perf_event__process_mmap2,
986 .ordered_events = true,
976 }, 987 },
977}; 988};
978 989
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index bfe24f1e362f..8c465c83aabf 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -602,8 +602,8 @@ static void display_sig(int sig __maybe_unused)
602 602
603static void display_setup_sig(void) 603static void display_setup_sig(void)
604{ 604{
605 signal(SIGSEGV, display_sig); 605 signal(SIGSEGV, sighandler_dump_stack);
606 signal(SIGFPE, display_sig); 606 signal(SIGFPE, sighandler_dump_stack);
607 signal(SIGINT, display_sig); 607 signal(SIGINT, display_sig);
608 signal(SIGQUIT, display_sig); 608 signal(SIGQUIT, display_sig);
609 signal(SIGTERM, display_sig); 609 signal(SIGTERM, display_sig);
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index be3e00891d22..6309f7ceb08f 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1395,6 +1395,24 @@ int machine__process_fork_event(struct machine *machine, union perf_event *event
1395 event->fork.ptid); 1395 event->fork.ptid);
1396 int err = 0; 1396 int err = 0;
1397 1397
1398 if (dump_trace)
1399 perf_event__fprintf_task(event, stdout);
1400
1401 /*
1402 * There may be an existing thread that is not actually the parent,
1403 * either because we are processing events out of order, or because the
1404 * (fork) event that would have removed the thread was lost. Assume the
1405 * latter case and continue on as best we can.
1406 */
1407 if (parent->pid_ != (pid_t)event->fork.ppid) {
1408 dump_printf("removing erroneous parent thread %d/%d\n",
1409 parent->pid_, parent->tid);
1410 machine__remove_thread(machine, parent);
1411 thread__put(parent);
1412 parent = machine__findnew_thread(machine, event->fork.ppid,
1413 event->fork.ptid);
1414 }
1415
1398 /* if a thread currently exists for the thread id remove it */ 1416 /* if a thread currently exists for the thread id remove it */
1399 if (thread != NULL) { 1417 if (thread != NULL) {
1400 machine__remove_thread(machine, thread); 1418 machine__remove_thread(machine, thread);
@@ -1403,8 +1421,6 @@ int machine__process_fork_event(struct machine *machine, union perf_event *event
1403 1421
1404 thread = machine__findnew_thread(machine, event->fork.pid, 1422 thread = machine__findnew_thread(machine, event->fork.pid,
1405 event->fork.tid); 1423 event->fork.tid);
1406 if (dump_trace)
1407 perf_event__fprintf_task(event, stdout);
1408 1424
1409 if (thread == NULL || parent == NULL || 1425 if (thread == NULL || parent == NULL ||
1410 thread__fork(thread, parent, sample->time) < 0) { 1426 thread__fork(thread, parent, sample->time) < 0) {
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 28c4b746baa1..0a9ae8014729 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -191,6 +191,12 @@ static int thread__clone_map_groups(struct thread *thread,
191 if (thread->pid_ == parent->pid_) 191 if (thread->pid_ == parent->pid_)
192 return 0; 192 return 0;
193 193
194 if (thread->mg == parent->mg) {
195 pr_debug("broken map groups on thread %d/%d parent %d/%d\n",
196 thread->pid_, thread->tid, parent->pid_, parent->tid);
197 return 0;
198 }
199
194 /* But this one is new process, copy maps. */ 200 /* But this one is new process, copy maps. */
195 for (i = 0; i < MAP__NR_TYPES; ++i) 201 for (i = 0; i < MAP__NR_TYPES; ++i)
196 if (map_groups__clone(thread->mg, parent->mg, i) < 0) 202 if (map_groups__clone(thread->mg, parent->mg, i) < 0)