diff options
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 19eb708a706b..26b782f26ee1 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -22,8 +22,6 @@ | |||
22 | 22 | ||
23 | static char const *input_name = "perf.data"; | 23 | static char const *input_name = "perf.data"; |
24 | 24 | ||
25 | static unsigned long total_comm = 0; | ||
26 | |||
27 | static struct perf_header *header; | 25 | static struct perf_header *header; |
28 | static u64 sample_type; | 26 | static u64 sample_type; |
29 | 27 | ||
@@ -32,9 +30,6 @@ static char *sort_order = default_sort_order; | |||
32 | 30 | ||
33 | static int profile_cpu = -1; | 31 | static int profile_cpu = -1; |
34 | 32 | ||
35 | static char *cwd; | ||
36 | static int cwdlen; | ||
37 | |||
38 | #define PR_SET_NAME 15 /* Set process name */ | 33 | #define PR_SET_NAME 15 /* Set process name */ |
39 | #define MAX_CPUS 4096 | 34 | #define MAX_CPUS 4096 |
40 | 35 | ||
@@ -633,27 +628,6 @@ static void test_calibrations(void) | |||
633 | printf("the sleep test took %Ld nsecs\n", T1-T0); | 628 | printf("the sleep test took %Ld nsecs\n", T1-T0); |
634 | } | 629 | } |
635 | 630 | ||
636 | static int | ||
637 | process_comm_event(event_t *event, unsigned long offset, unsigned long head) | ||
638 | { | ||
639 | struct thread *thread = threads__findnew(event->comm.tid); | ||
640 | |||
641 | dump_printf("%p [%p]: perf_event_comm: %s:%d\n", | ||
642 | (void *)(offset + head), | ||
643 | (void *)(long)(event->header.size), | ||
644 | event->comm.comm, event->comm.pid); | ||
645 | |||
646 | if (thread == NULL || | ||
647 | thread__set_comm(thread, event->comm.comm)) { | ||
648 | dump_printf("problem processing perf_event_comm, skipping event.\n"); | ||
649 | return -1; | ||
650 | } | ||
651 | total_comm++; | ||
652 | |||
653 | return 0; | ||
654 | } | ||
655 | |||
656 | |||
657 | struct raw_event_sample { | 631 | struct raw_event_sample { |
658 | u32 size; | 632 | u32 size; |
659 | char data[0]; | 633 | char data[0]; |
@@ -1622,8 +1596,7 @@ process_raw_event(event_t *raw_event __used, void *more_data, | |||
1622 | process_sched_migrate_task_event(raw, event, cpu, timestamp, thread); | 1596 | process_sched_migrate_task_event(raw, event, cpu, timestamp, thread); |
1623 | } | 1597 | } |
1624 | 1598 | ||
1625 | static int | 1599 | static int process_sample_event(event_t *event) |
1626 | process_sample_event(event_t *event, unsigned long offset, unsigned long head) | ||
1627 | { | 1600 | { |
1628 | struct thread *thread; | 1601 | struct thread *thread; |
1629 | u64 ip = event->ip.ip; | 1602 | u64 ip = event->ip.ip; |
@@ -1653,9 +1626,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1653 | more_data += sizeof(u64); | 1626 | more_data += sizeof(u64); |
1654 | } | 1627 | } |
1655 | 1628 | ||
1656 | dump_printf("%p [%p]: PERF_RECORD_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", | 1629 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", |
1657 | (void *)(offset + head), | ||
1658 | (void *)(long)(event->header.size), | ||
1659 | event->header.misc, | 1630 | event->header.misc, |
1660 | event->ip.pid, event->ip.tid, | 1631 | event->ip.pid, event->ip.tid, |
1661 | (void *)(long)ip, | 1632 | (void *)(long)ip, |
@@ -1677,10 +1648,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1677 | return 0; | 1648 | return 0; |
1678 | } | 1649 | } |
1679 | 1650 | ||
1680 | static int | 1651 | static int process_lost_event(event_t *event __used) |
1681 | process_lost_event(event_t *event __used, | ||
1682 | unsigned long offset __used, | ||
1683 | unsigned long head __used) | ||
1684 | { | 1652 | { |
1685 | nr_lost_chunks++; | 1653 | nr_lost_chunks++; |
1686 | nr_lost_events += event->lost.lost; | 1654 | nr_lost_events += event->lost.lost; |
@@ -1704,7 +1672,7 @@ static int sample_type_check(u64 type) | |||
1704 | 1672 | ||
1705 | static struct perf_file_handler file_handler = { | 1673 | static struct perf_file_handler file_handler = { |
1706 | .process_sample_event = process_sample_event, | 1674 | .process_sample_event = process_sample_event, |
1707 | .process_comm_event = process_comm_event, | 1675 | .process_comm_event = event__process_comm, |
1708 | .process_lost_event = process_lost_event, | 1676 | .process_lost_event = process_lost_event, |
1709 | .sample_type_check = sample_type_check, | 1677 | .sample_type_check = sample_type_check, |
1710 | }; | 1678 | }; |
@@ -1715,7 +1683,7 @@ static int read_events(void) | |||
1715 | register_perf_file_handler(&file_handler); | 1683 | register_perf_file_handler(&file_handler); |
1716 | 1684 | ||
1717 | return mmap_dispatch_perf_file(&header, input_name, 0, 0, | 1685 | return mmap_dispatch_perf_file(&header, input_name, 0, 0, |
1718 | &cwdlen, &cwd); | 1686 | &event__cwdlen, &event__cwd); |
1719 | } | 1687 | } |
1720 | 1688 | ||
1721 | static void print_bad_events(void) | 1689 | static void print_bad_events(void) |