correctly add -lm for math lib
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 19 Aug 2004 00:13:12 +0000 (00:13 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 19 Aug 2004 00:13:12 +0000 (00:13 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@807 04897980-b3bd-0310-b5e0-8ef037075253

14 files changed:
ltt/branches/poly/configure.in
ltt/branches/poly/ltt/Makefile.am
ltt/branches/poly/ltt/convert/Makefile.am
ltt/branches/poly/lttv/lttv/Makefile.am
ltt/branches/poly/lttv/modules/gui/controlflow/Makefile.am
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c
ltt/branches/poly/lttv/modules/gui/controlflow/processlist.h
ltt/branches/poly/lttv/modules/gui/detailedevents/Makefile.am
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
ltt/branches/poly/lttv/modules/gui/statistics/Makefile.am
ltt/branches/poly/lttv/modules/text/Makefile.am

index bb4e2c88074fb4fd3b753a10024223f2b770da71..d54bc2dfa6978a272e3683dda38673dcdc51c7a9 100644 (file)
@@ -36,7 +36,7 @@ AC_PROG_CC
 
 # Checks for libraries.
 AC_CHECK_LIB([popt], [poptGetNextOpt], POPT_LIBS="-lpopt",AC_MSG_ERROR([libpopt is required in order to compile LinuxTraceToolkit])  )
-AC_CHECK_LIB([m], [round], POPT_LIBS+=" -lm",AC_MSG_ERROR([Mathematical libraries are missing.])  )
+AC_CHECK_LIB([m], [round], M_LIBS="-lm",AC_MSG_ERROR([Mathematical libraries are missing.])  )
 
 
 # Checks for header files.
index cc5eed55a7bbe57e8de26d5fcccc803238c92e6b..eda40575ddd8ed71e681c93eb660695c4a526344 100644 (file)
@@ -9,10 +9,11 @@ SUBDIRS = convert
 libdir = ${lttlibdir}
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
-LIBS += $(GLIB_LIBS)
+LIBS += $(GLIB_LIBS) $(M_LIBS)
 
 lib_LTLIBRARIES = libtraceread.la
 libtraceread_la_SOURCES = event.c facility.c parser.c tracefile.c type.c
+libtraceread_la_LIBADD = -lm
 noinst_HEADERS = parser.h ltt-private.h
 
 lttinclude_HEADERS = \
index 5c345b6fb6703ab8e22ccbbaab697caa3c1c7cbf..cc9a3d2b8306d02b4500a9087f0da060647b19ad 100644 (file)
@@ -1,5 +1,5 @@
 AM_CFLAGS = $(GLIB_CFLAGS) 
-LIBS += $(GLIB_LIBS)
+LIBS += $(GLIB_LIBS) $(M_LIBS)
 
 bin_PROGRAMS = convert
 
index 3ccb55c3a4becce38f0e7c4ce28dc6ac729b9cc2..eade395960b28d7960d5872b5b254b10957172da 100644 (file)
@@ -1,5 +1,5 @@
 AM_CFLAGS = $(GLIB_CFLAGS) 
-LIBS += $(POPT_LIBS) $(GLIB_LIBS) -lgobject-2.0 -L$(top_srcdir)/ltt -ltraceread
+LIBS += $(M_LIBS) $(POPT_LIBS) $(GLIB_LIBS) -lgobject-2.0 -L$(top_srcdir)/ltt -ltraceread
 
 bin_PROGRAMS = lttv
 
index 7b4dc2736313ff642b531a5e1db6e42320273354..ee0fec10a88df33cb8040058117a559fde0f5f5e 100644 (file)
@@ -24,7 +24,7 @@
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
 AM_CFLAGS += $(GTK_CFLAGS)
-LIBS += $(GLIB_LIBS)
+LIBS += $(M_LIBS) $(GLIB_LIBS)
 LIBS += $(GTK_LIBS) -L${top_srcdir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
@@ -33,6 +33,7 @@ lib_LTLIBRARIES = libguicontrolflow.la
 libguicontrolflow_la_LDFLAGS = -module
 libguicontrolflow_la_SOURCES =         module.c eventhooks.c cfv.c processlist.c\
                                drawing.c drawitem.c
+libguicontrolflow_la_LIBADD = -lm
 
 noinst_HEADERS =       eventhooks.h cfv.h processlist.h\
                                drawing.h drawitem.h
index f1ada9e77ba9856280c9b290169e2ad99a393be1..6648c9579e1229c30acd4e89ea28eb08d1fd59c8 100644 (file)
@@ -111,7 +111,6 @@ motion_notify_ruler(GtkWidget *widget, GdkEventMotion *event, gpointer user_data
  * erase drawing already present (SAFETY).
  */
 void drawing_data_request(Drawing_t *drawing,
-      GdkPixmap **pixmap,
       gint x, gint y,
       gint width,
       gint height)
@@ -466,6 +465,7 @@ void drawing_request_expose(EventsRequest *events_request,
 
   drawing->damage_begin = x+width;
 
+  // FIXME ?
   gtk_widget_queue_draw_area ( drawing->drawing_area,
                                x, 0,
                                width, drawing->drawing_area->allocation.height);
@@ -512,15 +512,17 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
     drawing->width = widget->allocation.width;
     
     if(drawing->alloc_width < widget->allocation.width) {
-      if(drawing->pixmap)
-        gdk_pixmap_unref(drawing->pixmap);
+      //if(drawing->pixmap)
+      //  gdk_pixmap_unref(drawing->pixmap);
 
-      drawing->pixmap = gdk_pixmap_new(widget->window,
-                                       drawing->width + SAFETY + EXTRA_ALLOC,
-                                       drawing->height + EXTRA_ALLOC,
-                                       -1);
+      //drawing->pixmap = gdk_pixmap_new(widget->window,
+      //                                 drawing->width + SAFETY + EXTRA_ALLOC,
+      //                                 drawing->height + EXTRA_ALLOC,
+      //                                 -1);
       drawing->alloc_width = drawing->width + SAFETY + EXTRA_ALLOC;
       drawing->alloc_height = drawing->height + EXTRA_ALLOC;
+      update_pixmap_size(drawing->control_flow_data->process_list,
+                         drawing->alloc_width);
     }
     //drawing->height = widget->allocation.height;
 
@@ -529,12 +531,12 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
     
 
     // Clear the image
-    gdk_draw_rectangle (drawing->pixmap,
-          widget->style->black_gc,
-          TRUE,
-          0, 0,
-          drawing->width+SAFETY,
-          drawing->height);
+    //gdk_draw_rectangle (drawing->pixmap,
+    //      widget->style->black_gc,
+    //      TRUE,
+    //      0, 0,
+    //      drawing->width+SAFETY,
+    //      drawing->height);
 
     //g_info("init data request");
 
@@ -553,10 +555,11 @@ configure_event( GtkWidget *widget, GdkEventConfigure *event,
     drawing->damage_begin = 0;
     drawing->damage_end = widget->allocation.width;
 
-    if(drawing->damage_begin < drawing->damage_end)
+    if((widget->allocation.width != 1 &&
+        widget->allocation.height != 1)
+        && drawing->damage_begin < drawing->damage_end)
     {
       drawing_data_request(drawing,
-                           &drawing->pixmap,
                            drawing->damage_begin,
                            0,
                            drawing->damage_end - drawing->damage_begin,
@@ -592,14 +595,23 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
   LttTime window_end = time_window.end_time;
 
   /* update the screen from the pixmap buffer */
+#if 0
   gdk_draw_pixmap(widget->window,
       widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
       drawing->pixmap,
       event->area.x, event->area.y,
       event->area.x, event->area.y,
       event->area.width, event->area.height);
-
+#endif //0
+  copy_pixmap_to_screen(control_flow_data->process_list,
+                        widget->window,
+                        widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+                        event->area.x, event->area.y,
+                        event->area.width, event->area.height);
+                        
+  
   /* Erase the dotted lines left.. */
+#if 0
   if(widget->allocation.height > drawing->height)
   {
     gdk_draw_rectangle (widget->window,
@@ -608,9 +620,8 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
       event->area.x, drawing->height,
       event->area.width,  // do not overlap
       widget->allocation.height - drawing->height);
-g_critical("blah : %u, %u", widget->allocation.height, drawing->height);
   }
-
+#endif //0
   if(ltt_time_compare(time_window.start_time, current_time) <= 0 &&
            ltt_time_compare(window_end, current_time) >= 0)
   {
@@ -825,7 +836,7 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data)
   //    drawing->height,
   //    drawing->depth);
   
-  drawing->pixmap = NULL;
+  //drawing->pixmap = NULL;
 
 //  drawing->pixmap = gdk_pixmap_new(drawing->drawing_area->window,
 //        drawing->drawing_area->allocation.width,
@@ -936,28 +947,37 @@ void drawing_draw_line( Drawing_t *drawing,
 
 void drawing_clear(Drawing_t *drawing)
 { 
-  if (drawing->pixmap)
-    gdk_pixmap_unref(drawing->pixmap);
+  //if (drawing->pixmap)
+  //  gdk_pixmap_unref(drawing->pixmap);
+  ControlFlowData *cfd = drawing->control_flow_data;
 
-  drawing->height = 1;
+  
+  rectangle_pixmap(cfd->process_list,
+      drawing->drawing_area->style->black_gc,
+      TRUE,
+      0, 0,
+      drawing->alloc_width,  // do not overlap
+      -1);
+  
+  //drawing->height = 1;
   /* Allocate a new pixmap with new height */
-  drawing->pixmap = gdk_pixmap_new(drawing->drawing_area->window,
-                                   drawing->width + SAFETY + EXTRA_ALLOC,
-                                   drawing->height + EXTRA_ALLOC,
-                                     -1);
-  drawing->alloc_width = drawing->width + SAFETY + EXTRA_ALLOC;
-  drawing->alloc_height = drawing->height + EXTRA_ALLOC;
-
-  gtk_widget_set_size_request(drawing->drawing_area,
-                             -1,
-                             drawing->height);
-  gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
+  //drawing->pixmap = gdk_pixmap_new(drawing->drawing_area->window,
+  //                                 drawing->width + SAFETY + EXTRA_ALLOC,
+  //                                 drawing->height + EXTRA_ALLOC,
+  //                                   -1);
+  //drawing->alloc_width = drawing->width + SAFETY + EXTRA_ALLOC;
+  //drawing->alloc_height = drawing->height + EXTRA_ALLOC;
+
+  //gtk_widget_set_size_request(drawing->drawing_area,
+  //                           -1,
+  //                           drawing->height);
+  //gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
   
   /* ask for the buffer to be redrawn */
   gtk_widget_queue_draw ( drawing->drawing_area);
 }
 
-
+#if 0
 /* Insert a square corresponding to a new process in the list */
 /* Applies to whole drawing->width */
 void drawing_insert_square(Drawing_t *drawing,
@@ -980,7 +1000,7 @@ void drawing_insert_square(Drawing_t *drawing,
     reallocate = TRUE;
 
     /* Copy the high region */
-    gdk_draw_drawable (new_pixmap,
+    gdk_draw_pixmap (new_pixmap,
       drawing->drawing_area->style->black_gc,
       drawing->pixmap,
       0, 0,
@@ -1005,7 +1025,7 @@ void drawing_insert_square(Drawing_t *drawing,
     height);
 
   /* copy the bottom of the region */
-  gdk_draw_drawable (new_pixmap,
+  gdk_draw_pixmap (new_pixmap,
     drawing->drawing_area->style->black_gc,
     drawing->pixmap,
     0, y,
@@ -1059,7 +1079,7 @@ void drawing_remove_square(Drawing_t *drawing,
     pixmap = drawing->pixmap;
    
     /* Copy the high region */
-    gdk_draw_drawable (pixmap,
+    gdk_draw_pixmap (pixmap,
       drawing->drawing_area->style->black_gc,
       drawing->pixmap,
       0, 0,
@@ -1067,7 +1087,7 @@ void drawing_remove_square(Drawing_t *drawing,
       drawing->width + SAFETY, y);
 
     /* Copy up the bottom of the region */
-    gdk_draw_drawable (pixmap,
+    gdk_draw_pixmap (pixmap,
       drawing->drawing_area->style->black_gc,
       drawing->pixmap,
       0, y + height,
@@ -1091,6 +1111,7 @@ void drawing_remove_square(Drawing_t *drawing,
                                0, y,
                                drawing->width, MAX(drawing->height-y, 1));
 }
+#endif //0
 
 void drawing_update_ruler(Drawing_t *drawing, TimeWindow *time_window)
 {
index fc60dcad9640771f7b86bc551ee3c20717694624..3cf84ab838ff4e8a92958849a8c3d8d751202fc4 100644 (file)
@@ -94,7 +94,7 @@ struct _Drawing_t {
   GtkWidget *ruler_hbox;
   GtkWidget *ruler;
   GtkWidget *padding;
-  GdkPixmap *pixmap;
+  //GdkPixmap *pixmap;
   ControlFlowData *control_flow_data;
   
   PangoLayout *pango_layout;
@@ -122,7 +122,6 @@ GtkWidget *drawing_get_drawing_area(Drawing_t *drawing);
 
 
 void drawing_data_request(Drawing_t *drawing,
-      GdkPixmap **pixmap,
       gint x, gint y,
       gint width,
       gint height);
index cdb7e14aad291e9b537c6b6b046dfa41146992bc..e3ce26461e57fb7320f0b5cea88bbd248cd3a03d 100644 (file)
@@ -419,7 +419,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
        * or add it, and draw its items.
        */
        /* Add process to process list (if not present) */
-      guint y = 0, height = 0, pl_height = 0;
+      guint pl_height = 0;
       HashedProcessData *hashed_process_data = NULL;
       ProcessList *process_list = control_flow_data->process_list;
       LttTime birth = process->creation_time;
@@ -435,7 +435,9 @@ int before_schedchange_hook(void *hook_data, void *call_data)
         const gchar *name = g_quark_to_string(process->name);
         /* Process not present */
         ProcessInfo *process_info;
+        Drawing_t *drawing = control_flow_data->drawing;
         processlist_add(process_list,
+            drawing,
             pid_out,
             process->last_cpu_index,
             process->ppid,
@@ -445,11 +447,11 @@ int before_schedchange_hook(void *hook_data, void *call_data)
             &pl_height,
             &process_info,
             &hashed_process_data);
-        processlist_get_pixels_from_data(process_list,
-                hashed_process_data,
-                &y,
-                &height);
-        drawing_insert_square( control_flow_data->drawing, y, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
+
       }
   
       /* Now, the process is in the state hash and our own process hash.
@@ -460,10 +462,6 @@ int before_schedchange_hook(void *hook_data, void *call_data)
                           evtime) > 0)
       {
         if(hashed_process_data->x.middle_marked == FALSE) {
-           processlist_get_pixels_from_data(process_list,
-                      hashed_process_data,
-                      &y,
-                      &height);
     
           TimeWindow time_window = 
             lttvwindow_get_time_window(control_flow_data->tab);
@@ -483,19 +481,13 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
           /* Draw collision indicator */
           gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-          gdk_draw_point(drawing->pixmap,
+          gdk_draw_point(hashed_process_data->pixmap,
                          drawing->gc,
                          x,
-                         y+(height/2)-3);
+                         (hashed_process_data->height/2)-3);
           hashed_process_data->x.middle_marked = TRUE;
         }
       } else {
-         processlist_get_pixels_from_data(process_list,
-                      hashed_process_data,
-                      &y,
-                      &height);
-
         TimeWindow time_window = 
           lttvwindow_get_time_window(control_flow_data->tab);
 #ifdef EXTRA_CHECK
@@ -520,10 +512,10 @@ int before_schedchange_hook(void *hook_data, void *call_data)
           if(hashed_process_data->x.middle_marked == FALSE) {
             /* Draw collision indicator */
             gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-            gdk_draw_point(drawing->pixmap,
+            gdk_draw_point(hashed_process_data->pixmap,
                            drawing->gc,
                            x,
-                           y+(height/2)-3);
+                           (hashed_process_data->height/2)-3);
             hashed_process_data->x.middle_marked = TRUE;
           }
           /* jump */
@@ -532,15 +524,15 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
           /* Now create the drawing context that will be used to draw
            * items related to the last state. */
-          draw_context.drawable = drawing->pixmap;
+          draw_context.drawable = hashed_process_data->pixmap;
           draw_context.gc = drawing->gc;
           draw_context.pango_layout = drawing->pango_layout;
           draw_context.drawinfo.start.x = hashed_process_data->x.middle;
           draw_context.drawinfo.end.x = x;
 
-          draw_context.drawinfo.y.over = y+1;
-          draw_context.drawinfo.y.middle = y+(height/2);
-          draw_context.drawinfo.y.under = y+height;
+          draw_context.drawinfo.y.over = 1;
+          draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
+          draw_context.drawinfo.y.under = hashed_process_data->height;
 
           draw_context.drawinfo.start.offset.over = 0;
           draw_context.drawinfo.start.offset.middle = 0;
@@ -583,7 +575,7 @@ int before_schedchange_hook(void *hook_data, void *call_data)
        * or add it, and draw its items.
        */
        /* Add process to process list (if not present) */
-      guint y = 0, height = 0, pl_height = 0;
+      guint pl_height = 0;
       HashedProcessData *hashed_process_data = NULL;
       ProcessList *process_list = control_flow_data->process_list;
       LttTime birth = process->creation_time;
@@ -599,7 +591,9 @@ int before_schedchange_hook(void *hook_data, void *call_data)
         const gchar *name = g_quark_to_string(process->name);
         /* Process not present */
         ProcessInfo *process_info;
+        Drawing_t *drawing = control_flow_data->drawing;
         processlist_add(process_list,
+            drawing,
             pid_in,
             process->last_cpu_index,
             process->ppid,
@@ -609,11 +603,11 @@ int before_schedchange_hook(void *hook_data, void *call_data)
             &pl_height,
             &process_info,
             &hashed_process_data);
-        processlist_get_pixels_from_data(process_list,
-                hashed_process_data,
-                &y,
-                &height);
-        drawing_insert_square( control_flow_data->drawing, y, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
+
       }
       //We could set the current process and hash here, but will be done
       //by after schedchange hook
@@ -627,10 +621,6 @@ int before_schedchange_hook(void *hook_data, void *call_data)
       {
         if(hashed_process_data->x.middle_marked == FALSE) {
 
-          processlist_get_pixels_from_data(process_list,
-                  hashed_process_data,
-                  &y,
-                  &height);
           TimeWindow time_window = 
             lttvwindow_get_time_window(control_flow_data->tab);
 #ifdef EXTRA_CHECK
@@ -649,17 +639,13 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
           /* Draw collision indicator */
           gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-          gdk_draw_point(drawing->pixmap,
+          gdk_draw_point(hashed_process_data->pixmap,
                          drawing->gc,
                          x,
-                         y+(height/2)-3);
+                         (hashed_process_data->height/2)-3);
           hashed_process_data->x.middle_marked = TRUE;
         }
       } else {
-        processlist_get_pixels_from_data(process_list,
-                hashed_process_data,
-                &y,
-                &height);
         TimeWindow time_window = 
           lttvwindow_get_time_window(control_flow_data->tab);
 #ifdef EXTRA_CHECK
@@ -685,10 +671,10 @@ int before_schedchange_hook(void *hook_data, void *call_data)
           if(hashed_process_data->x.middle_marked == FALSE) {
             /* Draw collision indicator */
             gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-            gdk_draw_point(drawing->pixmap,
+            gdk_draw_point(hashed_process_data->pixmap,
                            drawing->gc,
                            x,
-                           y+(height/2)-3);
+                           (hashed_process_data->height/2)-3);
             hashed_process_data->x.middle_marked = TRUE;
           }
           /* jump */
@@ -697,15 +683,15 @@ int before_schedchange_hook(void *hook_data, void *call_data)
 
           /* Now create the drawing context that will be used to draw
            * items related to the last state. */
-          draw_context.drawable = drawing->pixmap;
+          draw_context.drawable = hashed_process_data->pixmap;
           draw_context.gc = drawing->gc;
           draw_context.pango_layout = drawing->pango_layout;
           draw_context.drawinfo.start.x = hashed_process_data->x.middle;
           draw_context.drawinfo.end.x = x;
 
-          draw_context.drawinfo.y.over = y+1;
-          draw_context.drawinfo.y.middle = y+(height/2);
-          draw_context.drawinfo.y.under = y+height;
+          draw_context.drawinfo.y.over = 1;
+          draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
+          draw_context.drawinfo.y.under = hashed_process_data->height;
 
           draw_context.drawinfo.start.offset.over = 0;
           draw_context.drawinfo.start.offset.middle = 0;
@@ -1371,7 +1357,7 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   /* Add process to process list (if not present) */
   LttvProcessState *process_in;
   LttTime birth;
-  guint y_in = 0, height = 0, pl_height = 0;
+  guint pl_height = 0;
   HashedProcessData *hashed_process_data_in = NULL;
 
   ProcessList *process_list = control_flow_data->process_list;
@@ -1407,8 +1393,10 @@ int after_schedchange_hook(void *hook_data, void *call_data)
     g_assert(pid_in == 0 || pid_in != process_in->ppid);
     const gchar *name = g_quark_to_string(process_in->name);
     ProcessInfo *process_info;
+    Drawing_t *drawing = control_flow_data->drawing;
     /* Process not present */
     processlist_add(process_list,
+        drawing,
         pid_in,
         process_in->last_cpu_index,
         process_in->ppid,
@@ -1418,11 +1406,10 @@ int after_schedchange_hook(void *hook_data, void *call_data)
         &pl_height,
         &process_info,
         &hashed_process_data_in);
-    processlist_get_pixels_from_data(process_list,
-                hashed_process_data_in,
-                &y_in,
-                &height);
-    drawing_insert_square( control_flow_data->drawing, y_in, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
   }
   /* Set the current process */
   process_list->current_hash_data[process_in->last_cpu_index] =
@@ -1431,10 +1418,6 @@ int after_schedchange_hook(void *hook_data, void *call_data)
   if(ltt_time_compare(hashed_process_data_in->next_good_time,
                           evtime) <= 0)
   {
-    processlist_get_pixels_from_data(process_list,
-                hashed_process_data_in,
-                &y_in,
-                &height);
     TimeWindow time_window = 
     lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -1995,7 +1978,7 @@ int before_execmode_hook(void *hook_data, void *call_data)
    * or add it, and draw its items.
    */
    /* Add process to process list (if not present) */
-  guint y = 0, height = 0, pl_height = 0;
+  guint pl_height = 0;
   HashedProcessData *hashed_process_data = NULL;
   ProcessList *process_list = control_flow_data->process_list;
   LttTime birth = process->creation_time;
@@ -2013,8 +1996,10 @@ int before_execmode_hook(void *hook_data, void *call_data)
       g_assert(pid == 0 || pid != process->ppid);
       ProcessInfo *process_info;
       /* Process not present */
+      Drawing_t *drawing = control_flow_data->drawing;
       const gchar *name = g_quark_to_string(process->name);
       processlist_add(process_list,
+          drawing,
           pid,
           process->last_cpu_index,
           process->ppid,
@@ -2024,11 +2009,10 @@ int before_execmode_hook(void *hook_data, void *call_data)
           &pl_height,
           &process_info,
           &hashed_process_data);
-      processlist_get_pixels_from_data(process_list,
-                  hashed_process_data,
-                  &y,
-                  &height);
-      drawing_insert_square( control_flow_data->drawing, y, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
     }
     /* Set the current process */
     process_list->current_hash_data[process->last_cpu_index] =
@@ -2043,10 +2027,6 @@ int before_execmode_hook(void *hook_data, void *call_data)
                       evtime) > 0))
   {
     if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
-      processlist_get_pixels_from_data(process_list,
-                  hashed_process_data,
-                  &y,
-                  &height);
       TimeWindow time_window = 
         lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -2066,17 +2046,13 @@ int before_execmode_hook(void *hook_data, void *call_data)
 
       /* Draw collision indicator */
       gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-      gdk_draw_point(drawing->pixmap,
+      gdk_draw_point(hashed_process_data->pixmap,
                      drawing->gc,
                      x,
-                     y+(height/2)-3);
+                     (hashed_process_data->height/2)-3);
       hashed_process_data->x.middle_marked = TRUE;
     }
   } else {
-    processlist_get_pixels_from_data(process_list,
-                hashed_process_data,
-                &y,
-                &height);
     TimeWindow time_window = 
       lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -2103,10 +2079,10 @@ int before_execmode_hook(void *hook_data, void *call_data)
       if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
         /* Draw collision indicator */
         gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-        gdk_draw_point(drawing->pixmap,
+        gdk_draw_point(hashed_process_data->pixmap,
                        drawing->gc,
                        x,
-                       y+(height/2)-3);
+                       (hashed_process_data->height/2)-3);
         hashed_process_data->x.middle_marked = TRUE;
       }
       /* jump */
@@ -2115,15 +2091,15 @@ int before_execmode_hook(void *hook_data, void *call_data)
       DrawContext draw_context;
       /* Now create the drawing context that will be used to draw
        * items related to the last state. */
-      draw_context.drawable = drawing->pixmap;
+      draw_context.drawable = hashed_process_data->pixmap;
       draw_context.gc = drawing->gc;
       draw_context.pango_layout = drawing->pango_layout;
       draw_context.drawinfo.start.x = hashed_process_data->x.middle;
       draw_context.drawinfo.end.x = x;
 
-      draw_context.drawinfo.y.over = y+1;
-      draw_context.drawinfo.y.middle = y+(height/2);
-      draw_context.drawinfo.y.under = y+height;
+      draw_context.drawinfo.y.over = 1;
+      draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
+      draw_context.drawinfo.y.under = hashed_process_data->height;
 
       draw_context.drawinfo.start.offset.over = 0;
       draw_context.drawinfo.start.offset.middle = 0;
@@ -2185,7 +2161,7 @@ int after_execmode_hook(void *hook_data, void *call_data)
   /* Add process to process list (if not present) */
   LttvProcessState *process;
   LttTime birth;
-  guint y = 0, height = 0, pl_height = 0;
+  guint pl_height = 0;
   HashedProcessData *hashed_process_data = NULL;
 
   ProcessList *process_list = control_flow_data->process_list;
@@ -2211,9 +2187,11 @@ int after_execmode_hook(void *hook_data, void *call_data)
     {
       g_assert(pid == 0 || pid != process->ppid);
       /* Process not present */
+      Drawing_t *drawing = control_flow_data->drawing;
       const gchar *name = g_quark_to_string(process->name);
       ProcessInfo *process_info;
       processlist_add(process_list,
+          drawing,
           pid,
           process->last_cpu_index,
           process->ppid,
@@ -2223,11 +2201,10 @@ int after_execmode_hook(void *hook_data, void *call_data)
           &pl_height,
           &process_info,
           &hashed_process_data);
-      processlist_get_pixels_from_data(process_list,
-                  hashed_process_data,
-                  &y,
-                  &height);
-      drawing_insert_square( control_flow_data->drawing, y, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
     }
     /* Set the current process */
     process_list->current_hash_data[process->last_cpu_index] =
@@ -2237,12 +2214,6 @@ int after_execmode_hook(void *hook_data, void *call_data)
   if(unlikely(ltt_time_compare(hashed_process_data->next_good_time,
                           evtime) <= 0))
   {
-#if 0
-    processlist_get_pixels_from_data(process_list,
-                hashed_process_data,
-                &y,
-                &height);
-#endif //0
     TimeWindow time_window = 
       lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -2310,7 +2281,7 @@ int before_process_hook(void *hook_data, void *call_data)
     LttvProcessState *process = tfs->process;
     guint pid = process->pid;
     LttTime birth;
-    guint y = 0, height = 0, pl_height = 0;
+    guint pl_height = 0;
     HashedProcessData *hashed_process_data = NULL;
 
     ProcessList *process_list = control_flow_data->process_list;
@@ -2331,9 +2302,11 @@ int before_process_hook(void *hook_data, void *call_data)
       {
         g_assert(pid == 0 || pid != process->ppid);
         /* Process not present */
+        Drawing_t *drawing = control_flow_data->drawing;
         const gchar *name = g_quark_to_string(process->name);
         ProcessInfo *process_info;
         processlist_add(process_list,
+            drawing,
             pid,
             process->last_cpu_index,
             process->ppid,
@@ -2343,11 +2316,10 @@ int before_process_hook(void *hook_data, void *call_data)
             &pl_height,
             &process_info,
             &hashed_process_data);
-        processlist_get_pixels_from_data(process_list,
-                  hashed_process_data,
-                  &y,
-                  &height);
-        drawing_insert_square( control_flow_data->drawing, y, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
       }
     }
 
@@ -2359,10 +2331,6 @@ int before_process_hook(void *hook_data, void *call_data)
                         evtime) > 0))
     {
       if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
-        processlist_get_pixels_from_data(process_list,
-                  hashed_process_data,
-                  &y,
-                  &height);
         TimeWindow time_window = 
           lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -2382,17 +2350,13 @@ int before_process_hook(void *hook_data, void *call_data)
 
         /* Draw collision indicator */
         gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-        gdk_draw_point(drawing->pixmap,
+        gdk_draw_point(hashed_process_data->pixmap,
                        drawing->gc,
                        x,
-                       y+(height/2)-3);
+                       (hashed_process_data->height/2)-3);
         hashed_process_data->x.middle_marked = TRUE;
       }
     } else {
-      processlist_get_pixels_from_data(process_list,
-                hashed_process_data,
-                &y,
-                &height);
       TimeWindow time_window = 
         lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -2419,10 +2383,10 @@ int before_process_hook(void *hook_data, void *call_data)
         if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
           /* Draw collision indicator */
           gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
-          gdk_draw_point(drawing->pixmap,
+          gdk_draw_point(hashed_process_data->pixmap,
                          drawing->gc,
                          x,
-                         y+(height/2)-3);
+                         (hashed_process_data->height/2)-3);
           hashed_process_data->x.middle_marked = TRUE;
         }
         /* jump */
@@ -2431,15 +2395,15 @@ int before_process_hook(void *hook_data, void *call_data)
 
         /* Now create the drawing context that will be used to draw
          * items related to the last state. */
-        draw_context.drawable = drawing->pixmap;
+        draw_context.drawable = hashed_process_data->pixmap;
         draw_context.gc = drawing->gc;
         draw_context.pango_layout = drawing->pango_layout;
         draw_context.drawinfo.start.x = hashed_process_data->x.middle;
         draw_context.drawinfo.end.x = x;
 
-        draw_context.drawinfo.y.over = y+1;
-        draw_context.drawinfo.y.middle = y+(height/2);
-        draw_context.drawinfo.y.under = y+height;
+        draw_context.drawinfo.y.over = 1;
+        draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
+        draw_context.drawinfo.y.under = hashed_process_data->height;
 
         draw_context.drawinfo.start.offset.over = 0;
         draw_context.drawinfo.start.offset.middle = 0;
@@ -2517,7 +2481,7 @@ int after_process_hook(void *hook_data, void *call_data)
     /* Add process to process list (if not present) */
     LttvProcessState *process_child;
     LttTime birth;
-    guint y_child = 0, height = 0, pl_height = 0;
+    guint pl_height = 0;
     HashedProcessData *hashed_process_data_child = NULL;
 
     ProcessList *process_list = control_flow_data->process_list;
@@ -2538,9 +2502,11 @@ int after_process_hook(void *hook_data, void *call_data)
     {
       g_assert(child_pid == 0 || child_pid != process_child->ppid);
       /* Process not present */
+      Drawing_t *drawing = control_flow_data->drawing;
       const gchar *name = g_quark_to_string(process_child->name);
       ProcessInfo *process_info;
       processlist_add(process_list,
+          drawing,
           child_pid,
           process_child->last_cpu_index,
           process_child->ppid,
@@ -2550,23 +2516,16 @@ int after_process_hook(void *hook_data, void *call_data)
           &pl_height,
           &process_info,
           &hashed_process_data_child);
-      processlist_get_pixels_from_data(process_list,
-                hashed_process_data_child,
-                &y_child,
-                &height);
-      drawing_insert_square( control_flow_data->drawing, y_child, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
     }
 
 
     if(likely(ltt_time_compare(hashed_process_data_child->next_good_time,
                           evtime) <= 0))
     {
-#if 0
-      processlist_get_pixels_from_data(process_list,
-                hashed_process_data_child,
-                &y_child,
-                &height);
-#endif //0
       TimeWindow time_window = 
         lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -2607,7 +2566,7 @@ int after_process_hook(void *hook_data, void *call_data)
     LttvProcessState *process = tfs->process;
     guint pid = process->pid;
     LttTime birth;
-    guint y = 0, height = 0, pl_height = 0;
+    guint pl_height = 0;
     HashedProcessData *hashed_process_data = NULL;
 
     ProcessList *process_list = control_flow_data->process_list;
@@ -2629,9 +2588,11 @@ int after_process_hook(void *hook_data, void *call_data)
       {
         g_assert(pid == 0 || pid != process->ppid);
         /* Process not present */
+        Drawing_t *drawing = control_flow_data->drawing;
         const gchar *name = g_quark_to_string(process->name);
         ProcessInfo *process_info;
         processlist_add(process_list,
+            drawing,
             pid,
             process->last_cpu_index,
             process->ppid,
@@ -2641,11 +2602,10 @@ int after_process_hook(void *hook_data, void *call_data)
             &pl_height,
             &process_info,
             &hashed_process_data);
-        processlist_get_pixels_from_data(process_list,
-                  hashed_process_data,
-                  &y,
-                  &height);
-        drawing_insert_square( control_flow_data->drawing, y, height);
+        gtk_widget_set_size_request(drawing->drawing_area,
+                                    -1,
+                                    pl_height);
+        gtk_widget_queue_draw(drawing->drawing_area);
       }
 
       /* Set the current process */
@@ -2656,12 +2616,6 @@ int after_process_hook(void *hook_data, void *call_data)
     if(unlikely(ltt_time_compare(hashed_process_data->next_good_time,
                           evtime) <= 0))
     {
-#if 0
-      processlist_get_pixels_from_data(process_list,
-                hashed_process_data,
-                &y,
-                &height);
-#endif //0
       TimeWindow time_window = 
         lttvwindow_get_time_window(control_flow_data->tab);
 
@@ -2695,6 +2649,7 @@ gint update_time_window_hook(void *hook_data, void *call_data)
 {
   ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
   Drawing_t *drawing = control_flow_data->drawing;
+  ProcessList *process_list = control_flow_data->process_list;
 
   const TimeWindowNotifyData *time_window_nofify_data = 
                           ((const TimeWindowNotifyData *)call_data);
@@ -2756,13 +2711,14 @@ gint update_time_window_hook(void *hook_data, void *call_data)
           &x);
 
       /* Copy old data to new location */
-      gdk_draw_drawable (control_flow_data->drawing->pixmap,
-          control_flow_data->drawing->drawing_area->style->black_gc,
-          control_flow_data->drawing->pixmap,
-          x, 0,
-          0, 0,
-         control_flow_data->drawing->width-x+SAFETY, -1);
+      copy_pixmap_region(process_list,
+                  NULL,
+                  control_flow_data->drawing->drawing_area->style->black_gc,
+                  NULL,
+                  x, 0,
+                  0, 0,
+                  control_flow_data->drawing->width-x+SAFETY, -1);
+
       if(drawing->damage_begin == drawing->damage_end)
         drawing->damage_begin = control_flow_data->drawing->width-x;
       else
@@ -2771,13 +2727,12 @@ gint update_time_window_hook(void *hook_data, void *call_data)
       drawing->damage_end = control_flow_data->drawing->width;
 
       /* Clear the data request background, but not SAFETY */
-      gdk_draw_rectangle (control_flow_data->drawing->pixmap,
-          //control_flow_data->drawing->drawing_area->style->black_gc,
+      rectangle_pixmap(process_list,
           control_flow_data->drawing->drawing_area->style->black_gc,
           TRUE,
           drawing->damage_begin+SAFETY, 0,
           drawing->damage_end - drawing->damage_begin,  // do not overlap
-          control_flow_data->drawing->height);
+          -1);
       gtk_widget_queue_draw(drawing->drawing_area);
       //gtk_widget_queue_draw_area (drawing->drawing_area,
       //                          0,0,
@@ -2786,7 +2741,6 @@ gint update_time_window_hook(void *hook_data, void *call_data)
 
       /* Get new data for the rest. */
       drawing_data_request(control_flow_data->drawing,
-          &control_flow_data->drawing->pixmap,
           drawing->damage_begin, 0,
           drawing->damage_end - drawing->damage_begin,
           control_flow_data->drawing->height);
@@ -2807,11 +2761,11 @@ gint update_time_window_hook(void *hook_data, void *call_data)
             width,
             &x);
         
-
         /* Copy old data to new location */
-        gdk_draw_drawable (control_flow_data->drawing->pixmap,
+        copy_pixmap_region  (process_list,
+            NULL,
             control_flow_data->drawing->drawing_area->style->black_gc,
-            control_flow_data->drawing->pixmap,
+            NULL,
             0, 0,
             x, 0,
             -1, -1);
@@ -2824,12 +2778,12 @@ gint update_time_window_hook(void *hook_data, void *call_data)
 
         drawing->damage_begin = 0;
         
-        gdk_draw_rectangle (control_flow_data->drawing->pixmap,
+        rectangle_pixmap (process_list,
           control_flow_data->drawing->drawing_area->style->black_gc,
           TRUE,
           drawing->damage_begin, 0,
           drawing->damage_end - drawing->damage_begin,  // do not overlap
-          control_flow_data->drawing->height);
+          -1);
 
         gtk_widget_queue_draw(drawing->drawing_area);
         //gtk_widget_queue_draw_area (drawing->drawing_area,
@@ -2840,7 +2794,6 @@ gint update_time_window_hook(void *hook_data, void *call_data)
 
         /* Get new data for the rest. */
         drawing_data_request(control_flow_data->drawing,
-            &control_flow_data->drawing->pixmap,
             drawing->damage_begin, 0,
             drawing->damage_end - drawing->damage_begin,
             control_flow_data->drawing->height);
@@ -2854,12 +2807,12 @@ gint update_time_window_hook(void *hook_data, void *call_data)
           /* Cannot reuse any part of the screen : far jump */
           
           
-          gdk_draw_rectangle (control_flow_data->drawing->pixmap,
+          rectangle_pixmap (process_list,
             control_flow_data->drawing->drawing_area->style->black_gc,
             TRUE,
             0, 0,
             control_flow_data->drawing->width+SAFETY, // do not overlap
-            control_flow_data->drawing->height);
+            -1);
 
           //gtk_widget_queue_draw_area (drawing->drawing_area,
           //                      0,0,
@@ -2871,7 +2824,6 @@ gint update_time_window_hook(void *hook_data, void *call_data)
           drawing->damage_end = control_flow_data->drawing->width;
 
           drawing_data_request(control_flow_data->drawing,
-              &control_flow_data->drawing->pixmap,
               0, 0,
               control_flow_data->drawing->width,
               control_flow_data->drawing->height);
@@ -2883,12 +2835,12 @@ gint update_time_window_hook(void *hook_data, void *call_data)
     /* Different scale (zoom) */
     g_info("zoom");
 
-    gdk_draw_rectangle (control_flow_data->drawing->pixmap,
+    rectangle_pixmap (process_list,
           control_flow_data->drawing->drawing_area->style->black_gc,
           TRUE,
           0, 0,
           control_flow_data->drawing->width+SAFETY, // do not overlap
-          control_flow_data->drawing->height);
+          -1);
 
     //gtk_widget_queue_draw_area (drawing->drawing_area,
     //                            0,0,
@@ -2900,7 +2852,6 @@ gint update_time_window_hook(void *hook_data, void *call_data)
     drawing->damage_end = control_flow_data->drawing->width;
 
     drawing_data_request(control_flow_data->drawing,
-        &control_flow_data->drawing->pixmap,
         0, 0,
         control_flow_data->drawing->width,
         control_flow_data->drawing->height);
@@ -2939,19 +2890,18 @@ gint redraw_notify(void *hook_data, void *call_data)
   drawing_clear(control_flow_data->drawing);
   processlist_clear(control_flow_data->process_list);
 
-  // Clear the image
-  gdk_draw_rectangle (drawing->pixmap,
+  // Clear the images
+  rectangle_pixmap (control_flow_data->process_list,
         widget->style->black_gc,
         TRUE,
         0, 0,
         drawing->width+SAFETY,
-        drawing->height);
+        -1);
 
 
   if(drawing->damage_begin < drawing->damage_end)
   {
     drawing_data_request(drawing,
-                         &drawing->pixmap,
                          drawing->damage_begin,
                          0,
                          drawing->damage_end-drawing->damage_begin,
@@ -2978,7 +2928,6 @@ gint continue_notify(void *hook_data, void *call_data)
   if(drawing->damage_begin < drawing->damage_end)
   {
     drawing_data_request(drawing,
-                         &drawing->pixmap,
                          drawing->damage_begin,
                          0,
                          drawing->damage_end-drawing->damage_begin,
@@ -3115,7 +3064,6 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
       
       /* Only draw for processes that are currently in the trace states */
 
-      guint y = 0, height = 0;
       ProcessList *process_list = control_flow_data->process_list;
 #ifdef EXTRA_CHECK
       /* Should be alike when background info is ready */
@@ -3123,11 +3071,6 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
         g_assert(ltt_time_compare(process->creation_time,
                                   process_info->birth) == 0);
 #endif //EXTRA_CHECK
-      /* process HAS to be present */
-      processlist_get_pixels_from_data(process_list,
-              hashed_process_data,
-              &y,
-              &height);
     
       /* Now, the process is in the state hash and our own process hash.
        * We definitely can draw the items related to the ending state.
@@ -3153,14 +3096,14 @@ void draw_closure(gpointer key, gpointer value, gpointer user_data)
 
         /* Now create the drawing context that will be used to draw
          * items related to the last state. */
-        draw_context.drawable = drawing->pixmap;
+        draw_context.drawable = hashed_process_data->pixmap;
         draw_context.gc = drawing->gc;
         draw_context.pango_layout = drawing->pango_layout;
         draw_context.drawinfo.end.x = x;
 
-        draw_context.drawinfo.y.over = y+1;
-        draw_context.drawinfo.y.middle = y+(height/2);
-        draw_context.drawinfo.y.under = y+height;
+        draw_context.drawinfo.y.over = 1;
+        draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
+        draw_context.drawinfo.y.under = hashed_process_data->height;
 
         draw_context.drawinfo.start.offset.over = 0;
         draw_context.drawinfo.start.offset.middle = 0;
index a482927c7ae0230c71157cb6bf99ece3065e5530..59c0f0b362885e3ff364333db30d9cad69875d74 100644 (file)
 #include <glib.h>
 #include <string.h>
 #include <stdlib.h>
+#include <math.h>
 
 #include "processlist.h"
+#include "drawing.h"
 #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
 
 /*****************************************************************************
  *                       Methods to synchronize process list                 *
@@ -264,6 +268,174 @@ void destroy_hash_key(gpointer key);
 void destroy_hash_data(gpointer data);
 
 
+static void update_index_to_pixmap_each(ProcessInfo *key,
+                                        HashedProcessData *value,
+                                        ProcessList *process_list)
+{
+  guint array_index = processlist_get_index_from_data(process_list, value);
+  
+  g_assert(array_index < process_list->index_to_pixmap->len);
+
+  GdkPixmap **pixmap = 
+    (GdkPixmap**)&g_ptr_array_index(process_list->index_to_pixmap, array_index);
+
+  *pixmap = value->pixmap;
+}
+
+
+static void update_index_to_pixmap(ProcessList *process_list)
+{
+  g_ptr_array_set_size(process_list->index_to_pixmap,
+                       g_hash_table_size(process_list->process_hash));
+  g_hash_table_foreach(process_list->process_hash, 
+                       (GHFunc)update_index_to_pixmap_each,
+                       process_list);
+}
+
+
+static void update_pixmap_size_each(ProcessInfo *key,
+                                    HashedProcessData *value,
+                                    guint width)
+{
+  GdkPixmap *old_pixmap = value->pixmap;
+
+  value->pixmap = 
+        gdk_pixmap_new(old_pixmap,
+                       width,
+                       value->height,
+                       -1);
+
+  gdk_pixmap_unref(old_pixmap);
+}
+
+
+void update_pixmap_size(ProcessList *process_list, guint width)
+{
+  g_hash_table_foreach(process_list->process_hash, 
+                       (GHFunc)update_pixmap_size_each,
+                       (gpointer)width);
+}
+
+
+typedef struct _CopyPixmap {
+  GdkDrawable *dest;
+  GdkGC *gc;
+  GdkDrawable *src;
+  gint xsrc, ysrc, xdest, ydest, width, height;
+} CopyPixmap;
+
+static void copy_pixmap_region_each(ProcessInfo *key,
+                                    HashedProcessData *value,
+                                    CopyPixmap *cp)
+{
+  GdkPixmap *src = cp->src;
+  GdkPixmap *dest = cp->dest;
+  
+  if(dest == NULL)
+    dest = value->pixmap;
+  if(src == NULL)
+    src = value->pixmap;
+
+  gdk_draw_drawable (dest,
+      cp->gc,
+      src,
+      cp->xsrc, cp->ysrc,
+      cp->xdest, cp->ydest,
+      cp->width, cp->height);
+}
+
+
+
+
+void copy_pixmap_region(ProcessList *process_list, GdkDrawable *dest,
+    GdkGC *gc, GdkDrawable *src,
+    gint xsrc, gint ysrc,
+    gint xdest, gint ydest, gint width, gint height)
+{
+  CopyPixmap cp = { dest, gc, src, xsrc, ysrc, xdest, ydest, width, height };
+  
+  g_hash_table_foreach(process_list->process_hash, 
+                       (GHFunc)copy_pixmap_region_each,
+                       &cp);
+}
+
+
+
+typedef struct _RectanglePixmap {
+  gboolean filled;
+  gint x, y, width, height;
+  GdkGC *gc;
+} RectanglePixmap;
+
+static void rectangle_pixmap_each(ProcessInfo *key,
+                                  HashedProcessData *value,
+                                  RectanglePixmap *rp)
+{
+  if(rp->height == -1)
+    rp->height = value->height;
+      
+  gdk_draw_rectangle (value->pixmap,
+      rp->gc,
+      rp->filled,
+      rp->x, rp->y,
+      rp->width, rp->height);
+}
+
+
+
+
+void rectangle_pixmap(ProcessList *process_list, GdkGC *gc,
+    gboolean filled, gint x, gint y, gint width, gint height)
+{
+  RectanglePixmap rp = { filled, x, y, width, height, gc };
+  
+  g_hash_table_foreach(process_list->process_hash, 
+                       (GHFunc)rectangle_pixmap_each,
+                       &rp);
+}
+
+
+/* Renders each pixmaps into on big drawable */
+void copy_pixmap_to_screen(ProcessList *process_list,
+    GdkDrawable *dest,
+    GdkGC *gc,
+    gint x, gint y,
+    gint width, gint height)
+{
+  gint cell_height = 
+     get_cell_height(process_list, 
+                     (GtkTreeView*)process_list->process_list_widget);
+  cell_height = 24; //FIXME
+  /* Get indexes */
+  gint begin = floor(y/(double)cell_height);
+  gint end = MIN(ceil((y+height)/(double)cell_height),
+                 process_list->index_to_pixmap->len);
+  gint i;
+  g_warning("begin : %i, end : %i", begin,end);
+  for(i=begin; i<end; i++) {
+    g_assert(i<process_list->index_to_pixmap->len);
+    /* Render the pixmap to the screen */
+    GdkPixmap *pixmap = 
+      (GdkPixmap*)g_ptr_array_index(process_list->index_to_pixmap, i);
+
+    gdk_draw_drawable (dest,
+        gc,
+        pixmap,
+        x, 0,
+        x, i*cell_height,
+        width, cell_height);
+
+  }
+  
+  
+}
+
+
+
+
+
+
+
 
 
 ProcessList *processlist_construct(void)
@@ -274,7 +446,6 @@ ProcessList *processlist_construct(void)
   ProcessList* process_list = g_new(ProcessList,1);
   
   process_list->number_of_process = 0;
-  process_list->cell_height_cache = -1;
 
   process_list->current_hash_data = NULL;
 
@@ -390,6 +561,8 @@ ProcessList *processlist_construct(void)
       process_list,
       (GDestroyNotify)processlist_destroy);
 
+  process_list->index_to_pixmap = g_ptr_array_sized_new(ALLOCATE_PROCESSES);
+  
   return process_list;
 }
 
@@ -398,6 +571,7 @@ void processlist_destroy(ProcessList *process_list)
   g_debug("processlist_destroy %p", process_list);
   g_hash_table_destroy(process_list->process_hash);
   process_list->process_hash = NULL;
+  g_ptr_array_free(process_list->index_to_pixmap, TRUE);
 
   g_free(process_list);
   g_debug("processlist_destroy end");
@@ -412,6 +586,7 @@ static gboolean remove_hash_item(ProcessInfo *process_info,
   iter = hashed_process_data->y_iter;
 
   gtk_list_store_remove (process_list->list_store, &iter);
+  gdk_pixmap_unref(hashed_process_data->pixmap);
 
   if(likely(process_list->current_hash_data != NULL)) {
     if(likely(hashed_process_data ==
@@ -429,6 +604,7 @@ void processlist_clear(ProcessList *process_list)
                               (GHRFunc)remove_hash_item,
                               (gpointer)process_list);
   process_list->number_of_process = 0;
+  update_index_to_pixmap(process_list);
 }
 
 
@@ -449,6 +625,7 @@ void destroy_hash_data(gpointer data)
 }
 
 int processlist_add(  ProcessList *process_list,
+      Drawing_t *drawing,
       guint pid,
       guint cpu,
       guint ppid,
@@ -489,7 +666,7 @@ int processlist_add(  ProcessList *process_list,
   hashed_process_data->x.under_used = FALSE;
   hashed_process_data->x.under_marked = FALSE;
   hashed_process_data->next_good_time = ltt_time_zero;
-  
   /* Add a new row to the model */
   gtk_list_store_append ( process_list->list_store,
                           &hashed_process_data->y_iter);
@@ -503,27 +680,37 @@ int processlist_add(  ProcessList *process_list,
         BIRTH_NS_COLUMN, birth->tv_nsec,
         TRACE_COLUMN, trace_num,
         -1);
-#if 0
-  hashed_process_data->row_ref = gtk_tree_row_reference_new (
-      GTK_TREE_MODEL(process_list->list_store),
-      gtk_tree_model_get_path(
-        GTK_TREE_MODEL(process_list->list_store),
-        &iter));
-#endif //0
+
   g_hash_table_insert(process_list->process_hash,
         (gpointer)Process_Info,
         (gpointer)hashed_process_data);
   
-  //g_critical ( "iter after : %s", gtk_tree_path_to_string (
-  //    gtk_tree_model_get_path (
-  //        GTK_TREE_MODEL(process_list->list_store),
-  //        &iter)));
   process_list->number_of_process++;
 
-  *height = get_cell_height(process_list,
-                            GTK_TREE_VIEW(process_list->process_list_widget))
-        * process_list->number_of_process ;
+  hashed_process_data->height = get_cell_height(process_list,
+                        (GtkTreeView*)process_list->process_list_widget);
+  hashed_process_data->height = 24; // FIXME
+  g_assert(hashed_process_data->height != 0);
+
+  *height = hashed_process_data->height * process_list->number_of_process;
+
+  hashed_process_data->pixmap = 
+        gdk_pixmap_new(drawing->drawing_area->window,
+                       drawing->alloc_width,
+                       hashed_process_data->height,
+                       -1);
   
+  // Clear the image
+  gdk_draw_rectangle (hashed_process_data->pixmap,
+        drawing->drawing_area->style->black_gc,
+        TRUE,
+        0, 0,
+        drawing->alloc_width,
+        hashed_process_data->height);
+
+  update_index_to_pixmap(process_list);
+
+
   return 0;
 }
 
@@ -564,6 +751,11 @@ int processlist_remove( ProcessList *process_list,
         process_list->current_hash_data[cpu] = NULL;
       }
     }
+    
+    gdk_pixmap_unref(hashed_process_data->pixmap);
+    
+    update_index_to_pixmap(process_list);
+
     process_list->number_of_process--;
 
     return 0; 
index 03da021d79015711b7c1dcb1ab35ce18b6b0fe43..c8d5a9fa9a8985c439fbe3b41ec980696b6a782b 100644 (file)
@@ -54,7 +54,9 @@ typedef struct _ProcessInfo {
 } ProcessInfo;
 
 typedef struct _HashedProcessData {
-  
+  GdkPixmap *pixmap;  // Pixmap slice containing drawing buffer for the PID
+  gint height; // height of the pixmap
   GtkTreeIter y_iter; // Access quickly to y pos.
  // DrawContext *draw_context;
   /* Information on current drawing */
@@ -91,11 +93,21 @@ struct _ProcessList {
   /* Current process, one per cpu */
   HashedProcessData **current_hash_data;
 
+  /* Array containing index -> pixmap correspondance. Must be updated
+   * every time the process list is reordered, process added or removed */
+  GPtrArray * index_to_pixmap;
+
 };
 
 
 typedef struct _ProcessList ProcessList;
 
+
+#ifndef TYPE_DRAWING_T_DEFINED
+#define TYPE_DRAWING_T_DEFINED
+typedef struct _Drawing_t Drawing_t;
+#endif //TYPE_DRAWING_T_DEFINED
+
 ProcessList *processlist_construct(void);
 void processlist_destroy(ProcessList *process_list);
 GtkWidget *processlist_get_widget(ProcessList *process_list);
@@ -104,7 +116,8 @@ void processlist_clear(ProcessList *process_list);
 
 // out : success (0) and height
 /* CPU num is only used for PID 0 */
-int processlist_add(ProcessList *process_list, guint pid, guint cpu, guint ppid,
+int processlist_add(ProcessList *process_list, Drawing_t * drawing, 
+    guint pid, guint cpu, guint ppid,
     LttTime *birth, guint trace_num, const gchar *name, guint *height,
     ProcessInfo **process_info,
     HashedProcessData **hashed_process_data);
@@ -112,6 +125,26 @@ int processlist_add(ProcessList *process_list, guint pid, guint cpu, guint ppid,
 int processlist_remove(ProcessList *process_list, guint pid, guint cpu, 
     LttTime *birth, guint trace_num);
 
+/* Update the width of each pixmap buffer for each process */
+void update_pixmap_size(ProcessList *process_list, guint width);
+
+
+/* Put src and/or dest to NULL to copy from/to the each PID specific pixmap */
+void copy_pixmap_region(ProcessList *process_list, GdkDrawable *dest,
+    GdkGC *gc, GdkDrawable *src,
+    gint xsrc, gint ysrc,
+    gint xdest, gint ydest, gint width, gint height);
+
+/* If height is -1, the height of each pixmap is used */
+void rectangle_pixmap(ProcessList *process_list, GdkGC *gc,
+    gboolean filled, gint x, gint y, gint width, gint height);
+
+/* Renders each pixmaps into on big drawable */
+void copy_pixmap_to_screen(ProcessList *process_list,
+    GdkDrawable *dest,
+    GdkGC *gc,
+    gint x, gint y,
+    gint width, gint height);
 
 
 
@@ -181,6 +214,24 @@ static inline gint processlist_get_pixels_from_data(  ProcessList *process_list,
 
 }
 
+static inline guint processlist_get_index_from_data(ProcessList *process_list,
+          HashedProcessData *hashed_process_data)
+{
+  gint *path_indices;
+  GtkTreePath *tree_path;
+  guint ret;
+
+  tree_path = gtk_tree_model_get_path((GtkTreeModel*)process_list->list_store,
+                    &hashed_process_data->y_iter);
+  path_indices =  gtk_tree_path_get_indices (tree_path);
+
+  ret = path_indices[0];
+
+  gtk_tree_path_free(tree_path);
+
+  return ret;
+}
+
 
 
 #endif // _PROCESS_LIST_H
index 9c0819801721b765fdaa39aff1ab1f8002a76ea1..4f9d4899bfd09a187b300280535de9400f385d7f 100644 (file)
@@ -25,7 +25,7 @@
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
 AM_CFLAGS += $(GTK_CFLAGS)
-LIBS += $(GLIB_LIBS)
+LIBS += $(M_LIBS) $(GLIB_LIBS)
 LIBS += $(GTK_LIBS) -L${top_srcdir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
@@ -33,6 +33,7 @@ libdir = ${lttvplugindir}
 lib_LTLIBRARIES = libguievents.la
 libguievents_la_LDFLAGS = -module
 libguievents_la_SOURCES = events.c
+libguievents_la_LIBADD = -lm
 
 EXTRA_DIST = \
                hGuiEventsInsert.xpm
index 05bd3a37d564248e80bbdeb847fa5ed2da8b0bca..0c7a47a3055eb57b6ed4261e582050d41c6f98d8 100644 (file)
@@ -2,7 +2,7 @@
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
 AM_CFLAGS += $(GTK_CFLAGS)
-LIBS += $(GLIB_LIBS)
+LIBS += $(M_LIBS) $(GLIB_LIBS)
 LIBS += $(GTK_LIBS)
 
 INCLUDES = \
@@ -43,5 +43,5 @@ lttvwindowinclude_HEADERS = \
        menu.h\
        toolbar.h
 
-liblttvwindow_la_LIBADD = @PACKAGE_LIBS@ $(INTLLIBS)
+liblttvwindow_la_LIBADD = -lm @PACKAGE_LIBS@ $(INTLLIBS)
 
index cf582c23aee66c893ac85a108f559c614e1091d4..50883600aa8f92399ac6e27d1b808ef07729b0f5 100644 (file)
@@ -6,7 +6,7 @@
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
 AM_CFLAGS += $(GTK_CFLAGS)
-LIBS += $(GLIB_LIBS)
+LIBS += $(M_LIBS) $(GLIB_LIBS)
 LIBS += $(GTK_LIBS) -L${top_srcdir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
@@ -14,6 +14,7 @@ libdir = ${lttvplugindir}
 lib_LTLIBRARIES = libguistatistics.la
 libguistatistics_la_LDFLAGS = -module
 libguistatistics_la_SOURCES = statistics.c
+libguistatistics_la_LIBADD = -lm
 
 EXTRA_DIST = \
                hGuiStatisticInsert.xpm
index 88f9235fc919e8d48d4afb726f9145965fb3f8ab..9954becac1ffb597b029f88420579f200284d7ae 100644 (file)
@@ -1,15 +1,17 @@
 
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
-LIBS += $(GLIB_LIBS) -lgobject-2.0 -L$(top_srcdir)/ltt -ltraceread
+LIBS += $(M_LIBS) $(GLIB_LIBS) -lgobject-2.0 -L$(top_srcdir)/ltt -ltraceread
 
 libdir = ${lttvplugindir}
 
 lib_LTLIBRARIES = libtextDump.la libbatchAnalysis.la
 libtextDump_la_LDFLAGS = -module
 libtextDump_la_SOURCES = textDump.c
+libtextDump_la_LIBADD = -lm
 libbatchAnalysis_la_LDFLAGS = -module
 libbatchAnalysis_la_SOURCES = batchAnalysis.c
+libbatchAnalysis_la_LIBADD = -lm
 
 noinst_HEADERS = \
        batchanalysis.h
This page took 0.047023 seconds and 4 git commands to generate.