diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-06-16 16:08:55 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-06-16 16:08:55 -0400 |
commit | 96a527cecb26cbb1e18deb0ef83efe32f356d467 (patch) | |
tree | 84a1ea103774e0507034f79309ddd25f4f1a848e | |
parent | ebad8f1926624b162940d5bf527a3f8ea0de89a1 (diff) |
trace-graph: Account for events not found in plot
In the plot code, it is possible that an event exists in the
data file that was not stored in the events log. This happened
with the 2.6.35 kernel where some events had formats that were "TOO BIG"
and that event format was not saved. But the events still existed in
the trace.dat file.
The plot code assumed that events were found and when they were not
it crashed.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-plot-cpu.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c index 50d720b..1c86df8 100644 --- a/trace-plot-cpu.c +++ b/trace-plot-cpu.c | |||
@@ -141,6 +141,7 @@ static int cpu_plot_display_last_event(struct graph_info *ginfo, | |||
141 | 141 | ||
142 | tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); | 142 | tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); |
143 | 143 | ||
144 | again: | ||
144 | /* find the non filtered event */ | 145 | /* find the non filtered event */ |
145 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { | 146 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { |
146 | if (!filter_record(ginfo, record, &pid, &sched_pid, &is_sched_switch) && | 147 | if (!filter_record(ginfo, record, &pid, &sched_pid, &is_sched_switch) && |
@@ -159,6 +160,10 @@ static int cpu_plot_display_last_event(struct graph_info *ginfo, | |||
159 | /* Must have the record we want */ | 160 | /* Must have the record we want */ |
160 | type = pevent_data_type(ginfo->pevent, record); | 161 | type = pevent_data_type(ginfo->pevent, record); |
161 | event = pevent_data_event_from_type(ginfo->pevent, type); | 162 | event = pevent_data_event_from_type(ginfo->pevent, type); |
163 | /* Unlikely that the event was not saved */ | ||
164 | if (!event) | ||
165 | goto again; | ||
166 | |||
162 | if (is_sched_switch) | 167 | if (is_sched_switch) |
163 | pid = sched_pid; | 168 | pid = sched_pid; |
164 | trace_seq_printf(s, "%s-%d\n%s\n", | 169 | trace_seq_printf(s, "%s-%d\n%s\n", |