aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r--tools/perf/builtin-sched.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 26b782f26ee1..45c46c790493 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1598,40 +1598,26 @@ process_raw_event(event_t *raw_event __used, void *more_data,
1598 1598
1599static int process_sample_event(event_t *event) 1599static int process_sample_event(event_t *event)
1600{ 1600{
1601 struct sample_data data;
1601 struct thread *thread; 1602 struct thread *thread;
1602 u64 ip = event->ip.ip;
1603 u64 timestamp = -1;
1604 u32 cpu = -1;
1605 u64 period = 1;
1606 void *more_data = event->ip.__more_data;
1607 1603
1608 if (!(sample_type & PERF_SAMPLE_RAW)) 1604 if (!(sample_type & PERF_SAMPLE_RAW))
1609 return 0; 1605 return 0;
1610 1606
1611 thread = threads__findnew(event->ip.pid); 1607 memset(&data, 0, sizeof(data));
1608 data.time = -1;
1609 data.cpu = -1;
1610 data.period = -1;
1612 1611
1613 if (sample_type & PERF_SAMPLE_TIME) { 1612 event__parse_sample(event, sample_type, &data);
1614 timestamp = *(u64 *)more_data;
1615 more_data += sizeof(u64);
1616 }
1617
1618 if (sample_type & PERF_SAMPLE_CPU) {
1619 cpu = *(u32 *)more_data;
1620 more_data += sizeof(u32);
1621 more_data += sizeof(u32); /* reserved */
1622 }
1623
1624 if (sample_type & PERF_SAMPLE_PERIOD) {
1625 period = *(u64 *)more_data;
1626 more_data += sizeof(u64);
1627 }
1628 1613
1629 dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", 1614 dump_printf("(IP, %d): %d/%d: %p period: %Ld\n",
1630 event->header.misc, 1615 event->header.misc,
1631 event->ip.pid, event->ip.tid, 1616 data.pid, data.tid,
1632 (void *)(long)ip, 1617 (void *)(long)data.ip,
1633 (long long)period); 1618 (long long)data.period);
1634 1619
1620 thread = threads__findnew(data.pid);
1635 if (thread == NULL) { 1621 if (thread == NULL) {
1636 pr_debug("problem processing %d event, skipping it.\n", 1622 pr_debug("problem processing %d event, skipping it.\n",
1637 event->header.type); 1623 event->header.type);
@@ -1640,10 +1626,10 @@ static int process_sample_event(event_t *event)
1640 1626
1641 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); 1627 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
1642 1628
1643 if (profile_cpu != -1 && profile_cpu != (int) cpu) 1629 if (profile_cpu != -1 && profile_cpu != (int)data.cpu)
1644 return 0; 1630 return 0;
1645 1631
1646 process_raw_event(event, more_data, cpu, timestamp, thread); 1632 process_raw_event(event, data.raw_data, data.cpu, data.time, thread);
1647 1633
1648 return 0; 1634 return 0;
1649} 1635}