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.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 80209df6cfe8..4f5a03e43444 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1621,11 +1621,8 @@ static int process_sample_event(event_t *event, struct perf_session *session)
1621 1621
1622 event__parse_sample(event, session->sample_type, &data); 1622 event__parse_sample(event, session->sample_type, &data);
1623 1623
1624 dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", 1624 dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc,
1625 event->header.misc, 1625 data.pid, data.tid, data.ip, data.period);
1626 data.pid, data.tid,
1627 (void *)(long)data.ip,
1628 (long long)data.period);
1629 1626
1630 thread = perf_session__findnew(session, data.pid); 1627 thread = perf_session__findnew(session, data.pid);
1631 if (thread == NULL) { 1628 if (thread == NULL) {
@@ -1653,33 +1650,22 @@ static int process_lost_event(event_t *event __used,
1653 return 0; 1650 return 0;
1654} 1651}
1655 1652
1656static int sample_type_check(struct perf_session *session __used)
1657{
1658 if (!(session->sample_type & PERF_SAMPLE_RAW)) {
1659 fprintf(stderr,
1660 "No trace sample to read. Did you call perf record "
1661 "without -R?");
1662 return -1;
1663 }
1664
1665 return 0;
1666}
1667
1668static struct perf_event_ops event_ops = { 1653static struct perf_event_ops event_ops = {
1669 .process_sample_event = process_sample_event, 1654 .sample = process_sample_event,
1670 .process_comm_event = event__process_comm, 1655 .comm = event__process_comm,
1671 .process_lost_event = process_lost_event, 1656 .lost = process_lost_event,
1672 .sample_type_check = sample_type_check,
1673}; 1657};
1674 1658
1675static int read_events(void) 1659static int read_events(void)
1676{ 1660{
1677 int err; 1661 int err = -EINVAL;
1678 struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0); 1662 struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0);
1679 if (session == NULL) 1663 if (session == NULL)
1680 return -ENOMEM; 1664 return -ENOMEM;
1681 1665
1682 err = perf_session__process_events(session, &event_ops); 1666 if (perf_session__has_traces(session, "record -R"))
1667 err = perf_session__process_events(session, &event_ops);
1668
1683 perf_session__delete(session); 1669 perf_session__delete(session);
1684 return err; 1670 return err;
1685} 1671}