From 96a527cecb26cbb1e18deb0ef83efe32f356d467 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 16 Jun 2010 16:08:55 -0400 Subject: 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 --- trace-plot-cpu.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'trace-plot-cpu.c') 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, tracecmd_set_cpu_to_timestamp(ginfo->handle, cpu, time); +again: /* find the non filtered event */ while ((record = tracecmd_read_data(ginfo->handle, cpu))) { 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, /* Must have the record we want */ type = pevent_data_type(ginfo->pevent, record); event = pevent_data_event_from_type(ginfo->pevent, type); + /* Unlikely that the event was not saved */ + if (!event) + goto again; + if (is_sched_switch) pid = sched_pid; trace_seq_printf(s, "%s-%d\n%s\n", -- cgit v1.2.2