continue implementation of resourceview
[lttv.git] / ltt / branches / poly / lttv / modules / gui / resourceview / drawing.c
index e0b92aa3fc526ec49bba9444916e68139249d64e..927ef90a364069c33516b57fb82cc437953d5e9d 100644 (file)
@@ -36,8 +36,8 @@
 #include "eventhooks.h"
 #include "cfv.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)
+//#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)
 
 //FIXME
 // fixed #define TRACE_NUMBER 0
@@ -84,19 +84,12 @@ GdkColor drawing_colors[NUM_COLORS] =
 
 };
 
-/*
-RUN+USER MODE green
-RUN+SYSCALL
-RUN+TRAP
-RUN+IRQ
-WAIT+foncé
-WAIT CPU + WAIT FORK vert foncé ou jaune
-IRQ rouge
-TRAP: orange
-SYSCALL: bleu pâle
-
-ZOMBIE + WAIT EXIT
-*/
+GdkColor drawing_colors_cpu[NUM_COLORS_CPU] =
+{ /* Pixel, R, G, B */
+  { 0, 0xBBBB, 0xBBBB, 0xBBBB }, /* COL_IDLE */
+  { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_BUSY */
+  { 0, 0xFFFF, 0x0000, 0x0000 }, /* COL_UNKNOWN */
+};
 
 
 /*****************************************************************************
@@ -225,69 +218,69 @@ void drawing_data_request(Drawing_t *drawing,
 
       /* before hooks */
       
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
-          LTT_FIELD_SYSCALL_ID, 0, 0,
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT,
-          0, 0, 0,
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_ENTRY,
-          LTT_FIELD_TRAP_ID, 0, 0,
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_EXIT,
-          0, 0, 0, 
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY,
-          LTT_FIELD_IRQ_ID, 0, 0,
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT,
-          0, 0, 0, 
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
-          LTT_FIELD_SOFT_IRQ_ID, 0, 0,
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
-          0, 0, 0, 
-          before_execmode_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
+//          LTT_FIELD_SYSCALL_ID, 0, 0,
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT,
+//          0, 0, 0,
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_ENTRY,
+//          LTT_FIELD_TRAP_ID, 0, 0,
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_EXIT,
+//          0, 0, 0, 
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY,
+//          LTT_FIELD_IRQ_ID, 0, 0,
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT,
+//          0, 0, 0, 
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
+//          LTT_FIELD_SOFT_IRQ_ID, 0, 0,
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
+//          0, 0, 0, 
+//          before_execmode_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
 
 
       ret = lttv_trace_find_hook(ts->parent.t,
@@ -298,29 +291,29 @@ void drawing_data_request(Drawing_t *drawing,
           &g_array_index(hooks, LttvTraceHook, before_hn++));
       if(ret) before_hn--;
 
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT,
-          LTT_FIELD_PID, 0, 0,
-          before_process_exit_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-      
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FREE,
-          LTT_FIELD_PID, 0, 0,
-          before_process_release_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_LIST, LTT_EVENT_STATEDUMP_END,
-          0, 0, 0,
-          before_statedump_end,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, before_hn++));
-      if(ret) before_hn--;
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT,
+//          LTT_FIELD_PID, 0, 0,
+//          before_process_exit_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//      
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FREE,
+//          LTT_FIELD_PID, 0, 0,
+//          before_process_release_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_LIST, LTT_EVENT_STATEDUMP_END,
+//          0, 0, 0,
+//          before_statedump_end,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, before_hn++));
+//      if(ret) before_hn--;
 
 #if 0
       lttv_trace_find_hook(ts->parent.t,
@@ -381,45 +374,45 @@ void drawing_data_request(Drawing_t *drawing,
           &g_array_index(hooks, LttvTraceHook, after_hn++));
       if(ret) after_hn--;
 
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FORK,
-          LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0,
-          after_process_fork_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT,
-          LTT_FIELD_PID, 0, 0,
-          after_process_exit_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_FS, LTT_EVENT_EXEC,
-          0, 0, 0,
-          after_fs_exec_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_USER_GENERIC, LTT_EVENT_THREAD_BRAND,
-          LTT_FIELD_NAME, 0, 0,
-          after_user_generic_thread_brand_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
-
-      ret = lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_LIST, LTT_EVENT_PROCESS_STATE,
-          LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
-          after_event_enum_process_hook,
-          events_request,
-          &g_array_index(hooks, LttvTraceHook, after_hn++));
-      if(ret) after_hn--;
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FORK,
+//          LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0,
+//          after_process_fork_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, after_hn++));
+//      if(ret) after_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT,
+//          LTT_FIELD_PID, 0, 0,
+//          after_process_exit_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, after_hn++));
+//      if(ret) after_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_FS, LTT_EVENT_EXEC,
+//          0, 0, 0,
+//          after_fs_exec_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, after_hn++));
+//      if(ret) after_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_USER_GENERIC, LTT_EVENT_THREAD_BRAND,
+//          LTT_FIELD_NAME, 0, 0,
+//          after_user_generic_thread_brand_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, after_hn++));
+//      if(ret) after_hn--;
+//
+//      ret = lttv_trace_find_hook(ts->parent.t,
+//          LTT_FACILITY_LIST, LTT_EVENT_PROCESS_STATE,
+//          LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
+//          after_event_enum_process_hook,
+//          events_request,
+//          &g_array_index(hooks, LttvTraceHook, after_hn++));
+//      if(ret) after_hn--;
 
       hooks = g_array_set_size(hooks, after_hn);
 
@@ -526,8 +519,8 @@ void drawing_data_request(Drawing_t *drawing,
 
 static void set_last_start(gpointer key, gpointer value, gpointer user_data)
 {
-  ProcessInfo *process_info = (ProcessInfo*)key;
-  HashedProcessData *hashed_process_data = (HashedProcessData*)value;
+  ResourceInfo *process_info = (ResourceInfo*)key;
+  HashedResourceData *hashed_process_data = (HashedResourceData*)value;
   guint x = (guint)user_data;
 
   hashed_process_data->x.over = x;
@@ -579,12 +572,12 @@ void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss)
   guint nb_trace = lttv_traceset_number(traceset);
   
   if(!cfd->process_list->current_hash_data) {
-    cfd->process_list->current_hash_data = g_new(HashedProcessData**,nb_trace);
+    cfd->process_list->current_hash_data = g_new(HashedResourceData**,nb_trace);
     for(i = 0 ; i < nb_trace ; i++) {
       guint num_cpu = ltt_trace_get_num_cpu(tss->parent.traces[i]->t);
-      cfd->process_list->current_hash_data[i] = g_new(HashedProcessData*,num_cpu);
+      cfd->process_list->current_hash_data[i] = g_new(HashedResourceData*,num_cpu);
       memset(cfd->process_list->current_hash_data[i], 0,
-             sizeof(HashedProcessData*)*num_cpu);
+             sizeof(HashedResourceData*)*num_cpu);
     }
   }
   //cfd->drawing->last_start = LTT_TIME_MIN(current_time,
@@ -1070,7 +1063,9 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
   /* Allocate the colors */
   GdkColormap* colormap = gdk_colormap_get_system();
   gboolean success[NUM_COLORS];
-  gdk_colormap_alloc_colors(colormap, drawing_colors, NUM_COLORS, FALSE,
+  //gdk_colormap_alloc_colors(colormap, drawing_colors, NUM_COLORS, FALSE,
+  //                          TRUE, success);
+  gdk_colormap_alloc_colors(colormap, drawing_colors_cpu, NUM_COLORS_CPU, FALSE,
                             TRUE, success);
   
   drawing->gc =
@@ -1127,7 +1122,8 @@ void drawing_destroy(Drawing_t *drawing)
   /* Free the colors */
   GdkColormap* colormap = gdk_colormap_get_system();
 
-  gdk_colormap_free_colors(colormap, drawing_colors, NUM_COLORS);
+  //gdk_colormap_free_colors(colormap, drawing_colors, NUM_COLORS);
+  gdk_colormap_free_colors(colormap, drawing_colors_cpu, NUM_COLORS_CPU);
   
 
 
This page took 0.029873 seconds and 4 git commands to generate.