aboutsummaryrefslogtreecommitdiffstats
path: root/trace-graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-graph.c')
-rw-r--r--trace-graph.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/trace-graph.c b/trace-graph.c
index 04e2439..4e91fe8 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -326,6 +326,7 @@ static void update_label_time(GtkWidget *label, gint64 time)
326 trace_seq_printf(&s, "%s%lu.%06lu", min, sec, usec); 326 trace_seq_printf(&s, "%s%lu.%06lu", min, sec, usec);
327 327
328 gtk_label_set_text(GTK_LABEL(label), s.buffer); 328 gtk_label_set_text(GTK_LABEL(label), s.buffer);
329 trace_seq_destroy(&s);
329} 330}
330 331
331static void update_cursor(struct graph_info *ginfo) 332static void update_cursor(struct graph_info *ginfo)
@@ -1111,8 +1112,10 @@ int trace_graph_check_sched_switch(struct graph_info *ginfo,
1111 1112
1112 if (id == ginfo->ftrace_sched_switch_id) { 1113 if (id == ginfo->ftrace_sched_switch_id) {
1113 pevent_read_number_field(ginfo->ftrace_pid_field, record->data, &val); 1114 pevent_read_number_field(ginfo->ftrace_pid_field, record->data, &val);
1114 if (comm) 1115 if (comm && ginfo->ftrace_comm_field)
1115 *comm = record->data + ginfo->ftrace_comm_field->offset; 1116 *comm = record->data + ginfo->ftrace_comm_field->offset;
1117 else
1118 comm = NULL;
1116 if (pid) 1119 if (pid)
1117 *pid = val; 1120 *pid = val;
1118 goto out; 1121 goto out;
@@ -1223,6 +1226,7 @@ static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot,
1223 1226
1224 if (!trace_graph_plot_display_info(ginfo, plot, &s, time)) { 1227 if (!trace_graph_plot_display_info(ginfo, plot, &s, time)) {
1225 /* Just display the current time */ 1228 /* Just display the current time */
1229 trace_seq_destroy(&s);
1226 trace_seq_init(&s); 1230 trace_seq_init(&s);
1227 trace_seq_printf(&s, "%lu.%06lu", sec, usec); 1231 trace_seq_printf(&s, "%lu.%06lu", sec, usec);
1228 } 1232 }
@@ -1230,6 +1234,7 @@ static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot,
1230 trace_seq_putc(&s, 0); 1234 trace_seq_putc(&s, 0);
1231 1235
1232 draw_info_box(ginfo, s.buffer, x, y); 1236 draw_info_box(ginfo, s.buffer, x, y);
1237 trace_seq_destroy(&s);
1233} 1238}
1234 1239
1235static void draw_latency(struct graph_info *ginfo, gint x, gint y) 1240static void draw_latency(struct graph_info *ginfo, gint x, gint y)
@@ -1259,6 +1264,7 @@ static void draw_latency(struct graph_info *ginfo, gint x, gint y)
1259 trace_seq_printf(&s, "Diff: %s%ld.%06lu secs", neg ? "-":"", sec, usec); 1264 trace_seq_printf(&s, "Diff: %s%ld.%06lu secs", neg ? "-":"", sec, usec);
1260 1265
1261 draw_info_box(ginfo, s.buffer, x, y); 1266 draw_info_box(ginfo, s.buffer, x, y);
1267 trace_seq_destroy(&s);
1262} 1268}
1263 1269
1264static gboolean 1270static gboolean
@@ -1660,13 +1666,17 @@ static gint draw_event_label(struct graph_info *ginfo, gint i,
1660 */ 1666 */
1661 ret = trace_graph_plot_display_last_event(ginfo, plot, &s, 1667 ret = trace_graph_plot_display_last_event(ginfo, plot, &s,
1662 convert_x_to_time(ginfo, p2-1)); 1668 convert_x_to_time(ginfo, p2-1));
1663 if (!ret) 1669 if (!ret) {
1670 trace_seq_destroy(&s);
1664 return p2; 1671 return p2;
1672 }
1665 1673
1666 layout = gtk_widget_create_pango_layout(ginfo->draw, s.buffer); 1674 layout = gtk_widget_create_pango_layout(ginfo->draw, s.buffer);
1667 pango_layout_set_font_description(layout, font); 1675 pango_layout_set_font_description(layout, font);
1668 pango_layout_get_pixel_size(layout, &text_width, &text_height); 1676 pango_layout_get_pixel_size(layout, &text_width, &text_height);
1669 1677
1678 trace_seq_destroy(&s);
1679
1670 /* Lets see if we can print this info */ 1680 /* Lets see if we can print this info */
1671 if (p2 < text_width) 1681 if (p2 < text_width)
1672 start = 1; 1682 start = 1;
@@ -1933,6 +1943,7 @@ static void draw_timeline(struct graph_info *ginfo, gint width)
1933 gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc, 1943 gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc,
1934 1, height+10, layout); 1944 1, height+10, layout);
1935 g_object_unref(layout); 1945 g_object_unref(layout);
1946 trace_seq_destroy(&s);
1936 1947
1937 1948
1938 /* --- draw ending time --- */ 1949 /* --- draw ending time --- */
@@ -1946,6 +1957,7 @@ static void draw_timeline(struct graph_info *ginfo, gint width)
1946 gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc, 1957 gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc,
1947 width - (w + 2), height+10, layout); 1958 width - (w + 2), height+10, layout);
1948 g_object_unref(layout); 1959 g_object_unref(layout);
1960 trace_seq_destroy(&s);
1949 1961
1950 1962
1951 /* --- draw time at intervals --- */ 1963 /* --- draw time at intervals --- */
@@ -1968,6 +1980,7 @@ static void draw_timeline(struct graph_info *ginfo, gint width)
1968 gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc, 1980 gdk_draw_layout(ginfo->curr_pixmap, ginfo->draw->style->black_gc,
1969 mid - (w / 2), height+10, layout); 1981 mid - (w / 2), height+10, layout);
1970 g_object_unref(layout); 1982 g_object_unref(layout);
1983 trace_seq_destroy(&s);
1971 } 1984 }
1972} 1985}
1973 1986
@@ -2411,6 +2424,8 @@ static int load_handle(struct graph_info *ginfo,
2411 2424
2412 free_record(record); 2425 free_record(record);
2413 record = tracecmd_read_cpu_last(handle, cpu); 2426 record = tracecmd_read_cpu_last(handle, cpu);
2427 if (!record)
2428 continue;
2414 2429
2415 if (record->ts > ginfo->end_time) 2430 if (record->ts > ginfo->end_time)
2416 ginfo->end_time = record->ts; 2431 ginfo->end_time = record->ts;