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 /* NOTE : no draing data should be sent there, as the drawing widget
19 * has not been initialized */
20 void send_test_data(ProcessList
*Process_List
, Drawing_t
*Drawing
)
24 ProcessInfo Process_Info
= {10000, 12000, 55600};
25 //ProcessInfo Process_Info = {156, 14000, 55500};
26 GtkTreeRowReference
*got_RowRef
;
30 birth
.tv_nsec
= 55500;
32 ProcessList_add(Process_List
,
36 //Drawing_Insert_Square( Drawing, height, 5);
38 g_critical("height : %u", height
);
41 birth
.tv_nsec
= 55500;
43 ProcessList_add(Process_List
,
47 //Drawing_Insert_Square( Drawing, height, 5);
49 g_critical("height : %u", height
);
52 birth
.tv_nsec
= 55700;
54 ProcessList_add(Process_List
,
58 //Drawing_Insert_Square( Drawing, height, 5);
62 birth
.tv_sec
= i
*12000;
63 birth
.tv_nsec
= i
*55700;
65 ProcessList_add(Process_List
,
69 //Drawing_Insert_Square( Drawing, height, 5);
72 g_critical("height : %u", height
);
75 birth
.tv_nsec
= 55600;
77 ProcessList_add(Process_List
,
81 //Drawing_Insert_Square( Drawing, height, 5);
82 g_critical("height : %u", height
);
84 ProcessList_add(Process_List
,
88 //Drawing_Insert_Square( Drawing, height, 5);
89 g_critical("height : %u", height
);
92 ProcessList_get_process_pixels(Process_List
,
96 ProcessList_remove( Process_List
,
100 //Drawing_Remove_Square( Drawing, height, 5);
103 (GtkTreeRowReference
*)g_hash_table_lookup(
104 Process_List
->Process_Hash
,
107 g_critical("key found");
108 g_critical("position in the list : %s",
109 gtk_tree_path_to_string (
110 gtk_tree_row_reference_get_path(
111 (GtkTreeRowReference
*)got_RowRef
)
121 * Event Viewer's constructor hook
123 * This constructor is given as a parameter to the menuitem and toolbar button
124 * registration. It creates the list.
125 * @param pmParentWindow A pointer to the parent window.
126 * @return The widget created.
129 hGuiControlFlow(mainWindow
*pmParentWindow
)
131 g_critical("hGuiControlFlow");
132 ControlFlowData
*Control_Flow_Data
= GuiControlFlow() ;
134 return GuiControlFlow_get_Widget(Control_Flow_Data
) ;
138 int Event_Selected_Hook(void *hook_data
, void *call_data
)
140 ControlFlowData
*Control_Flow_Data
= (ControlFlowData
*) hook_data
;
141 guint
*Event_Number
= (guint
*) call_data
;
143 g_critical("DEBUG : event selected by main window : %u", *Event_Number
);
145 // Control_Flow_Data->Currently_Selected_Event = *Event_Number;
146 // Control_Flow_Data->Selected_Event = TRUE ;
148 // Tree_V_set_cursor(Control_Flow_Data);
153 /* Hook called before drawing. Gets the initial context at the beginning of the
154 * drawing interval and copy it to the context in Event_Request.
156 int Draw_Before_Hook(void *hook_data
, void *call_data
)
158 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
159 EventsContext Events_Context
= (EventsContext
*)call_data
;
161 Event_Request
->Events_Context
= Events_Context
;
167 * The draw event hook is called by the reading API to have a
168 * particular event drawn on the screen.
169 * @param hook_data ControlFlowData structure of the viewer.
170 * @param call_data Event context.
172 * This function basically draw lines and icons. Two types of lines are drawn :
173 * one small (3 pixels?) representing the state of the process and the second
174 * type is thicker (10 pixels?) representing on which CPU a process is running
175 * (and this only in running state).
177 * Extremums of the lines :
178 * x_min : time of the last event context for this process kept in memory.
179 * x_max : time of the current event.
180 * y : middle of the process in the process list. The process is found in the
181 * list, therefore is it's position in pixels.
183 * The choice of lines'color is defined by the context of the last event for this
186 int Draw_Event_Hook(void *hook_data
, void *call_data
)
188 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
194 int Draw_After_Hook(void *hook_data
, void *call_data
)
196 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
198 g_free(Event_Request
);