diff options
Diffstat (limited to 'tools/perf/builtin-timechart.c')
-rw-r--r-- | tools/perf/builtin-timechart.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index a589a43112d6..0d4d8ff7914b 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -280,7 +280,7 @@ static u64 cpus_pstate_state[MAX_CPUS]; | |||
280 | 280 | ||
281 | static int process_comm_event(event_t *event, struct perf_session *session __used) | 281 | static int process_comm_event(event_t *event, struct perf_session *session __used) |
282 | { | 282 | { |
283 | pid_set_comm(event->comm.pid, event->comm.comm); | 283 | pid_set_comm(event->comm.tid, event->comm.comm); |
284 | return 0; | 284 | return 0; |
285 | } | 285 | } |
286 | 286 | ||
@@ -1029,33 +1029,24 @@ static void process_samples(struct perf_session *session) | |||
1029 | } | 1029 | } |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | static int sample_type_check(struct perf_session *session) | ||
1033 | { | ||
1034 | if (!(session->sample_type & PERF_SAMPLE_RAW)) { | ||
1035 | fprintf(stderr, "No trace samples found in the file.\n" | ||
1036 | "Have you used 'perf timechart record' to record it?\n"); | ||
1037 | return -1; | ||
1038 | } | ||
1039 | |||
1040 | return 0; | ||
1041 | } | ||
1042 | |||
1043 | static struct perf_event_ops event_ops = { | 1032 | static struct perf_event_ops event_ops = { |
1044 | .process_comm_event = process_comm_event, | 1033 | .comm = process_comm_event, |
1045 | .process_fork_event = process_fork_event, | 1034 | .fork = process_fork_event, |
1046 | .process_exit_event = process_exit_event, | 1035 | .exit = process_exit_event, |
1047 | .process_sample_event = queue_sample_event, | 1036 | .sample = queue_sample_event, |
1048 | .sample_type_check = sample_type_check, | ||
1049 | }; | 1037 | }; |
1050 | 1038 | ||
1051 | static int __cmd_timechart(void) | 1039 | static int __cmd_timechart(void) |
1052 | { | 1040 | { |
1053 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0); | 1041 | struct perf_session *session = perf_session__new(input_name, O_RDONLY, 0); |
1054 | int ret; | 1042 | int ret = -EINVAL; |
1055 | 1043 | ||
1056 | if (session == NULL) | 1044 | if (session == NULL) |
1057 | return -ENOMEM; | 1045 | return -ENOMEM; |
1058 | 1046 | ||
1047 | if (!perf_session__has_traces(session, "timechart record")) | ||
1048 | goto out_delete; | ||
1049 | |||
1059 | ret = perf_session__process_events(session, &event_ops); | 1050 | ret = perf_session__process_events(session, &event_ops); |
1060 | if (ret) | 1051 | if (ret) |
1061 | goto out_delete; | 1052 | goto out_delete; |