diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-02-19 23:25:12 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-19 23:29:35 -0500 |
commit | a1ad5b466f5379872701397fb057d189f88ca9f3 (patch) | |
tree | 310e2b959fba297dc4bed1366dcaea7b2727b717 | |
parent | 805794bb3e0fda067a57de592083770110a9d43c (diff) |
trace-graph: Add status bar and marker line info
Using shift and drag, a marker is made, where Marker A is green
and Marker B is red. The time stamps of the markers as well as
the delta between them is shown in a new status bar above the
graph.
Requested-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-graph.c | 278 | ||||
-rw-r--r-- | trace-graph.h | 10 |
2 files changed, 240 insertions, 48 deletions
diff --git a/trace-graph.c b/trace-graph.c index bf67da9..389512e 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -63,6 +63,9 @@ | |||
63 | 63 | ||
64 | static gint largest_plot_label; | 64 | static gint largest_plot_label; |
65 | 65 | ||
66 | static GdkGC *green; | ||
67 | static GdkGC *red; | ||
68 | |||
66 | static void redraw_pixmap_backend(struct graph_info *ginfo); | 69 | static void redraw_pixmap_backend(struct graph_info *ginfo); |
67 | static void update_label_window(struct graph_info *ginfo); | 70 | static void update_label_window(struct graph_info *ginfo); |
68 | 71 | ||
@@ -306,10 +309,69 @@ static void __update_with_backend(struct graph_info *ginfo, | |||
306 | width, height); | 309 | width, height); |
307 | } | 310 | } |
308 | 311 | ||
312 | static void update_label_time(GtkWidget *label, gint64 time) | ||
313 | { | ||
314 | unsigned long sec, usec; | ||
315 | struct trace_seq s; | ||
316 | char *min = ""; | ||
317 | |||
318 | if (time < 0) { | ||
319 | time *= -1; | ||
320 | min = "-"; | ||
321 | } | ||
322 | |||
323 | convert_nano(time, &sec, &usec); | ||
324 | |||
325 | trace_seq_init(&s); | ||
326 | trace_seq_printf(&s, "%s%lu.%06lu", min, sec, usec); | ||
327 | |||
328 | gtk_label_set_text(GTK_LABEL(label), s.buffer); | ||
329 | } | ||
330 | |||
331 | static void update_cursor(struct graph_info *ginfo) | ||
332 | { | ||
333 | update_label_time(ginfo->cursor_label, ginfo->cursor); | ||
334 | } | ||
335 | |||
336 | static void update_pointer(struct graph_info *ginfo, gint x) | ||
337 | { | ||
338 | guint64 time; | ||
339 | |||
340 | time = convert_x_to_time(ginfo, x); | ||
341 | update_label_time(ginfo->pointer_time, time); | ||
342 | } | ||
343 | |||
344 | static void update_marka(struct graph_info *ginfo, gint x) | ||
345 | { | ||
346 | guint64 timeA; | ||
347 | |||
348 | timeA = convert_x_to_time(ginfo, x); | ||
349 | ginfo->marka_time = timeA; | ||
350 | |||
351 | update_label_time(ginfo->marka_label, timeA); | ||
352 | } | ||
353 | |||
354 | static void update_markb(struct graph_info *ginfo, guint x) | ||
355 | { | ||
356 | gint64 timeA, timeB; | ||
357 | |||
358 | timeA = ginfo->marka_time; | ||
359 | timeB = convert_x_to_time(ginfo, x); | ||
360 | ginfo->markb_time = timeB; | ||
361 | |||
362 | update_label_time(ginfo->markb_label, timeB); | ||
363 | update_label_time(ginfo->delta_label, timeB - timeA); | ||
364 | } | ||
365 | |||
309 | static void draw_cursor(struct graph_info *ginfo) | 366 | static void draw_cursor(struct graph_info *ginfo) |
310 | { | 367 | { |
311 | gint x; | 368 | gint x; |
312 | 369 | ||
370 | if (!ginfo->cursor) | ||
371 | return; | ||
372 | |||
373 | update_cursor(ginfo); | ||
374 | |||
313 | if (ginfo->cursor < ginfo->view_start_time || | 375 | if (ginfo->cursor < ginfo->view_start_time || |
314 | ginfo->cursor > ginfo->view_end_time) | 376 | ginfo->cursor > ginfo->view_end_time) |
315 | return; | 377 | return; |
@@ -320,14 +382,39 @@ static void draw_cursor(struct graph_info *ginfo) | |||
320 | x, 0, x, ginfo->draw->allocation.width); | 382 | x, 0, x, ginfo->draw->allocation.width); |
321 | } | 383 | } |
322 | 384 | ||
385 | static void draw_marka(struct graph_info *ginfo) | ||
386 | { | ||
387 | gint x; | ||
388 | |||
389 | if (!ginfo->show_marka) | ||
390 | return; | ||
391 | |||
392 | x = convert_time_to_x(ginfo, ginfo->marka_time); | ||
393 | gdk_draw_line(ginfo->draw->window, green, | ||
394 | x, 0, x, ginfo->draw->allocation.width); | ||
395 | } | ||
396 | |||
397 | static void draw_markb(struct graph_info *ginfo) | ||
398 | { | ||
399 | gint x; | ||
400 | |||
401 | if (!ginfo->show_markb) | ||
402 | return; | ||
403 | |||
404 | x = convert_time_to_x(ginfo, ginfo->markb_time); | ||
405 | gdk_draw_line(ginfo->draw->window, red, | ||
406 | x, 0, x, ginfo->draw->allocation.width); | ||
407 | } | ||
408 | |||
323 | static void update_with_backend(struct graph_info *ginfo, | 409 | static void update_with_backend(struct graph_info *ginfo, |
324 | gint x, gint y, | 410 | gint x, gint y, |
325 | gint width, gint height) | 411 | gint width, gint height) |
326 | { | 412 | { |
327 | __update_with_backend(ginfo, x, y, width, height); | 413 | __update_with_backend(ginfo, x, y, width, height); |
328 | 414 | ||
329 | if (ginfo->cursor) | 415 | draw_cursor(ginfo); |
330 | draw_cursor(ginfo); | 416 | draw_markb(ginfo); |
417 | draw_marka(ginfo); | ||
331 | } | 418 | } |
332 | 419 | ||
333 | static gboolean | 420 | static gboolean |
@@ -349,15 +436,12 @@ draw_line(GtkWidget *widget, gdouble x, struct graph_info *ginfo) | |||
349 | x, 0, x, widget->allocation.width); | 436 | x, 0, x, widget->allocation.width); |
350 | } | 437 | } |
351 | 438 | ||
352 | static void clear_last_line(GtkWidget *widget, struct graph_info *ginfo) | 439 | static void clear_line(struct graph_info *ginfo, gint x) |
353 | { | 440 | { |
354 | gint x; | ||
355 | |||
356 | x = ginfo->last_x; | ||
357 | if (x) | 441 | if (x) |
358 | x--; | 442 | x--; |
359 | 443 | ||
360 | update_with_backend(ginfo, x, 0, x+2, widget->allocation.height); | 444 | update_with_backend(ginfo, x, 0, x+2, ginfo->draw->allocation.height); |
361 | } | 445 | } |
362 | 446 | ||
363 | static void clear_info_box(struct graph_info *ginfo) | 447 | static void clear_info_box(struct graph_info *ginfo) |
@@ -682,6 +766,28 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
682 | return TRUE; | 766 | return TRUE; |
683 | } | 767 | } |
684 | 768 | ||
769 | static void button_press(struct graph_info *ginfo, gint x, guint state) | ||
770 | { | ||
771 | ginfo->press_x = x; | ||
772 | ginfo->last_x = 0; | ||
773 | |||
774 | draw_line(ginfo->draw, x, ginfo); | ||
775 | |||
776 | ginfo->line_active = TRUE; | ||
777 | ginfo->line_time = convert_x_to_time(ginfo, x); | ||
778 | |||
779 | if (state & GDK_SHIFT_MASK) { | ||
780 | ginfo->show_marka = FALSE; | ||
781 | ginfo->show_markb = FALSE; | ||
782 | clear_line(ginfo, convert_time_to_x(ginfo, ginfo->marka_time)); | ||
783 | clear_line(ginfo, convert_time_to_x(ginfo, ginfo->markb_time)); | ||
784 | update_marka(ginfo, x); | ||
785 | } else | ||
786 | ginfo->zoom = TRUE; | ||
787 | |||
788 | return; | ||
789 | } | ||
790 | |||
685 | static gboolean | 791 | static gboolean |
686 | button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | 792 | button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
687 | { | 793 | { |
@@ -700,15 +806,14 @@ button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
700 | if (event->type == GDK_2BUTTON_PRESS) { | 806 | if (event->type == GDK_2BUTTON_PRESS) { |
701 | if (ginfo->line_active) { | 807 | if (ginfo->line_active) { |
702 | ginfo->line_active = FALSE; | 808 | ginfo->line_active = FALSE; |
703 | clear_last_line(widget, ginfo); | 809 | clear_line(ginfo, ginfo->last_x); |
704 | ginfo->last_x = ginfo->press_x; | 810 | clear_line(ginfo, ginfo->press_x); |
705 | clear_last_line(widget, ginfo); | ||
706 | } | 811 | } |
707 | if (ginfo->cursor >= ginfo->view_start_time && | 812 | if (ginfo->cursor >= ginfo->view_start_time && |
708 | ginfo->cursor <= ginfo->view_end_time) { | 813 | ginfo->cursor <= ginfo->view_end_time) { |
709 | ginfo->last_x = convert_time_to_x(ginfo, ginfo->cursor); | 814 | ginfo->last_x = convert_time_to_x(ginfo, ginfo->cursor); |
710 | ginfo->cursor = 0; | 815 | ginfo->cursor = 0; |
711 | clear_last_line(widget, ginfo); | 816 | clear_line(ginfo, ginfo->last_x); |
712 | } | 817 | } |
713 | 818 | ||
714 | ginfo->cursor = convert_x_to_time(ginfo, event->x); | 819 | ginfo->cursor = convert_x_to_time(ginfo, event->x); |
@@ -718,16 +823,7 @@ button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
718 | return TRUE; | 823 | return TRUE; |
719 | } | 824 | } |
720 | 825 | ||
721 | ginfo->press_x = event->x; | 826 | button_press(ginfo, event->x, event->state); |
722 | ginfo->last_x = 0; | ||
723 | |||
724 | draw_line(widget, event->x, ginfo); | ||
725 | |||
726 | ginfo->line_active = TRUE; | ||
727 | ginfo->line_time = convert_x_to_time(ginfo, event->x); | ||
728 | |||
729 | if (!(event->state & GDK_SHIFT_MASK)) | ||
730 | ginfo->zoom = TRUE; | ||
731 | 827 | ||
732 | return TRUE; | 828 | return TRUE; |
733 | } | 829 | } |
@@ -743,9 +839,12 @@ static void motion_plot(struct graph_info *ginfo, gint x, gint y) | |||
743 | if (!ginfo->curr_pixmap) | 839 | if (!ginfo->curr_pixmap) |
744 | return; | 840 | return; |
745 | 841 | ||
842 | if (ginfo->pointer_time) | ||
843 | update_pointer(ginfo, x); | ||
844 | |||
746 | if (ginfo->line_active) { | 845 | if (ginfo->line_active) { |
747 | if (ginfo->last_x) | 846 | if (ginfo->last_x) |
748 | clear_last_line(ginfo->draw, ginfo); | 847 | clear_line(ginfo, ginfo->last_x); |
749 | ginfo->last_x = x; | 848 | ginfo->last_x = x; |
750 | draw_line(ginfo->draw, ginfo->press_x, ginfo); | 849 | draw_line(ginfo->draw, ginfo->press_x, ginfo); |
751 | draw_line(ginfo->draw, x, ginfo); | 850 | draw_line(ginfo->draw, x, ginfo); |
@@ -774,16 +873,7 @@ info_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
774 | if (event->type == GDK_2BUTTON_PRESS) | 873 | if (event->type == GDK_2BUTTON_PRESS) |
775 | return FALSE; | 874 | return FALSE; |
776 | 875 | ||
777 | ginfo->press_x = 0; | 876 | button_press(ginfo, gtk_adjustment_get_value(ginfo->hadj), event->state); |
778 | ginfo->last_x = 0; | ||
779 | |||
780 | draw_line(ginfo->draw, 0, ginfo); | ||
781 | |||
782 | ginfo->line_active = TRUE; | ||
783 | ginfo->line_time = convert_x_to_time(ginfo, gtk_adjustment_get_value(ginfo->hadj));; | ||
784 | |||
785 | if (!(event->state & GDK_SHIFT_MASK)) | ||
786 | ginfo->zoom = TRUE; | ||
787 | 877 | ||
788 | return FALSE; | 878 | return FALSE; |
789 | } | 879 | } |
@@ -1085,6 +1175,8 @@ static void draw_latency(struct graph_info *ginfo, gint x, gint y) | |||
1085 | gboolean neg; | 1175 | gboolean neg; |
1086 | gint64 time; | 1176 | gint64 time; |
1087 | 1177 | ||
1178 | update_markb(ginfo, x); | ||
1179 | |||
1088 | time = convert_x_to_time(ginfo, x); | 1180 | time = convert_x_to_time(ginfo, x); |
1089 | time -= ginfo->line_time; | 1181 | time -= ginfo->line_time; |
1090 | 1182 | ||
@@ -1400,9 +1492,14 @@ static void button_release(struct graph_info *ginfo, gint x) | |||
1400 | if (!ginfo->line_active) | 1492 | if (!ginfo->line_active) |
1401 | return; | 1493 | return; |
1402 | 1494 | ||
1403 | clear_last_line(ginfo->draw, ginfo); | 1495 | if (!ginfo->zoom) { |
1404 | ginfo->last_x = ginfo->press_x; | 1496 | ginfo->show_marka = TRUE; |
1405 | clear_last_line(ginfo->draw, ginfo); | 1497 | ginfo->show_markb = TRUE; |
1498 | update_markb(ginfo, x); | ||
1499 | } | ||
1500 | |||
1501 | clear_line(ginfo, ginfo->last_x); | ||
1502 | clear_line(ginfo, ginfo->press_x); | ||
1406 | ginfo->line_active = FALSE; | 1503 | ginfo->line_active = FALSE; |
1407 | 1504 | ||
1408 | clear_info_box(ginfo); | 1505 | clear_info_box(ginfo); |
@@ -1865,7 +1962,7 @@ void trace_graph_select_by_time(struct graph_info *ginfo, guint64 time) | |||
1865 | 1962 | ||
1866 | ginfo->last_x = convert_time_to_x(ginfo, ginfo->cursor); | 1963 | ginfo->last_x = convert_time_to_x(ginfo, ginfo->cursor); |
1867 | ginfo->cursor = 0; | 1964 | ginfo->cursor = 0; |
1868 | clear_last_line(ginfo->draw, ginfo); | 1965 | clear_line(ginfo, ginfo->last_x); |
1869 | ginfo->cursor = time; | 1966 | ginfo->cursor = time; |
1870 | 1967 | ||
1871 | update_with_backend(ginfo, 0, 0, width, ginfo->draw_height); | 1968 | update_with_backend(ginfo, 0, 0, width, ginfo->draw_height); |
@@ -1992,6 +2089,7 @@ void trace_graph_copy_filter(struct graph_info *ginfo, | |||
1992 | static void redraw_pixmap_backend(struct graph_info *ginfo) | 2089 | static void redraw_pixmap_backend(struct graph_info *ginfo) |
1993 | { | 2090 | { |
1994 | GdkPixmap *old_pix; | 2091 | GdkPixmap *old_pix; |
2092 | static gboolean init; | ||
1995 | 2093 | ||
1996 | old_pix = ginfo->curr_pixmap; | 2094 | old_pix = ginfo->curr_pixmap; |
1997 | 2095 | ||
@@ -2013,17 +2111,16 @@ static void redraw_pixmap_backend(struct graph_info *ginfo) | |||
2013 | 2111 | ||
2014 | draw_info(ginfo, ginfo->draw->allocation.width); | 2112 | draw_info(ginfo, ginfo->draw->allocation.width); |
2015 | 2113 | ||
2016 | if (old_pix) { | 2114 | if (!init) { |
2017 | #if 0 | 2115 | init = TRUE; |
2018 | gdk_draw_drawable(ginfo->curr_pixmap, | 2116 | green = gdk_gc_new(ginfo->draw->window); |
2019 | ginfo->draw->style->fg_gc[GTK_WIDGET_STATE(ginfo->draw)], | 2117 | red = gdk_gc_new(ginfo->draw->window); |
2020 | old_pix, | 2118 | set_color(ginfo->draw, green, (0xff<<16)); |
2021 | 0, 0, 0, 0, | 2119 | set_color(ginfo->draw, red, 0xff); |
2022 | old_w, old_h); | 2120 | } |
2023 | #endif | ||
2024 | 2121 | ||
2122 | if (old_pix) | ||
2025 | g_object_unref(old_pix); | 2123 | g_object_unref(old_pix); |
2026 | } | ||
2027 | 2124 | ||
2028 | if (ginfo->hadj_value) { | 2125 | if (ginfo->hadj_value) { |
2029 | // gtk_adjustment_set_lower(ginfo->hadj, -100.0); | 2126 | // gtk_adjustment_set_lower(ginfo->hadj, -100.0); |
@@ -2188,6 +2285,8 @@ void trace_graph_free_info(struct graph_info *ginfo) | |||
2188 | trace_graph_plot_free(ginfo); | 2285 | trace_graph_plot_free(ginfo); |
2189 | tracecmd_close(ginfo->handle); | 2286 | tracecmd_close(ginfo->handle); |
2190 | free_task_hash(ginfo); | 2287 | free_task_hash(ginfo); |
2288 | |||
2289 | ginfo->cursor = 0; | ||
2191 | } | 2290 | } |
2192 | ginfo->handle = NULL; | 2291 | ginfo->handle = NULL; |
2193 | } | 2292 | } |
@@ -2248,6 +2347,14 @@ static int load_handle(struct graph_info *ginfo, | |||
2248 | ginfo->view_start_time = ginfo->start_time; | 2347 | ginfo->view_start_time = ginfo->start_time; |
2249 | ginfo->view_end_time = ginfo->end_time; | 2348 | ginfo->view_end_time = ginfo->end_time; |
2250 | 2349 | ||
2350 | if (!ginfo->draw) | ||
2351 | return 0; | ||
2352 | |||
2353 | update_cursor(ginfo); | ||
2354 | update_pointer(ginfo, 0); | ||
2355 | update_marka(ginfo, 0); | ||
2356 | update_markb(ginfo, 0); | ||
2357 | |||
2251 | return 0; | 2358 | return 0; |
2252 | } | 2359 | } |
2253 | 2360 | ||
@@ -2277,6 +2384,9 @@ trace_graph_create_with_callbacks(struct tracecmd_input *handle, | |||
2277 | struct graph_callbacks *cbs) | 2384 | struct graph_callbacks *cbs) |
2278 | { | 2385 | { |
2279 | struct graph_info *ginfo; | 2386 | struct graph_info *ginfo; |
2387 | GtkWidget *table; | ||
2388 | GtkWidget *hbox; | ||
2389 | GtkWidget *label; | ||
2280 | 2390 | ||
2281 | ginfo = g_new0(typeof(*ginfo), 1); | 2391 | ginfo = g_new0(typeof(*ginfo), 1); |
2282 | g_assert(ginfo != NULL); | 2392 | g_assert(ginfo != NULL); |
@@ -2291,9 +2401,81 @@ trace_graph_create_with_callbacks(struct tracecmd_input *handle, | |||
2291 | ginfo->task_filter = filter_task_hash_alloc(); | 2401 | ginfo->task_filter = filter_task_hash_alloc(); |
2292 | ginfo->hide_tasks = filter_task_hash_alloc(); | 2402 | ginfo->hide_tasks = filter_task_hash_alloc(); |
2293 | 2403 | ||
2294 | ginfo->widget = gtk_hbox_new(FALSE, 0); | 2404 | ginfo->widget = gtk_vbox_new(FALSE, 0); |
2295 | gtk_widget_show(ginfo->widget); | 2405 | gtk_widget_show(ginfo->widget); |
2296 | 2406 | ||
2407 | |||
2408 | ginfo->status_hbox = gtk_hbox_new(FALSE, 0); | ||
2409 | gtk_box_pack_start(GTK_BOX(ginfo->widget), ginfo->status_hbox, FALSE, FALSE, 0); | ||
2410 | gtk_widget_show(ginfo->status_hbox); | ||
2411 | |||
2412 | table = gtk_table_new(1, 23, FALSE); | ||
2413 | gtk_box_pack_start(GTK_BOX(ginfo->status_hbox), table, FALSE, FALSE, 0); | ||
2414 | gtk_widget_show(table); | ||
2415 | |||
2416 | /* --- Pointer --- */ | ||
2417 | |||
2418 | label = gtk_label_new("Pointer:"); | ||
2419 | gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2420 | gtk_widget_show(label); | ||
2421 | |||
2422 | ginfo->pointer_time = gtk_label_new("0.0"); | ||
2423 | gtk_table_attach(GTK_TABLE(table), ginfo->pointer_time, 1, 3, 0, 1, | ||
2424 | GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2425 | gtk_widget_show(ginfo->pointer_time); | ||
2426 | |||
2427 | /* --- Cursor --- */ | ||
2428 | |||
2429 | label = gtk_label_new("Cursor:"); | ||
2430 | gtk_table_attach(GTK_TABLE(table), label, 4, 5, 0, 1, GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2431 | gtk_widget_show(label); | ||
2432 | |||
2433 | ginfo->cursor_label = gtk_label_new("0.0"); | ||
2434 | gtk_table_attach(GTK_TABLE(table), ginfo->cursor_label, 6, 8, 0, 1, | ||
2435 | GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2436 | gtk_widget_show(ginfo->cursor_label); | ||
2437 | |||
2438 | |||
2439 | /* --- Marker A --- */ | ||
2440 | |||
2441 | label = gtk_label_new("Marker A:"); | ||
2442 | gtk_table_attach(GTK_TABLE(table), label, 9, 10, 0, 1, GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2443 | gtk_widget_show(label); | ||
2444 | |||
2445 | ginfo->marka_label = gtk_label_new("0.0"); | ||
2446 | gtk_table_attach(GTK_TABLE(table), ginfo->marka_label, 11, 13, 0, 1, | ||
2447 | GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2448 | gtk_widget_show(ginfo->marka_label); | ||
2449 | |||
2450 | |||
2451 | /* --- Marker B --- */ | ||
2452 | |||
2453 | label = gtk_label_new("Marker B:"); | ||
2454 | gtk_table_attach(GTK_TABLE(table), label, 14, 15, 0, 1, GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2455 | gtk_widget_show(label); | ||
2456 | |||
2457 | ginfo->markb_label = gtk_label_new("0.0"); | ||
2458 | gtk_table_attach(GTK_TABLE(table), ginfo->markb_label, 16, 18, 0, 1, | ||
2459 | GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2460 | gtk_widget_show(ginfo->markb_label); | ||
2461 | |||
2462 | |||
2463 | /* --- Delta --- */ | ||
2464 | |||
2465 | label = gtk_label_new("A,B Delta:"); | ||
2466 | gtk_table_attach(GTK_TABLE(table), label, 19, 20, 0, 1, GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2467 | gtk_widget_show(label); | ||
2468 | |||
2469 | ginfo->delta_label = gtk_label_new("0.0"); | ||
2470 | gtk_table_attach(GTK_TABLE(table), ginfo->delta_label, 21, 23, 0, 1, | ||
2471 | GTK_EXPAND, GTK_EXPAND, 3, 3); | ||
2472 | gtk_widget_show(ginfo->delta_label); | ||
2473 | |||
2474 | |||
2475 | hbox = gtk_hbox_new(FALSE, 0); | ||
2476 | gtk_box_pack_start(GTK_BOX(ginfo->widget), hbox, TRUE, TRUE, 0); | ||
2477 | gtk_widget_show(hbox); | ||
2478 | |||
2297 | ginfo->scrollwin = gtk_scrolled_window_new(NULL, NULL); | 2479 | ginfo->scrollwin = gtk_scrolled_window_new(NULL, NULL); |
2298 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ginfo->scrollwin), | 2480 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ginfo->scrollwin), |
2299 | GTK_POLICY_AUTOMATIC, | 2481 | GTK_POLICY_AUTOMATIC, |
@@ -2308,7 +2490,7 @@ trace_graph_create_with_callbacks(struct tracecmd_input *handle, | |||
2308 | GTK_POLICY_NEVER, | 2490 | GTK_POLICY_NEVER, |
2309 | GTK_POLICY_NEVER); | 2491 | GTK_POLICY_NEVER); |
2310 | gtk_widget_show(ginfo->info_scrollwin); | 2492 | gtk_widget_show(ginfo->info_scrollwin); |
2311 | gtk_box_pack_start(GTK_BOX(ginfo->widget), ginfo->info_scrollwin, FALSE, FALSE, 0); | 2493 | gtk_box_pack_start(GTK_BOX(hbox), ginfo->info_scrollwin, FALSE, FALSE, 0); |
2312 | 2494 | ||
2313 | ginfo->info = create_graph_info(ginfo); | 2495 | ginfo->info = create_graph_info(ginfo); |
2314 | gtk_widget_show(ginfo->info); | 2496 | gtk_widget_show(ginfo->info); |
@@ -2316,7 +2498,7 @@ trace_graph_create_with_callbacks(struct tracecmd_input *handle, | |||
2316 | gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ginfo->info_scrollwin), | 2498 | gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ginfo->info_scrollwin), |
2317 | ginfo->info); | 2499 | ginfo->info); |
2318 | 2500 | ||
2319 | gtk_box_pack_start(GTK_BOX (ginfo->widget), ginfo->scrollwin, TRUE, TRUE, 0); | 2501 | gtk_box_pack_start(GTK_BOX (hbox), ginfo->scrollwin, TRUE, TRUE, 0); |
2320 | 2502 | ||
2321 | gtk_signal_connect(GTK_OBJECT(ginfo->hadj), "value_changed", | 2503 | gtk_signal_connect(GTK_OBJECT(ginfo->hadj), "value_changed", |
2322 | (GtkSignalFunc) value_changed, ginfo); | 2504 | (GtkSignalFunc) value_changed, ginfo); |
diff --git a/trace-graph.h b/trace-graph.h index 8cb51d4..91ae161 100644 --- a/trace-graph.h +++ b/trace-graph.h | |||
@@ -164,6 +164,12 @@ struct graph_info { | |||
164 | struct task_list *tasks[TASK_HASH_SIZE]; | 164 | struct task_list *tasks[TASK_HASH_SIZE]; |
165 | 165 | ||
166 | GtkWidget *widget; /* Box to hold graph */ | 166 | GtkWidget *widget; /* Box to hold graph */ |
167 | GtkWidget *status_hbox; /* hbox holding status info */ | ||
168 | GtkWidget *pointer_time; /* time that pointer is at */ | ||
169 | GtkWidget *cursor_label; /* label showing cursor time */ | ||
170 | GtkWidget *marka_label; /* label showing Marker A time */ | ||
171 | GtkWidget *markb_label; /* label showing Marker B time */ | ||
172 | GtkWidget *delta_label; /* label showing delta of B - A */ | ||
167 | GtkWidget *scrollwin; /* graph scroll window */ | 173 | GtkWidget *scrollwin; /* graph scroll window */ |
168 | GtkWidget *info_scrollwin; /* graph scroll window (for info widget) */ | 174 | GtkWidget *info_scrollwin; /* graph scroll window (for info widget) */ |
169 | GtkWidget *info; /* info window */ | 175 | GtkWidget *info; /* info window */ |
@@ -185,6 +191,10 @@ struct graph_info { | |||
185 | gint last_x; /* last x seen while moving mouse */ | 191 | gint last_x; /* last x seen while moving mouse */ |
186 | gboolean line_active; /* set when button is pressed */ | 192 | gboolean line_active; /* set when button is pressed */ |
187 | guint64 line_time; /* time line of where line_active is set */ | 193 | guint64 line_time; /* time line of where line_active is set */ |
194 | guint64 marka_time; /* time that marker A is at */ | ||
195 | guint64 markb_time; /* time that marker B is at */ | ||
196 | gboolean show_marka; /* draw marker A line */ | ||
197 | gboolean show_markb; /* draw marker B line */ | ||
188 | gboolean zoom; /* set when shift button is pressed */ | 198 | gboolean zoom; /* set when shift button is pressed */ |
189 | 199 | ||
190 | gdouble hadj_value; /* value to set hadj width */ | 200 | gdouble hadj_value; /* value to set hadj width */ |