diff options
author | Anders Broman <anders.broman@ericsson.com> | 2011-09-22 08:46:09 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2011-09-22 08:46:09 +0000 |
commit | ded5c901fa8097c8ef28860b8bfcf73cf87a5e31 (patch) | |
tree | 9a35ea24484f7838e6da7d37cb6e500f3fbf5594 /gtk | |
parent | fd2f8183537eb146960d864bf6b890b2dbc01a10 (diff) |
Store a pointer to frame_data rather than the time.
svn path=/trunk/; revision=39086
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/graph_analysis.c | 45 | ||||
-rw-r--r-- | gtk/graph_analysis.h | 3 |
2 files changed, 33 insertions, 15 deletions
diff --git a/gtk/graph_analysis.c b/gtk/graph_analysis.c index cf8d5f4cd4..1ef8b67f43 100644 --- a/gtk/graph_analysis.c +++ b/gtk/graph_analysis.c @@ -310,7 +310,9 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t *user_data) GString *label_string, *empty_line,*separator_line, *tmp_str, *tmp_str2; char *empty_header; char src_port[8],dst_port[8]; - +#if 0 + gchar *time_str = g_malloc(COL_MAX_LEN); +#endif GList *list; FILE *of; @@ -449,8 +451,12 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t *user_data) } /* write the time */ - /* XXX TODO: Use recent.gui_time_format to chose time format */ g_string_printf(label_string, "|%.3f", nstime_to_sec(&gai->fd->rel_ts)); +#if 0 + /* Write the time, using the same format as in th etime col */ + set_fd_time(gai->fd, time_str); + g_string_printf(label_string, "|%s", time_str); +#endif enlarge_string(label_string, 10, ' '); fprintf(of, "%s", label_string->str); @@ -508,7 +514,9 @@ exit: g_string_free(separator_line, TRUE); g_string_free(tmp_str, TRUE); g_string_free(tmp_str2, TRUE); - +#if 0 + g_free(time_str); +#endif fclose (of); return TRUE; @@ -664,7 +672,9 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) char label_string[MAX_COMMENT]; GList *list; cairo_t *cr; - +#if 0 + gchar *time_str = g_malloc(COL_MAX_LEN); +#endif GdkColor *color_p, *bg_color_p; GdkColor black_color = {0, 0, 0, 0}; @@ -770,8 +780,7 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) if (gai->display){ if (current_item>=display_items) break; /* the item is outside the display */ if (i>=first_item){ - user_data->dlg.items[current_item].frame_num = gai->fd->num; - user_data->dlg.items[current_item].time = gai->fd->rel_ts; + user_data->dlg.items[current_item].fd = gai->fd; user_data->dlg.items[current_item].port_src = gai->port_src; user_data->dlg.items[current_item].port_dst = gai->port_dst; /* Add "..." if the length is 50 characters */ @@ -813,7 +822,12 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) /* Calculate the x borders */ /* We use time from the last display item to calcultate the x left border */ /* XXX TODO: Use recent.gui_time_format to chose time format */ - g_snprintf(label_string, MAX_LABEL, "%.3f", nstime_to_sec(&user_data->dlg.items[display_items-1].time)); + g_snprintf(label_string, MAX_LABEL, "%.3f", nstime_to_sec(&user_data->dlg.items[display_items-1].fd->rel_ts)); +#if 0 + /* Write the time, using the same format as in th etime col */ + set_fd_time(user_data->dlg.items[display_items-1].fd, time_str); + g_snprintf(label_string, MAX_LABEL, "%s", time_str); +#endif layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string); middle_layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string); small_layout = gtk_widget_create_pango_layout(user_data->dlg.draw_area_time, label_string); @@ -1000,9 +1014,12 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) /* Draw the items */ for (current_item=0; current_item<display_items; current_item++){ - /* draw the time */ - /* XXX TODO: Use recent.gui_time_format to chose time format */ - g_snprintf(label_string, MAX_LABEL, "%.3f", nstime_to_sec(&user_data->dlg.items[current_item].time)); + /* Draw the time */ + g_snprintf(label_string, MAX_LABEL, "%.3f", nstime_to_sec(&user_data->dlg.items[current_item].fd->rel_ts)); +#if 0 + set_fd_time(user_data->dlg.items[current_item].fd, time_str); + g_snprintf(label_string, MAX_LABEL, "%s", time_str); +#endif pango_layout_set_text(layout, label_string, -1); pango_layout_get_pixel_size(layout, &label_width, &label_height); #if GTK_CHECK_VERSION(2,22,0) @@ -1248,7 +1265,9 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) } g_object_unref(G_OBJECT(layout)); - +#if 0 + g_free(time_str); +#endif /* refresh the draw areas */ if (gtk_widget_is_drawable(user_data->dlg.draw_area_time) ){ cr = gdk_cairo_create (gtk_widget_get_window(user_data->dlg.draw_area_time)); @@ -1325,7 +1344,7 @@ static gboolean button_press_event(GtkWidget *widget _U_, GdkEventButton *event, user_data->dlg.needs_redraw=TRUE; dialog_graph_draw(user_data); - cf_goto_frame(&cfile, user_data->dlg.items[item].frame_num); + cf_goto_frame(&cfile, user_data->dlg.items[item].fd->num); return TRUE; } @@ -1389,7 +1408,7 @@ static gboolean key_press_event(GtkWidget *widget _U_, GdkEventKey *event, gpoin user_data->dlg.needs_redraw=TRUE; dialog_graph_draw(user_data); - cf_goto_frame(&cfile, user_data->dlg.items[user_data->dlg.selected_item-user_data->dlg.first_item].frame_num); + cf_goto_frame(&cfile, user_data->dlg.items[user_data->dlg.selected_item-user_data->dlg.first_item].fd->num); return TRUE; } diff --git a/gtk/graph_analysis.h b/gtk/graph_analysis.h index 4cc4485d94..31d46d8786 100644 --- a/gtk/graph_analysis.h +++ b/gtk/graph_analysis.h @@ -65,8 +65,7 @@ typedef struct _graph_analysis_info { #define NUM_DISPLAY_ITEMS 1000 typedef struct _display_items { - guint32 frame_num; /* frame number used to "go to" that frame */ - nstime_t time; /* frame time */ + frame_data *fd; /* Holds the frame number and time information */ guint16 port_src; guint16 port_dst; gchar *frame_label; /* the label on top of the arrow */ |