fix tree
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / processlist.c
index 1858c4fddd255e50d424ca077ef03f8daef32035..e49b74ac3f3a3caddb18946e0fbf5a10b5f5796d 100644 (file)
@@ -32,7 +32,6 @@
 #include "drawitem.h"
 
 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
-#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
 
 /* Preallocated Size of the index_to_pixmap array */
 #define ALLOCATE_PROCESSES 1000
@@ -49,38 +48,40 @@ gint process_sort_func  ( GtkTreeModel *model,
 {
   gchar *a_name;
   gchar *a_brand;
-  guint a_pid, a_ppid, a_cpu;
+  guint a_pid, a_tgid, a_ppid, a_cpu;
   gulong a_birth_s, a_birth_ns;
-  gulong a_trace;
+  guint a_trace;
 
   gchar *b_name;
   gchar *b_brand;
-  guint b_pid, b_ppid, b_cpu;
+  guint b_pid, b_tgid, b_ppid, b_cpu;
   gulong b_birth_s, b_birth_ns;
-  gulong b_trace;
+  guint b_trace;
 
   gtk_tree_model_get(model,
            it_a,
-           0, &a_name,
-           1, &a_brand,
-           2, &a_pid,
-           3, &a_ppid,
-           4, &a_cpu,
-           5, &a_birth_s,
-           6, &a_birth_ns,
-           7, &a_trace,
+           PROCESS_COLUMN, &a_name,
+           BRAND_COLUMN, &a_brand,
+           PID_COLUMN, &a_pid,
+           TGID_COLUMN, &a_tgid,
+           PPID_COLUMN, &a_ppid,
+           CPU_COLUMN, &a_cpu,
+           BIRTH_S_COLUMN, &a_birth_s,
+           BIRTH_NS_COLUMN, &a_birth_ns,
+           TRACE_COLUMN, &a_trace,
            -1);
 
   gtk_tree_model_get(model,
            it_b,
-           0, &b_name,
-           1, &b_brand,
-           2, &b_pid,
-           3, &b_ppid,
-           4, &b_cpu,
-           5, &b_birth_s,
-           6, &b_birth_ns,
-           7, &b_trace,
+           PROCESS_COLUMN, &b_name,
+           BRAND_COLUMN, &b_brand,
+           PID_COLUMN, &b_pid,
+           TGID_COLUMN, &b_tgid,
+           PPID_COLUMN, &b_ppid,
+           CPU_COLUMN, &b_cpu,
+           BIRTH_S_COLUMN, &b_birth_s,
+           BIRTH_NS_COLUMN, &b_birth_ns,
+           TRACE_COLUMN, &b_trace,
            -1);
 
   
@@ -359,9 +360,10 @@ ProcessList *processlist_construct(void)
               G_TYPE_UINT,
               G_TYPE_UINT,
               G_TYPE_UINT,
+              G_TYPE_UINT,
               G_TYPE_ULONG,
               G_TYPE_ULONG,
-              G_TYPE_ULONG);
+              G_TYPE_UINT);
 
 
   process_list->process_list_widget = 
@@ -399,8 +401,10 @@ ProcessList *processlist_construct(void)
   process_list->renderer = renderer;
 
        gint vertical_separator;
+       gint tree_line_width;
        gtk_widget_style_get (GTK_WIDGET (process_list->process_list_widget),
                        "vertical-separator", &vertical_separator,
+                       "tree-line-width", &tree_line_width,
                        NULL);
   gtk_cell_renderer_get_size(renderer,
       GTK_WIDGET(process_list->process_list_widget),
@@ -409,15 +413,9 @@ ProcessList *processlist_construct(void)
       NULL,
       NULL,
       &process_list->cell_height);
-       
-#if GTK_CHECK_VERSION(2,4,15)
-  guint ypad;
-  g_object_get(G_OBJECT(renderer), "ypad", &ypad, NULL);
 
-  process_list->cell_height += ypad;
-#endif
   process_list->cell_height += vertical_separator;
-       
+  process_list->cell_height += tree_line_width;
 
   column = gtk_tree_view_column_new_with_attributes ( "Process",
                 renderer,
@@ -425,7 +423,8 @@ ProcessList *processlist_construct(void)
                 PROCESS_COLUMN,
                 NULL);
   gtk_tree_view_column_set_alignment (column, 0.0);
-  gtk_tree_view_column_set_fixed_width (column, 45);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
   
@@ -437,7 +436,8 @@ ProcessList *processlist_construct(void)
                 BRAND_COLUMN,
                 NULL);
   gtk_tree_view_column_set_alignment (column, 0.0);
-  gtk_tree_view_column_set_fixed_width (column, 45);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
 
@@ -446,6 +446,18 @@ ProcessList *processlist_construct(void)
                 "text",
                 PID_COLUMN,
                 NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
+  gtk_tree_view_append_column (
+    GTK_TREE_VIEW (process_list->process_list_widget), column);
+
+  column = gtk_tree_view_column_new_with_attributes ( "TGID",
+                renderer,
+                "text",
+                TGID_COLUMN,
+                NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
 
@@ -454,6 +466,8 @@ ProcessList *processlist_construct(void)
                 "text",
                 PPID_COLUMN,
                 NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
   
@@ -462,6 +476,8 @@ ProcessList *processlist_construct(void)
                 "text",
                 CPU_COLUMN,
                 NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
 
@@ -470,6 +486,8 @@ ProcessList *processlist_construct(void)
                 "text",
                 BIRTH_S_COLUMN,
                 NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
 
@@ -480,6 +498,8 @@ ProcessList *processlist_construct(void)
                 "text",
                 BIRTH_NS_COLUMN,
                 NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
 
@@ -488,6 +508,8 @@ ProcessList *processlist_construct(void)
                 "text",
                 TRACE_COLUMN,
                 NULL);
+  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
+  gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column (
     GTK_TREE_VIEW (process_list->process_list_widget), column);
 
@@ -529,8 +551,8 @@ static gboolean remove_hash_item(ProcessInfo *process_info,
 
   if(likely(process_list->current_hash_data != NULL)) {
     if(likely(hashed_process_data ==
-                process_list->current_hash_data[process_info->cpu]))
-      process_list->current_hash_data[process_info->cpu] = NULL;
+                process_list->current_hash_data[process_info->trace_num][process_info->cpu]))
+      process_list->current_hash_data[process_info->trace_num][process_info->cpu] = NULL;
   }
   return TRUE; /* remove the element from the hash table */
 }
@@ -581,6 +603,16 @@ void processlist_set_brand(ProcessList *process_list,
         BRAND_COLUMN, g_quark_to_string(brand),
         -1);
 }
+
+void processlist_set_tgid(ProcessList *process_list,
+    guint tgid,
+    HashedProcessData *hashed_process_data)
+{
+  gtk_list_store_set (  process_list->list_store, &hashed_process_data->y_iter,
+        TGID_COLUMN, tgid,
+        -1);
+}
+
 void processlist_set_ppid(ProcessList *process_list,
     guint ppid,
     HashedProcessData *hashed_process_data)
@@ -594,6 +626,7 @@ void processlist_set_ppid(ProcessList *process_list,
 int processlist_add(  ProcessList *process_list,
       Drawing_t *drawing,
       guint pid,
+      guint tgid,
       guint cpu,
       guint ppid,
       LttTime *birth,
@@ -608,8 +641,9 @@ int processlist_add(  ProcessList *process_list,
   HashedProcessData *hashed_process_data = g_new(HashedProcessData, 1);
   *pm_hashed_process_data = hashed_process_data;
   *pm_process_info = Process_Info;
-  
   Process_Info->pid = pid;
+  Process_Info->tgid = tgid;
   if(pid == 0)
     Process_Info->cpu = cpu;
   else
@@ -643,6 +677,7 @@ int processlist_add(  ProcessList *process_list,
         PROCESS_COLUMN, g_quark_to_string(name),
         BRAND_COLUMN, g_quark_to_string(brand),
         PID_COLUMN, pid,
+        TGID_COLUMN, tgid,
         PPID_COLUMN, ppid,
         CPU_COLUMN, cpu,
         BIRTH_S_COLUMN, birth->tv_sec,
@@ -718,8 +753,8 @@ int processlist_remove( ProcessList *process_list,
         &process_info);
 
     if(likely(process_list->current_hash_data != NULL)) {
-      if(likely(hashed_process_data == process_list->current_hash_data[cpu])) {
-        process_list->current_hash_data[cpu] = NULL;
+      if(likely(hashed_process_data == process_list->current_hash_data[trace_num][cpu])) {
+        process_list->current_hash_data[trace_num][cpu] = NULL;
       }
     }
     
This page took 0.026714 seconds and 4 git commands to generate.