Remove duplicate field in detailed event view
authorFrancis Deslauriers <francis.deslauriers@polymtl.ca>
Thu, 5 Jul 2012 15:04:08 +0000 (11:04 -0400)
committerYannick Brosseau <yannick.brosseau@gmail.com>
Fri, 6 Jul 2012 21:34:21 +0000 (17:34 -0400)
Add option to lttv_event_to_string to select if we add the timestamp and the event name to the returned string

(Closes #291)

Signed-off-by: Francis Deslauriers <francis.deslauriers@polymtl.ca>
Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
lttv/lttv/print.c
lttv/lttv/print.h
lttv/modules/gui/detailedevents/events.c
lttv/modules/text/textDump.c

index 5707175c3ee92627c5bbe568f42a3bc58fb64cad..aa21f77bf3c18531515539bdf37d9cfb0e318087 100644 (file)
@@ -430,7 +430,8 @@ int getFieldsFromEvent(struct bt_ctf_event *ctf_event, GString* fields, gboolean
        return ret;
 }
 
-void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_names)
+void lttv_event_to_string(LttvEvent *event, GString *a_string,
+                               gboolean field_names, gboolean long_version)
 {
        GString* processInfos = g_string_new("");
        GString* fields = g_string_new("");
@@ -441,8 +442,13 @@ void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_na
        getCPUIdFromEvent(event, cpuId_str);
 
        g_string_set_size(a_string,0);
-
-       g_string_append_printf(a_string, "%llu %s: { %s }", bt_ctf_get_timestamp(event->bt_event), bt_ctf_event_name(event->bt_event), cpuId_str->str);
+       if(long_version){
+               g_string_append_printf(a_string, "%llu %s: ", 
+                                      bt_ctf_get_timestamp(event->bt_event), 
+                                      bt_ctf_event_name(event->bt_event));
+       }
+       g_string_append_printf(a_string, "{ %s }", cpuId_str->str);
+       
        if (strcmp("", processInfos->str) < 0) {
                g_string_append_printf(a_string, ", { %s }", processInfos->str);
        }
@@ -454,7 +460,11 @@ void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_na
        g_string_free(processInfos, TRUE);
        g_string_free(cpuId_str, TRUE);
 }
-
+void lttv_event_get_name(LttvEvent *event,GString *a_string)
+{
+       g_string_set_size(a_string,0);
+       g_string_append_printf(a_string, " %s", bt_ctf_event_name(event->bt_event));
+}
 #ifdef BABEL_CLEANUP
 void lttv_event_to_string(LttEvent *e, GString *s, gboolean mandatory_fields,
                gboolean field_names, LttvTracefileState *tfs)
index 47cfb61c2b4fa1780ba1ad180a47facfee17ca69..126fbc2e0dbcaf0ff4fe547039a880e9c69bf1a9 100644 (file)
@@ -32,5 +32,9 @@ void lttv_print_field(LttEvent *e, struct marker_field *f, GString *s,
 void lttv_event_to_string(LttEvent *e, GString *s, gboolean mandatory_fields,
                gboolean field_names, LttvTracefileState *tfs);
 #endif
-void lttv_event_to_string(LttvEvent *event, GString *a_string, gboolean field_names);
+void lttv_event_to_string(LttvEvent *event,
+                         GString *a_string,
+                         gboolean field_names,
+                         gboolean long_version);
+void lttv_event_get_name(LttvEvent *event,GString *a_string);
 
index 585acbc09b35b2cd937c515d95e84c1f1514b0fc..ac1311497ad23944e4a8173bda0b7ff5ccdb335b 100644 (file)
@@ -148,7 +148,6 @@ int event_hook(void *hook_data, void *call_data);
 enum
 {
   TRACE_NAME_COLUMN,
-  TRACEFILE_NAME_COLUMN,
   CPUID_COLUMN,
   EVENT_COLUMN,
   TIME_S_COLUMN,
@@ -252,7 +251,6 @@ gui_events(LttvPluginTab *ptab)
   event_viewer_data->store_m = gtk_list_store_new (
     N_COLUMNS,      /* Total number of columns     */
     G_TYPE_STRING,  /* Trace name                  */
-    G_TYPE_STRING,  /* Tracefile name              */
     G_TYPE_UINT,    /* CPUID                       */
     G_TYPE_STRING,  /* Event                       */
     G_TYPE_UINT,    /* Time s                      */
@@ -321,19 +319,6 @@ gui_events(LttvPluginTab *ptab)
         G_CALLBACK(header_size_allocate),
         (gpointer)event_viewer_data);
 
-
-  
-  renderer = gtk_cell_renderer_text_new ();
-  column = gtk_tree_view_column_new_with_attributes ("Tracefile",
-                 renderer,
-                 "text", TRACEFILE_NAME_COLUMN,
-                 NULL);
-  gtk_tree_view_column_set_alignment (column, 0.0);
-  gtk_tree_view_column_set_fixed_width (column, 120);
-  gtk_tree_view_append_column (GTK_TREE_VIEW (event_viewer_data->tree_v),
-      column);
-
-
   renderer = gtk_cell_renderer_text_new ();
   column = gtk_tree_view_column_new_with_attributes ("CPUID",
                  renderer,
@@ -1557,10 +1542,12 @@ int event_hook(void *hook_data, void *call_data)
   GtkTreeIter iter;
 
   GString *desc = g_string_new("");
+  GString *name = g_string_new("");
   
   LttvTracesetPosition *pos = lttv_traceset_create_position(traceState->trace->traceset);
 
-  lttv_event_to_string(e, desc, TRUE);
+  lttv_event_to_string(e, desc, TRUE, FALSE);
+  lttv_event_get_name(e,name);
 
   g_info("detail : %s", desc->str);
 
@@ -1568,9 +1555,8 @@ int event_hook(void *hook_data, void *call_data)
 
   gtk_list_store_set (event_viewer_data->store_m, &iter,
         TRACE_NAME_COLUMN, "TraceName",
-        TRACEFILE_NAME_COLUMN,"TraceFile" /*traceState->trace->traceset->filename*/,
         CPUID_COLUMN, cpu,
-        EVENT_COLUMN,"EventName" /*bt_ctf_event_name(e->bt_event)*/,
+        EVENT_COLUMN,name->str,
         TIME_S_COLUMN, time.tv_sec,
         TIME_NS_COLUMN, time.tv_nsec,
         PID_COLUMN, process->pid,
@@ -1581,6 +1567,7 @@ int event_hook(void *hook_data, void *call_data)
   g_ptr_array_add(event_viewer_data->pos, pos);
   
   g_string_free(desc, TRUE);
+  g_string_free(name, TRUE);
 
   if(event_viewer_data->update_cursor) {
     if(lttv_traceset_position_compare(pos, 
index a09c8b79ecb51f8392ed631135bf949b9452225c..c11db5d9965bfc54eef4423c2aa63cea059553ee 100644 (file)
@@ -352,7 +352,7 @@ static int write_event_content(void *hook_data, void *call_data)
 #endif
 
   /* TODO 2012-03-12 Add state info */
-  lttv_event_to_string(event, a_string, !a_no_field_names);
+  lttv_event_to_string(event, a_string, !a_no_field_names, TRUE);
 
 #ifdef BABEL_CLEANUP
   if(a_state) {
This page took 0.026822 seconds and 4 git commands to generate.