1 /*****************************************************************************
2 * Hooks to be called by the main window *
3 *****************************************************************************/
10 #include <lttv/hook.h>
11 #include <lttv/common.h>
13 #include "Event_Hooks.h"
15 #include "Process_List.h"
18 void send_test_data(ProcessList
*Process_List
, Drawing_t
*Drawing
)
22 ProcessInfo Process_Info
= {10000, 12000, 55600};
23 //ProcessInfo Process_Info = {156, 14000, 55500};
24 GtkTreeRowReference
*got_RowRef
;
28 birth
.tv_nsec
= 55500;
30 ProcessList_add(Process_List
,
34 Drawing_Insert_Square( Drawing
, height
, 5);
36 g_critical("height : %u", height
);
39 birth
.tv_nsec
= 55500;
41 ProcessList_add(Process_List
,
45 Drawing_Insert_Square( Drawing
, height
, 5);
47 g_critical("height : %u", height
);
50 birth
.tv_nsec
= 55700;
52 ProcessList_add(Process_List
,
56 Drawing_Insert_Square( Drawing
, height
, 5);
60 birth
.tv_sec
= i
*12000;
61 birth
.tv_nsec
= i
*55700;
63 ProcessList_add(Process_List
,
67 Drawing_Insert_Square( Drawing
, height
, 5);
70 g_critical("height : %u", height
);
73 birth
.tv_nsec
= 55600;
75 ProcessList_add(Process_List
,
79 Drawing_Insert_Square( Drawing
, height
, 5);
80 g_critical("height : %u", height
);
82 ProcessList_add(Process_List
,
86 Drawing_Insert_Square( Drawing
, height
, 5);
87 g_critical("height : %u", height
);
90 ProcessList_get_process_pixels(Process_List
,
94 ProcessList_remove( Process_List
,
98 Drawing_Remove_Square( Drawing
, height
, 5);
101 (GtkTreeRowReference
*)g_hash_table_lookup(
102 Process_List
->Process_Hash
,
105 g_critical("key found");
106 g_critical("position in the list : %s",
107 gtk_tree_path_to_string (
108 gtk_tree_row_reference_get_path(
109 (GtkTreeRowReference
*)got_RowRef
)
119 * Event Viewer's constructor hook
121 * This constructor is given as a parameter to the menuitem and toolbar button
122 * registration. It creates the list.
123 * @param pmParentWindow A pointer to the parent window.
124 * @return The widget created.
127 hGuiControlFlow(mainWindow
*pmParentWindow
)
129 g_critical("hGuiControlFlow");
130 ControlFlowData
*Control_Flow_Data
= GuiControlFlow() ;
132 return GuiControlFlow_get_Widget(Control_Flow_Data
) ;
136 int Event_Selected_Hook(void *hook_data
, void *call_data
)
138 ControlFlowData
*Control_Flow_Data
= (ControlFlowData
*) hook_data
;
139 guint
*Event_Number
= (guint
*) call_data
;
141 g_critical("DEBUG : event selected by main window : %u", *Event_Number
);
143 // Control_Flow_Data->Currently_Selected_Event = *Event_Number;
144 // Control_Flow_Data->Selected_Event = TRUE ;
146 // Tree_V_set_cursor(Control_Flow_Data);
151 /* Hook called before drawing. Gets the initial context at the beginning of the
152 * drawing interval and copy it to the context in Event_Request.
154 int Draw_Before_Hook(void *hook_data
, void *call_data
)
156 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
157 EventsContext Events_Context
= (EventsContext
*)call_data
;
159 Event_Request
->Events_Context
= Events_Context
;
165 * The draw event hook is called by the reading API to have a
166 * particular event drawn on the screen.
167 * @param hook_data ControlFlowData structure of the viewer.
168 * @param call_data Event context.
170 * This function basically draw lines and icons. Two types of lines are drawn :
171 * one small (3 pixels?) representing the state of the process and the second
172 * type is thicker (10 pixels?) representing on which CPU a process is running
173 * (and this only in running state).
175 * Extremums of the lines :
176 * x_min : time of the last event context for this process kept in memory.
177 * x_max : time of the current event.
178 * y : middle of the process in the process list. The process is found in the
179 * list, therefore is it's position in pixels.
181 * The choice of lines'color is defined by the context of the last event for this
184 int Draw_Event_Hook(void *hook_data
, void *call_data
)
186 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
192 int Draw_After_Hook(void *hook_data
, void *call_data
)
194 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
196 g_free(Event_Request
);