From: compudj Date: Fri, 9 Jan 2004 02:00:47 +0000 (+0000) Subject: we can show dots X-Git-Tag: v0.12.20~3127 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=80a52ff84b0196d969d8e4bffe0f698652d8801c;p=lttv.git we can show dots git-svn-id: http://ltt.polymtl.ca/svn@362 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c index 4a6d6d2a..6dcf0a48 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.c @@ -293,8 +293,8 @@ gboolean draw_arc( void *hook_data, void *call_data) Draw_Context->Current->modify_over->x, Draw_Context->Current->modify_over->y, Properties->size, Properties->size, 0, 360*64); + g_critical("I draw arc over, x: %i, y: %i", Draw_Context->Current->modify_over->x, Draw_Context->Current->modify_over->y); Draw_Context->Current->modify_over->x += Properties->size; - break; case MIDDLE: gdk_draw_arc(Draw_Context->drawable, Draw_Context->gc, diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h index 63efcc11..de3a51c1 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Draw_Item.h @@ -39,6 +39,8 @@ typedef enum _RelPos { * draw a line or background. * */ + + struct _DrawContext { GdkDrawable *drawable; GdkGC *gc; @@ -48,16 +50,6 @@ struct _DrawContext { DrawInfo *Previous; }; -struct _DrawInfo { - ItemInfo *over; - ItemInfo *middle; - ItemInfo *under; - - ItemInfo *modify_over; - ItemInfo *modify_middle; - ItemInfo *modify_under; -}; - /* LttvExecutionState is accessible through the LttvTracefileState. Is has * a pointer to the LttvProcessState which points to the top of stack * execution state : LttvExecutionState *state. @@ -75,12 +67,22 @@ struct _DrawInfo { * LttvTracefileContext, it gives the LttEvent structure, which is needed * to get facility name and event name. */ -struct _ItemInfo { - gint x, y; +struct _DrawInfo { + ItemInfo *over; + ItemInfo *middle; + ItemInfo *under; + + ItemInfo *modify_over; + ItemInfo *modify_middle; + ItemInfo *modify_under; LttvTraceState *ts; LttvTracefileState *tfs; }; +struct _ItemInfo { + gint x, y; +}; + /* * Structure used to keep information about icons. */ diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c index cbd2e105..c92d4607 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.c @@ -70,12 +70,12 @@ void drawing_data_request(Drawing_t *Drawing, g_critical("x is : %i, x+width is : %i", x, x+width); - convert_pixels_to_time(width, x, + convert_pixels_to_time(Drawing->Drawing_Area_V->allocation.width, x, &control_flow_data->Time_Window.start_time, &window_end, &start); - convert_pixels_to_time(width, x + width, + convert_pixels_to_time(Drawing->Drawing_Area_V->allocation.width, x + width, &control_flow_data->Time_Window.start_time, &window_end, &end); @@ -110,6 +110,7 @@ void drawing_data_request(Drawing_t *Drawing, event_request.time_end.tv_nsec); LttvHooks *event = lttv_hooks_new(); + state_add_event_hooks_api(control_flow_data->Parent_Window); lttv_hooks_add(event, draw_event_hook, &event_request); lttv_process_traceset_seek_time(tsc, start); @@ -120,6 +121,7 @@ void drawing_data_request(Drawing_t *Drawing, lttv_traceset_context_remove_hooks(tsc, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, event, NULL); + state_remove_event_hooks_api(control_flow_data->Parent_Window); lttv_hooks_destroy(event); } @@ -176,6 +178,11 @@ g_critical("init data"); 0, 0, -1, -1); + if (Drawing->Pixmap) + gdk_pixmap_unref(Drawing->Pixmap); + + Drawing->Pixmap = Pixmap; + /* Request data for missing space */ g_critical("missing data"); drawing_data_request(Drawing, &Pixmap, Drawing->width, 0, @@ -203,10 +210,6 @@ g_critical("missing data"); - if (Drawing->Pixmap) - gdk_pixmap_unref(Drawing->Pixmap); - - Drawing->Pixmap = Pixmap; Drawing->width = widget->allocation.width; Drawing->height = widget->allocation.height; diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h index 6ae2f191..279c402f 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Drawing.h @@ -85,7 +85,7 @@ void convert_time_to_pixels( LttTime window_time_begin, LttTime window_time_end, LttTime time, - int width, + gint width, guint *x); #endif // _DRAWING_H diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c index 6340bfcb..6b6870ea 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Event_Hooks.c @@ -10,11 +10,16 @@ #include #include #include +#include //#include +#include + #include #include +#include + #include "Event_Hooks.h" #include "CFV.h" @@ -22,6 +27,7 @@ #include "Drawing.h" #include "CFV-private.h" + #define MAX_PATH_LEN 256 //FIXME : remove this include when tests finished. @@ -36,16 +42,14 @@ void test_draw_item(Drawing_t *Drawing, DrawInfo current, previous; ItemInfo over, middle, under, modify_over, modify_middle, modify_under; - int i,j; + int i=0,j=0; - for(i=0; i<1024;i=i+15) + //for(i=0; i<1024;i=i+15) { - for(j=0;j<768;j=j+15) + // for(j=0;j<768;j=j+15) { over.x = i; over.y = j; - over.ts = NULL; - over.tfs = NULL; current.modify_over = &over; @@ -69,6 +73,7 @@ void test_draw_item(Drawing_t *Drawing, } +#ifdef NOTUSE /* NOTE : no drawing data should be sent there, since the drawing widget * has not been initialized */ void send_test_drawing(ProcessList *Process_List, @@ -396,7 +401,7 @@ void send_test_process(ProcessList *Process_List, Drawing_t *Drawing) Process_List->Test_Process_Sent = TRUE; } - +#endif//NOTUSE /** @@ -491,23 +496,23 @@ int draw_before_hook(void *hook_data, void *call_data) int draw_event_hook(void *hook_data, void *call_data) { EventRequest *Event_Request = (EventRequest*)hook_data; - + ControlFlowData *control_flow_data = Event_Request->Control_Flow_Data; //static int i=0; //i++; //g_critical("%i", i); - - /* Text dumping if the information */ - GString *string = g_string_new("");; - gboolean field_names = TRUE, state = TRUE; - LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; + LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; LttvTracefileState *tfs = (LttvTracefileState *)call_data; LttEvent *e; - e = tfc->e; + /* Temp dump */ +#ifdef DONTSHOW + GString *string = g_string_new("");; + gboolean field_names = TRUE, state = TRUE; + lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs); g_string_append_printf(string,"\n"); @@ -521,12 +526,14 @@ int draw_event_hook(void *hook_data, void *call_data) g_string_free(string, TRUE); /* End of text dump */ - +#endif //DONTSHOW /* Add process to process list (if not present) and get drawing "y" from * process position */ guint pid = tfs->process->pid; LttTime birth = tfs->process->creation_time; - guint y = 0, height = 0; + guint y = 0, height = 0, pl_height = 0; + HashedProcessData *Hashed_Process_Data = NULL; + ProcessList *process_list = guicontrolflow_get_process_list(Event_Request->Control_Flow_Data); @@ -534,23 +541,58 @@ int draw_event_hook(void *hook_data, void *call_data) pid, &birth, &y, - &height) == 1) + &height, + &Hashed_Process_Data) == 1) { /* Process not present */ processlist_add(process_list, pid, &birth, - &y); + &pl_height, + &Hashed_Process_Data); drawing_insert_square( Event_Request->Control_Flow_Data->Drawing, y, height); } - + /* Find pixels corresponding to time of the event. If the time does * not fit in the window, show a warning, not supposed to happend. */ - + guint x = 0; + guint width = control_flow_data->Drawing->Drawing_Area_V->allocation.width; - /* Finally, draw what represents the event. */ + LttTime time = ltt_event_time(e); + + LttTime window_end = ltt_time_add(control_flow_data->Time_Window.time_width, + control_flow_data->Time_Window.start_time); + + + convert_time_to_pixels( + control_flow_data->Time_Window.start_time, + window_end, + time, + width, + &x); + assert(x <= width); + /* Finally, draw what represents the event. */ + + GdkColor color = { 0, 0xffff, 0x0000, 0x0000 }; + PropertiesArc prop_arc; + prop_arc.color = &color; + prop_arc.size = 10; + prop_arc.filled = TRUE; + prop_arc.position = OVER; + DrawContext *draw_context = Hashed_Process_Data->draw_context; + draw_context->Current->modify_over->x = x; + g_critical("x should be %i", x); + draw_context->Current->modify_over->y = y; + g_critical("y should be %i", y); + draw_context->drawable = control_flow_data->Drawing->Pixmap; + GtkWidget *widget = control_flow_data->Drawing->Drawing_Area_V; + //draw_context->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; + draw_context->gc = widget->style->black_gc; + + draw_arc((void*)&prop_arc, (void*)draw_context); + //test_draw_item(control_flow_data->Drawing, control_flow_data->Drawing->Pixmap); return 0; } diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c index e959dafc..8d4578c6 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.c @@ -2,7 +2,7 @@ #include #include #include "Process_List.h" - +#include "Draw_Item.h" /***************************************************************************** * Methods to synchronize process list * @@ -299,15 +299,63 @@ void destroy_hash_data(gpointer data) int processlist_add( ProcessList *Process_List, guint pid, LttTime *birth, - guint *height) + guint *height, + HashedProcessData **pmHashed_Process_Data) { GtkTreeIter iter ; ProcessInfo *Process_Info = g_new(ProcessInfo, 1); - GtkTreeRowReference *RowRef; - + HashedProcessData *Hashed_Process_Data = g_new(HashedProcessData, 1); + *pmHashed_Process_Data = Hashed_Process_Data; + Process_Info->pid = pid; Process_Info->birth = *birth; + Hashed_Process_Data->draw_context = g_new(DrawContext, 1); + Hashed_Process_Data->draw_context->drawable = NULL; + Hashed_Process_Data->draw_context->gc = NULL; + Hashed_Process_Data->draw_context->Current = g_new(DrawInfo,1); + Hashed_Process_Data->draw_context->Current->over = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Current->over->x = -1; + Hashed_Process_Data->draw_context->Current->over->y = -1; + Hashed_Process_Data->draw_context->Current->middle = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Current->middle->x = -1; + Hashed_Process_Data->draw_context->Current->middle->y = -1; + Hashed_Process_Data->draw_context->Current->under = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Current->under->x = -1; + Hashed_Process_Data->draw_context->Current->under->y = -1; + Hashed_Process_Data->draw_context->Current->modify_over = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Current->modify_over->x = -1; + Hashed_Process_Data->draw_context->Current->modify_over->y = -1; + Hashed_Process_Data->draw_context->Current->modify_middle = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Current->modify_middle->x = -1; + Hashed_Process_Data->draw_context->Current->modify_middle->y = -1; + Hashed_Process_Data->draw_context->Current->modify_under = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Current->modify_under->x = -1; + Hashed_Process_Data->draw_context->Current->modify_under->y = -1; + Hashed_Process_Data->draw_context->Current->ts = NULL; + Hashed_Process_Data->draw_context->Current->tfs = NULL; + Hashed_Process_Data->draw_context->Previous = g_new(DrawInfo,1); + Hashed_Process_Data->draw_context->Previous->over = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Previous->over->x = -1; + Hashed_Process_Data->draw_context->Previous->over->y = -1; + Hashed_Process_Data->draw_context->Previous->middle = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Previous->middle->x = -1; + Hashed_Process_Data->draw_context->Previous->middle->y = -1; + Hashed_Process_Data->draw_context->Previous->under = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Previous->under->x = -1; + Hashed_Process_Data->draw_context->Previous->under->y = -1; + Hashed_Process_Data->draw_context->Previous->modify_over = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Previous->modify_over->x = -1; + Hashed_Process_Data->draw_context->Previous->modify_over->y = -1; + Hashed_Process_Data->draw_context->Previous->modify_middle = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Previous->modify_middle->x = -1; + Hashed_Process_Data->draw_context->Previous->modify_middle->y = -1; + Hashed_Process_Data->draw_context->Previous->modify_under = g_new(ItemInfo,1); + Hashed_Process_Data->draw_context->Previous->modify_under->x = -1; + Hashed_Process_Data->draw_context->Previous->modify_under->y = -1; + Hashed_Process_Data->draw_context->Previous->ts = NULL; + Hashed_Process_Data->draw_context->Previous->tfs = NULL; + /* Add a new row to the model */ gtk_list_store_append ( Process_List->Store_M, &iter); //g_critical ( "iter before : %s", gtk_tree_path_to_string ( @@ -320,15 +368,14 @@ int processlist_add( ProcessList *Process_List, BIRTH_S_COLUMN, birth->tv_sec, BIRTH_NS_COLUMN, birth->tv_nsec, -1); - RowRef = gtk_tree_row_reference_new ( + Hashed_Process_Data->RowRef = gtk_tree_row_reference_new ( GTK_TREE_MODEL(Process_List->Store_M), gtk_tree_model_get_path( GTK_TREE_MODEL(Process_List->Store_M), &iter)); - g_hash_table_insert( Process_List->Process_Hash, (gpointer)Process_Info, - (gpointer)RowRef); + (gpointer)Hashed_Process_Data); //g_critical ( "iter after : %s", gtk_tree_path_to_string ( // gtk_tree_model_get_path ( @@ -350,14 +397,15 @@ int processlist_remove( ProcessList *Process_List, { ProcessInfo Process_Info; gint *path_indices; - GtkTreeRowReference *got_RowRef; + HashedProcessData *Hashed_Process_Data; GtkTreeIter iter; Process_Info.pid = pid; Process_Info.birth = *birth; - if(got_RowRef = - (GtkTreeRowReference*)g_hash_table_lookup( + + if(Hashed_Process_Data = + (HashedProcessData*)g_hash_table_lookup( Process_List->Process_Hash, &Process_Info)) { @@ -365,11 +413,28 @@ int processlist_remove( ProcessList *Process_List, GTK_TREE_MODEL(Process_List->Store_M), &iter, gtk_tree_row_reference_get_path( - (GtkTreeRowReference*)got_RowRef) + (GtkTreeRowReference*)Hashed_Process_Data->RowRef) ); gtk_list_store_remove (Process_List->Store_M, &iter); - + + g_free(Hashed_Process_Data->draw_context->Previous->modify_under); + g_free(Hashed_Process_Data->draw_context->Previous->modify_middle); + g_free(Hashed_Process_Data->draw_context->Previous->modify_over); + g_free(Hashed_Process_Data->draw_context->Previous->under); + g_free(Hashed_Process_Data->draw_context->Previous->middle); + g_free(Hashed_Process_Data->draw_context->Previous->over); + g_free(Hashed_Process_Data->draw_context->Previous); + g_free(Hashed_Process_Data->draw_context->Current->modify_under); + g_free(Hashed_Process_Data->draw_context->Current->modify_middle); + g_free(Hashed_Process_Data->draw_context->Current->modify_over); + g_free(Hashed_Process_Data->draw_context->Current->under); + g_free(Hashed_Process_Data->draw_context->Current->middle); + g_free(Hashed_Process_Data->draw_context->Current->over); + g_free(Hashed_Process_Data->draw_context->Current); + g_free(Hashed_Process_Data->draw_context); + g_free(Hashed_Process_Data); + g_hash_table_remove(Process_List->Process_Hash, &Process_Info); @@ -392,35 +457,35 @@ guint processlist_get_height(ProcessList *Process_List) gint processlist_get_process_pixels( ProcessList *Process_List, guint pid, LttTime *birth, guint *y, - guint *height) + guint *height, + HashedProcessData **pmHashed_Process_Data) { ProcessInfo Process_Info; gint *path_indices; - GtkTreeRowReference *got_RowRef; GtkTreePath *tree_path; + HashedProcessData *Hashed_Process_Data = NULL; Process_Info.pid = pid; Process_Info.birth = *birth; - if(got_RowRef = - (GtkTreeRowReference*)g_hash_table_lookup( + if(Hashed_Process_Data = + (HashedProcessData*)g_hash_table_lookup( Process_List->Process_Hash, &Process_Info)) { tree_path = gtk_tree_row_reference_get_path( - (GtkTreeRowReference*)got_RowRef); + Hashed_Process_Data->RowRef); path_indices = gtk_tree_path_get_indices (tree_path); - gtk_tree_path_free(tree_path); *height = get_cell_height( GTK_TREE_VIEW(Process_List->Process_List_VC)); *y = *height * path_indices[0]; - + g_critical("inside, y is %i", *y); + *pmHashed_Process_Data = Hashed_Process_Data; return 0; } else { + *pmHashed_Process_Data = Hashed_Process_Data; return 1; } - - } diff --git a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h index 781d85e2..c119fa33 100644 --- a/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h +++ b/ltt/branches/poly/lttv/modules/guiControlFlow/Process_List.h @@ -4,6 +4,7 @@ #include #include #include +#include "Draw_Item.h" /* The process list * @@ -26,8 +27,13 @@ typedef struct _ProcessInfo { } ProcessInfo; +typedef struct _HashedProcessData { + + GtkTreeRowReference *RowRef; + DrawContext *draw_context; - +} HashedProcessData; + struct _ProcessList { GtkWidget *Process_List_VC; @@ -50,7 +56,7 @@ GtkWidget *processlist_get_widget(ProcessList *Process_List); // out : success (0) and height int processlist_add(ProcessList *Process_List, guint pid, LttTime *birth, - guint *height); + guint *height, HashedProcessData **Hashed_Process_Data); // out : success (0) and height int processlist_remove(ProcessList *Process_List, guint pid, LttTime *birth); @@ -59,5 +65,6 @@ guint processlist_get_height(ProcessList *Process_List); // Returns 0 on success gint processlist_get_process_pixels(ProcessList *Process_List, guint pid, LttTime *birth, - guint *y, guint *height); + guint *y, guint *height, + HashedProcessData **Hashed_Process_Data); #endif // _PROCESS_LIST_H