diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-05-12 11:57:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-05-12 11:57:48 -0400 |
commit | 26f273802b6ed28e059f4359bc7711dffceda022 (patch) | |
tree | 2041502c5a2cdaa90457becdf8f444d0b5378410 /tools | |
parent | 3a497f48637e2aac17eabb84a17f8ac5216028fc (diff) | |
parent | 13ce34df11833482cd698331fdbb3f8ced06340d (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core
Pull perf/core improvements and fixes from Jiri Olsa:
* Propagate exit status of a command line workload for
record command (Namhyung Kim)
* Use tid for finding thread (Namhyung Kim)
* Clarify the output of perf sched map plus small sched
command fixies (Dongsheng Yang)
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-inject.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-kmem.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 158 | ||||
-rw-r--r-- | tools/perf/builtin-sched.c | 38 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 8 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/Makefile | 4 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/test-all.c | 5 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/test-on-exit.c | 16 | ||||
-rw-r--r-- | tools/perf/tests/code-reading.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/hists_filter.c | 1 | ||||
-rw-r--r-- | tools/perf/tests/hists_link.c | 2 | ||||
-rw-r--r-- | tools/perf/util/build-id.c | 2 | ||||
-rw-r--r-- | tools/perf/util/event.c | 2 |
13 files changed, 90 insertions, 152 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 3a7387551369..6a3af0013d68 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -209,7 +209,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, | |||
209 | 209 | ||
210 | cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 210 | cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
211 | 211 | ||
212 | thread = machine__findnew_thread(machine, sample->pid, sample->pid); | 212 | thread = machine__findnew_thread(machine, sample->pid, sample->tid); |
213 | if (thread == NULL) { | 213 | if (thread == NULL) { |
214 | pr_err("problem processing %d event, skipping it.\n", | 214 | pr_err("problem processing %d event, skipping it.\n", |
215 | event->header.type); | 215 | event->header.type); |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index f91fa4376f4b..bef3376bfaf3 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -235,7 +235,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, | |||
235 | struct machine *machine) | 235 | struct machine *machine) |
236 | { | 236 | { |
237 | struct thread *thread = machine__findnew_thread(machine, sample->pid, | 237 | struct thread *thread = machine__findnew_thread(machine, sample->pid, |
238 | sample->pid); | 238 | sample->tid); |
239 | 239 | ||
240 | if (thread == NULL) { | 240 | if (thread == NULL) { |
241 | pr_debug("problem processing %d event, skipping it.\n", | 241 | pr_debug("problem processing %d event, skipping it.\n", |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 8ce62ef7f6c3..e4c85b8f46c2 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -30,37 +30,6 @@ | |||
30 | #include <sched.h> | 30 | #include <sched.h> |
31 | #include <sys/mman.h> | 31 | #include <sys/mman.h> |
32 | 32 | ||
33 | #ifndef HAVE_ON_EXIT_SUPPORT | ||
34 | #ifndef ATEXIT_MAX | ||
35 | #define ATEXIT_MAX 32 | ||
36 | #endif | ||
37 | static int __on_exit_count = 0; | ||
38 | typedef void (*on_exit_func_t) (int, void *); | ||
39 | static on_exit_func_t __on_exit_funcs[ATEXIT_MAX]; | ||
40 | static void *__on_exit_args[ATEXIT_MAX]; | ||
41 | static int __exitcode = 0; | ||
42 | static void __handle_on_exit_funcs(void); | ||
43 | static int on_exit(on_exit_func_t function, void *arg); | ||
44 | #define exit(x) (exit)(__exitcode = (x)) | ||
45 | |||
46 | static int on_exit(on_exit_func_t function, void *arg) | ||
47 | { | ||
48 | if (__on_exit_count == ATEXIT_MAX) | ||
49 | return -ENOMEM; | ||
50 | else if (__on_exit_count == 0) | ||
51 | atexit(__handle_on_exit_funcs); | ||
52 | __on_exit_funcs[__on_exit_count] = function; | ||
53 | __on_exit_args[__on_exit_count++] = arg; | ||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | static void __handle_on_exit_funcs(void) | ||
58 | { | ||
59 | int i; | ||
60 | for (i = 0; i < __on_exit_count; i++) | ||
61 | __on_exit_funcs[i] (__exitcode, __on_exit_args[i]); | ||
62 | } | ||
63 | #endif | ||
64 | 33 | ||
65 | struct record { | 34 | struct record { |
66 | struct perf_tool tool; | 35 | struct perf_tool tool; |
@@ -147,29 +116,19 @@ static void sig_handler(int sig) | |||
147 | { | 116 | { |
148 | if (sig == SIGCHLD) | 117 | if (sig == SIGCHLD) |
149 | child_finished = 1; | 118 | child_finished = 1; |
119 | else | ||
120 | signr = sig; | ||
150 | 121 | ||
151 | done = 1; | 122 | done = 1; |
152 | signr = sig; | ||
153 | } | 123 | } |
154 | 124 | ||
155 | static void record__sig_exit(int exit_status __maybe_unused, void *arg) | 125 | static void record__sig_exit(void) |
156 | { | 126 | { |
157 | struct record *rec = arg; | 127 | if (signr == -1) |
158 | int status; | ||
159 | |||
160 | if (rec->evlist->workload.pid > 0) { | ||
161 | if (!child_finished) | ||
162 | kill(rec->evlist->workload.pid, SIGTERM); | ||
163 | |||
164 | wait(&status); | ||
165 | if (WIFSIGNALED(status)) | ||
166 | psignal(WTERMSIG(status), rec->progname); | ||
167 | } | ||
168 | |||
169 | if (signr == -1 || signr == SIGUSR1) | ||
170 | return; | 128 | return; |
171 | 129 | ||
172 | signal(signr, SIG_DFL); | 130 | signal(signr, SIG_DFL); |
131 | raise(signr); | ||
173 | } | 132 | } |
174 | 133 | ||
175 | static int record__open(struct record *rec) | 134 | static int record__open(struct record *rec) |
@@ -243,27 +202,6 @@ static int process_buildids(struct record *rec) | |||
243 | size, &build_id__mark_dso_hit_ops); | 202 | size, &build_id__mark_dso_hit_ops); |
244 | } | 203 | } |
245 | 204 | ||
246 | static void record__exit(int status, void *arg) | ||
247 | { | ||
248 | struct record *rec = arg; | ||
249 | struct perf_data_file *file = &rec->file; | ||
250 | |||
251 | if (status != 0) | ||
252 | return; | ||
253 | |||
254 | if (!file->is_pipe) { | ||
255 | rec->session->header.data_size += rec->bytes_written; | ||
256 | |||
257 | if (!rec->no_buildid) | ||
258 | process_buildids(rec); | ||
259 | perf_session__write_header(rec->session, rec->evlist, | ||
260 | file->fd, true); | ||
261 | perf_session__delete(rec->session); | ||
262 | perf_evlist__delete(rec->evlist); | ||
263 | symbol__exit(); | ||
264 | } | ||
265 | } | ||
266 | |||
267 | static void perf_event__synthesize_guest_os(struct machine *machine, void *data) | 205 | static void perf_event__synthesize_guest_os(struct machine *machine, void *data) |
268 | { | 206 | { |
269 | int err; | 207 | int err; |
@@ -344,18 +282,19 @@ static volatile int workload_exec_errno; | |||
344 | * if the fork fails, since we asked by setting its | 282 | * if the fork fails, since we asked by setting its |
345 | * want_signal to true. | 283 | * want_signal to true. |
346 | */ | 284 | */ |
347 | static void workload_exec_failed_signal(int signo, siginfo_t *info, | 285 | static void workload_exec_failed_signal(int signo __maybe_unused, |
286 | siginfo_t *info, | ||
348 | void *ucontext __maybe_unused) | 287 | void *ucontext __maybe_unused) |
349 | { | 288 | { |
350 | workload_exec_errno = info->si_value.sival_int; | 289 | workload_exec_errno = info->si_value.sival_int; |
351 | done = 1; | 290 | done = 1; |
352 | signr = signo; | ||
353 | child_finished = 1; | 291 | child_finished = 1; |
354 | } | 292 | } |
355 | 293 | ||
356 | static int __cmd_record(struct record *rec, int argc, const char **argv) | 294 | static int __cmd_record(struct record *rec, int argc, const char **argv) |
357 | { | 295 | { |
358 | int err; | 296 | int err; |
297 | int status = 0; | ||
359 | unsigned long waking = 0; | 298 | unsigned long waking = 0; |
360 | const bool forks = argc > 0; | 299 | const bool forks = argc > 0; |
361 | struct machine *machine; | 300 | struct machine *machine; |
@@ -367,7 +306,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
367 | 306 | ||
368 | rec->progname = argv[0]; | 307 | rec->progname = argv[0]; |
369 | 308 | ||
370 | on_exit(record__sig_exit, rec); | 309 | atexit(record__sig_exit); |
371 | signal(SIGCHLD, sig_handler); | 310 | signal(SIGCHLD, sig_handler); |
372 | signal(SIGINT, sig_handler); | 311 | signal(SIGINT, sig_handler); |
373 | signal(SIGTERM, sig_handler); | 312 | signal(SIGTERM, sig_handler); |
@@ -388,32 +327,28 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
388 | workload_exec_failed_signal); | 327 | workload_exec_failed_signal); |
389 | if (err < 0) { | 328 | if (err < 0) { |
390 | pr_err("Couldn't run the workload!\n"); | 329 | pr_err("Couldn't run the workload!\n"); |
330 | status = err; | ||
391 | goto out_delete_session; | 331 | goto out_delete_session; |
392 | } | 332 | } |
393 | } | 333 | } |
394 | 334 | ||
395 | if (record__open(rec) != 0) { | 335 | if (record__open(rec) != 0) { |
396 | err = -1; | 336 | err = -1; |
397 | goto out_delete_session; | 337 | goto out_child; |
398 | } | 338 | } |
399 | 339 | ||
400 | if (!rec->evlist->nr_groups) | 340 | if (!rec->evlist->nr_groups) |
401 | perf_header__clear_feat(&session->header, HEADER_GROUP_DESC); | 341 | perf_header__clear_feat(&session->header, HEADER_GROUP_DESC); |
402 | 342 | ||
403 | /* | ||
404 | * perf_session__delete(session) will be called at record__exit() | ||
405 | */ | ||
406 | on_exit(record__exit, rec); | ||
407 | |||
408 | if (file->is_pipe) { | 343 | if (file->is_pipe) { |
409 | err = perf_header__write_pipe(file->fd); | 344 | err = perf_header__write_pipe(file->fd); |
410 | if (err < 0) | 345 | if (err < 0) |
411 | goto out_delete_session; | 346 | goto out_child; |
412 | } else { | 347 | } else { |
413 | err = perf_session__write_header(session, rec->evlist, | 348 | err = perf_session__write_header(session, rec->evlist, |
414 | file->fd, false); | 349 | file->fd, false); |
415 | if (err < 0) | 350 | if (err < 0) |
416 | goto out_delete_session; | 351 | goto out_child; |
417 | } | 352 | } |
418 | 353 | ||
419 | if (!rec->no_buildid | 354 | if (!rec->no_buildid |
@@ -421,7 +356,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
421 | pr_err("Couldn't generate buildids. " | 356 | pr_err("Couldn't generate buildids. " |
422 | "Use --no-buildid to profile anyway.\n"); | 357 | "Use --no-buildid to profile anyway.\n"); |
423 | err = -1; | 358 | err = -1; |
424 | goto out_delete_session; | 359 | goto out_child; |
425 | } | 360 | } |
426 | 361 | ||
427 | machine = &session->machines.host; | 362 | machine = &session->machines.host; |
@@ -431,7 +366,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
431 | process_synthesized_event); | 366 | process_synthesized_event); |
432 | if (err < 0) { | 367 | if (err < 0) { |
433 | pr_err("Couldn't synthesize attrs.\n"); | 368 | pr_err("Couldn't synthesize attrs.\n"); |
434 | goto out_delete_session; | 369 | goto out_child; |
435 | } | 370 | } |
436 | 371 | ||
437 | if (have_tracepoints(&rec->evlist->entries)) { | 372 | if (have_tracepoints(&rec->evlist->entries)) { |
@@ -447,7 +382,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
447 | process_synthesized_event); | 382 | process_synthesized_event); |
448 | if (err <= 0) { | 383 | if (err <= 0) { |
449 | pr_err("Couldn't record tracing data.\n"); | 384 | pr_err("Couldn't record tracing data.\n"); |
450 | goto out_delete_session; | 385 | goto out_child; |
451 | } | 386 | } |
452 | rec->bytes_written += err; | 387 | rec->bytes_written += err; |
453 | } | 388 | } |
@@ -475,7 +410,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
475 | err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads, | 410 | err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads, |
476 | process_synthesized_event, opts->sample_address); | 411 | process_synthesized_event, opts->sample_address); |
477 | if (err != 0) | 412 | if (err != 0) |
478 | goto out_delete_session; | 413 | goto out_child; |
479 | 414 | ||
480 | if (rec->realtime_prio) { | 415 | if (rec->realtime_prio) { |
481 | struct sched_param param; | 416 | struct sched_param param; |
@@ -484,7 +419,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
484 | if (sched_setscheduler(0, SCHED_FIFO, ¶m)) { | 419 | if (sched_setscheduler(0, SCHED_FIFO, ¶m)) { |
485 | pr_err("Could not set realtime priority.\n"); | 420 | pr_err("Could not set realtime priority.\n"); |
486 | err = -1; | 421 | err = -1; |
487 | goto out_delete_session; | 422 | goto out_child; |
488 | } | 423 | } |
489 | } | 424 | } |
490 | 425 | ||
@@ -512,13 +447,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
512 | 447 | ||
513 | if (record__mmap_read_all(rec) < 0) { | 448 | if (record__mmap_read_all(rec) < 0) { |
514 | err = -1; | 449 | err = -1; |
515 | goto out_delete_session; | 450 | goto out_child; |
516 | } | 451 | } |
517 | 452 | ||
518 | if (hits == rec->samples) { | 453 | if (hits == rec->samples) { |
519 | if (done) | 454 | if (done) |
520 | break; | 455 | break; |
521 | err = poll(rec->evlist->pollfd, rec->evlist->nr_fds, -1); | 456 | err = poll(rec->evlist->pollfd, rec->evlist->nr_fds, -1); |
457 | if (err < 0 && errno == EINTR) | ||
458 | err = 0; | ||
522 | waking++; | 459 | waking++; |
523 | } | 460 | } |
524 | 461 | ||
@@ -538,28 +475,52 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
538 | const char *emsg = strerror_r(workload_exec_errno, msg, sizeof(msg)); | 475 | const char *emsg = strerror_r(workload_exec_errno, msg, sizeof(msg)); |
539 | pr_err("Workload failed: %s\n", emsg); | 476 | pr_err("Workload failed: %s\n", emsg); |
540 | err = -1; | 477 | err = -1; |
541 | goto out_delete_session; | 478 | goto out_child; |
542 | } | 479 | } |
543 | 480 | ||
544 | if (quiet || signr == SIGUSR1) | 481 | if (!quiet) { |
545 | return 0; | 482 | fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); |
546 | 483 | ||
547 | fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); | 484 | /* |
485 | * Approximate RIP event size: 24 bytes. | ||
486 | */ | ||
487 | fprintf(stderr, | ||
488 | "[ perf record: Captured and wrote %.3f MB %s (~%" PRIu64 " samples) ]\n", | ||
489 | (double)rec->bytes_written / 1024.0 / 1024.0, | ||
490 | file->path, | ||
491 | rec->bytes_written / 24); | ||
492 | } | ||
548 | 493 | ||
549 | /* | 494 | out_child: |
550 | * Approximate RIP event size: 24 bytes. | 495 | if (forks) { |
551 | */ | 496 | int exit_status; |
552 | fprintf(stderr, | ||
553 | "[ perf record: Captured and wrote %.3f MB %s (~%" PRIu64 " samples) ]\n", | ||
554 | (double)rec->bytes_written / 1024.0 / 1024.0, | ||
555 | file->path, | ||
556 | rec->bytes_written / 24); | ||
557 | 497 | ||
558 | return 0; | 498 | if (!child_finished) |
499 | kill(rec->evlist->workload.pid, SIGTERM); | ||
500 | |||
501 | wait(&exit_status); | ||
502 | |||
503 | if (err < 0) | ||
504 | status = err; | ||
505 | else if (WIFEXITED(exit_status)) | ||
506 | status = WEXITSTATUS(exit_status); | ||
507 | else if (WIFSIGNALED(exit_status)) | ||
508 | signr = WTERMSIG(exit_status); | ||
509 | } else | ||
510 | status = err; | ||
511 | |||
512 | if (!err && !file->is_pipe) { | ||
513 | rec->session->header.data_size += rec->bytes_written; | ||
514 | |||
515 | if (!rec->no_buildid) | ||
516 | process_buildids(rec); | ||
517 | perf_session__write_header(rec->session, rec->evlist, | ||
518 | file->fd, true); | ||
519 | } | ||
559 | 520 | ||
560 | out_delete_session: | 521 | out_delete_session: |
561 | perf_session__delete(session); | 522 | perf_session__delete(session); |
562 | return err; | 523 | return status; |
563 | } | 524 | } |
564 | 525 | ||
565 | #define BRANCH_OPT(n, m) \ | 526 | #define BRANCH_OPT(n, m) \ |
@@ -988,6 +949,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) | |||
988 | 949 | ||
989 | err = __cmd_record(&record, argc, argv); | 950 | err = __cmd_record(&record, argc, argv); |
990 | out_symbol_exit: | 951 | out_symbol_exit: |
952 | perf_evlist__delete(rec->evlist); | ||
991 | symbol__exit(); | 953 | symbol__exit(); |
992 | return err; | 954 | return err; |
993 | } | 955 | } |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index d3fb0ed7240a..2579215f5743 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -66,7 +66,7 @@ struct sched_atom { | |||
66 | struct task_desc *wakee; | 66 | struct task_desc *wakee; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | 69 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP" |
70 | 70 | ||
71 | enum thread_state { | 71 | enum thread_state { |
72 | THREAD_SLEEPING = 0, | 72 | THREAD_SLEEPING = 0, |
@@ -1300,17 +1300,25 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1300 | 1300 | ||
1301 | new_shortname = 0; | 1301 | new_shortname = 0; |
1302 | if (!sched_in->shortname[0]) { | 1302 | if (!sched_in->shortname[0]) { |
1303 | sched_in->shortname[0] = sched->next_shortname1; | 1303 | if (!strcmp(thread__comm_str(sched_in), "swapper")) { |
1304 | sched_in->shortname[1] = sched->next_shortname2; | 1304 | /* |
1305 | 1305 | * Don't allocate a letter-number for swapper:0 | |
1306 | if (sched->next_shortname1 < 'Z') { | 1306 | * as a shortname. Instead, we use '.' for it. |
1307 | sched->next_shortname1++; | 1307 | */ |
1308 | sched_in->shortname[0] = '.'; | ||
1309 | sched_in->shortname[1] = ' '; | ||
1308 | } else { | 1310 | } else { |
1309 | sched->next_shortname1='A'; | 1311 | sched_in->shortname[0] = sched->next_shortname1; |
1310 | if (sched->next_shortname2 < '9') { | 1312 | sched_in->shortname[1] = sched->next_shortname2; |
1311 | sched->next_shortname2++; | 1313 | |
1314 | if (sched->next_shortname1 < 'Z') { | ||
1315 | sched->next_shortname1++; | ||
1312 | } else { | 1316 | } else { |
1313 | sched->next_shortname2='0'; | 1317 | sched->next_shortname1 = 'A'; |
1318 | if (sched->next_shortname2 < '9') | ||
1319 | sched->next_shortname2++; | ||
1320 | else | ||
1321 | sched->next_shortname2 = '0'; | ||
1314 | } | 1322 | } |
1315 | } | 1323 | } |
1316 | new_shortname = 1; | 1324 | new_shortname = 1; |
@@ -1322,12 +1330,9 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel, | |||
1322 | else | 1330 | else |
1323 | printf("*"); | 1331 | printf("*"); |
1324 | 1332 | ||
1325 | if (sched->curr_thread[cpu]) { | 1333 | if (sched->curr_thread[cpu]) |
1326 | if (sched->curr_thread[cpu]->tid) | 1334 | printf("%2s ", sched->curr_thread[cpu]->shortname); |
1327 | printf("%2s ", sched->curr_thread[cpu]->shortname); | 1335 | else |
1328 | else | ||
1329 | printf(". "); | ||
1330 | } else | ||
1331 | printf(" "); | 1336 | printf(" "); |
1332 | } | 1337 | } |
1333 | 1338 | ||
@@ -1635,6 +1640,7 @@ static int __cmd_record(int argc, const char **argv) | |||
1635 | "-e", "sched:sched_stat_runtime", | 1640 | "-e", "sched:sched_stat_runtime", |
1636 | "-e", "sched:sched_process_fork", | 1641 | "-e", "sched:sched_process_fork", |
1637 | "-e", "sched:sched_wakeup", | 1642 | "-e", "sched:sched_wakeup", |
1643 | "-e", "sched:sched_wakeup_new", | ||
1638 | "-e", "sched:sched_migrate_task", | 1644 | "-e", "sched:sched_migrate_task", |
1639 | }; | 1645 | }; |
1640 | 1646 | ||
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 150c84c7416d..f2edc593a7a7 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -174,7 +174,6 @@ CORE_FEATURE_TESTS = \ | |||
174 | libpython-version \ | 174 | libpython-version \ |
175 | libslang \ | 175 | libslang \ |
176 | libunwind \ | 176 | libunwind \ |
177 | on-exit \ | ||
178 | stackprotector-all \ | 177 | stackprotector-all \ |
179 | timerfd \ | 178 | timerfd \ |
180 | libdw-dwarf-unwind | 179 | libdw-dwarf-unwind |
@@ -200,7 +199,6 @@ VF_FEATURE_TESTS = \ | |||
200 | libelf-getphdrnum \ | 199 | libelf-getphdrnum \ |
201 | libelf-mmap \ | 200 | libelf-mmap \ |
202 | libpython-version \ | 201 | libpython-version \ |
203 | on-exit \ | ||
204 | stackprotector-all \ | 202 | stackprotector-all \ |
205 | timerfd \ | 203 | timerfd \ |
206 | libunwind-debug-frame \ | 204 | libunwind-debug-frame \ |
@@ -571,12 +569,6 @@ ifneq ($(filter -lbfd,$(EXTLIBS)),) | |||
571 | CFLAGS += -DHAVE_LIBBFD_SUPPORT | 569 | CFLAGS += -DHAVE_LIBBFD_SUPPORT |
572 | endif | 570 | endif |
573 | 571 | ||
574 | ifndef NO_ON_EXIT | ||
575 | ifeq ($(feature-on-exit), 1) | ||
576 | CFLAGS += -DHAVE_ON_EXIT_SUPPORT | ||
577 | endif | ||
578 | endif | ||
579 | |||
580 | ifndef NO_BACKTRACE | 572 | ifndef NO_BACKTRACE |
581 | ifeq ($(feature-backtrace), 1) | 573 | ifeq ($(feature-backtrace), 1) |
582 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT | 574 | CFLAGS += -DHAVE_BACKTRACE_SUPPORT |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 2da103c53f89..64c84e5f0514 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -24,7 +24,6 @@ FILES= \ | |||
24 | test-libslang.bin \ | 24 | test-libslang.bin \ |
25 | test-libunwind.bin \ | 25 | test-libunwind.bin \ |
26 | test-libunwind-debug-frame.bin \ | 26 | test-libunwind-debug-frame.bin \ |
27 | test-on-exit.bin \ | ||
28 | test-stackprotector-all.bin \ | 27 | test-stackprotector-all.bin \ |
29 | test-timerfd.bin \ | 28 | test-timerfd.bin \ |
30 | test-libdw-dwarf-unwind.bin | 29 | test-libdw-dwarf-unwind.bin |
@@ -133,9 +132,6 @@ test-liberty-z.bin: | |||
133 | test-cplus-demangle.bin: | 132 | test-cplus-demangle.bin: |
134 | $(BUILD) -liberty | 133 | $(BUILD) -liberty |
135 | 134 | ||
136 | test-on-exit.bin: | ||
137 | $(BUILD) | ||
138 | |||
139 | test-backtrace.bin: | 135 | test-backtrace.bin: |
140 | $(BUILD) | 136 | $(BUILD) |
141 | 137 | ||
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c index fc37eb3ca17b..fe5c1e5c952f 100644 --- a/tools/perf/config/feature-checks/test-all.c +++ b/tools/perf/config/feature-checks/test-all.c | |||
@@ -69,10 +69,6 @@ | |||
69 | # include "test-libbfd.c" | 69 | # include "test-libbfd.c" |
70 | #undef main | 70 | #undef main |
71 | 71 | ||
72 | #define main main_test_on_exit | ||
73 | # include "test-on-exit.c" | ||
74 | #undef main | ||
75 | |||
76 | #define main main_test_backtrace | 72 | #define main main_test_backtrace |
77 | # include "test-backtrace.c" | 73 | # include "test-backtrace.c" |
78 | #undef main | 74 | #undef main |
@@ -110,7 +106,6 @@ int main(int argc, char *argv[]) | |||
110 | main_test_gtk2(argc, argv); | 106 | main_test_gtk2(argc, argv); |
111 | main_test_gtk2_infobar(argc, argv); | 107 | main_test_gtk2_infobar(argc, argv); |
112 | main_test_libbfd(); | 108 | main_test_libbfd(); |
113 | main_test_on_exit(); | ||
114 | main_test_backtrace(); | 109 | main_test_backtrace(); |
115 | main_test_libnuma(); | 110 | main_test_libnuma(); |
116 | main_test_timerfd(); | 111 | main_test_timerfd(); |
diff --git a/tools/perf/config/feature-checks/test-on-exit.c b/tools/perf/config/feature-checks/test-on-exit.c deleted file mode 100644 index 8e88b16e6ded..000000000000 --- a/tools/perf/config/feature-checks/test-on-exit.c +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | static void exit_fn(int status, void *__data) | ||
5 | { | ||
6 | printf("exit status: %d, data: %d\n", status, *(int *)__data); | ||
7 | } | ||
8 | |||
9 | static int data = 123; | ||
10 | |||
11 | int main(void) | ||
12 | { | ||
13 | on_exit(exit_fn, &data); | ||
14 | |||
15 | return 321; | ||
16 | } | ||
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index adf3de3e38d6..67f2d6323558 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -256,7 +256,7 @@ static int process_sample_event(struct machine *machine, | |||
256 | return -1; | 256 | return -1; |
257 | } | 257 | } |
258 | 258 | ||
259 | thread = machine__findnew_thread(machine, sample.pid, sample.pid); | 259 | thread = machine__findnew_thread(machine, sample.pid, sample.tid); |
260 | if (!thread) { | 260 | if (!thread) { |
261 | pr_debug("machine__findnew_thread failed\n"); | 261 | pr_debug("machine__findnew_thread failed\n"); |
262 | return -1; | 262 | return -1; |
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c index 23dc2f4d12c3..4617a8bee29b 100644 --- a/tools/perf/tests/hists_filter.c +++ b/tools/perf/tests/hists_filter.c | |||
@@ -69,6 +69,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
69 | evsel->hists.symbol_filter_str = NULL; | 69 | evsel->hists.symbol_filter_str = NULL; |
70 | 70 | ||
71 | sample.pid = fake_samples[i].pid; | 71 | sample.pid = fake_samples[i].pid; |
72 | sample.tid = fake_samples[i].pid; | ||
72 | sample.ip = fake_samples[i].ip; | 73 | sample.ip = fake_samples[i].ip; |
73 | 74 | ||
74 | if (perf_event__preprocess_sample(&event, machine, &al, | 75 | if (perf_event__preprocess_sample(&event, machine, &al, |
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index e42d6790811a..b009bbf440d9 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c | |||
@@ -81,6 +81,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
81 | }; | 81 | }; |
82 | 82 | ||
83 | sample.pid = fake_common_samples[k].pid; | 83 | sample.pid = fake_common_samples[k].pid; |
84 | sample.tid = fake_common_samples[k].pid; | ||
84 | sample.ip = fake_common_samples[k].ip; | 85 | sample.ip = fake_common_samples[k].ip; |
85 | if (perf_event__preprocess_sample(&event, machine, &al, | 86 | if (perf_event__preprocess_sample(&event, machine, &al, |
86 | &sample) < 0) | 87 | &sample) < 0) |
@@ -104,6 +105,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
104 | }; | 105 | }; |
105 | 106 | ||
106 | sample.pid = fake_samples[i][k].pid; | 107 | sample.pid = fake_samples[i][k].pid; |
108 | sample.tid = fake_samples[i][k].pid; | ||
107 | sample.ip = fake_samples[i][k].ip; | 109 | sample.ip = fake_samples[i][k].ip; |
108 | if (perf_event__preprocess_sample(&event, machine, &al, | 110 | if (perf_event__preprocess_sample(&event, machine, &al, |
109 | &sample) < 0) | 111 | &sample) < 0) |
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 6baabe63182b..a904a4cfe7d3 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c | |||
@@ -25,7 +25,7 @@ int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, | |||
25 | struct addr_location al; | 25 | struct addr_location al; |
26 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 26 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
27 | struct thread *thread = machine__findnew_thread(machine, sample->pid, | 27 | struct thread *thread = machine__findnew_thread(machine, sample->pid, |
28 | sample->pid); | 28 | sample->tid); |
29 | 29 | ||
30 | if (thread == NULL) { | 30 | if (thread == NULL) { |
31 | pr_err("problem processing %d event, skipping it.\n", | 31 | pr_err("problem processing %d event, skipping it.\n", |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index dbcaea1a8180..65795b835b39 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -788,7 +788,7 @@ int perf_event__preprocess_sample(const union perf_event *event, | |||
788 | { | 788 | { |
789 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 789 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
790 | struct thread *thread = machine__findnew_thread(machine, sample->pid, | 790 | struct thread *thread = machine__findnew_thread(machine, sample->pid, |
791 | sample->pid); | 791 | sample->tid); |
792 | 792 | ||
793 | if (thread == NULL) | 793 | if (thread == NULL) |
794 | return -1; | 794 | return -1; |