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"
17 void send_test_data(ProcessList
*Process_List
)
21 ProcessInfo Process_Info
= {10000, 12000, 55600};
22 //ProcessInfo Process_Info = {156, 14000, 55500};
23 GtkTreeRowReference
*got_RowRef
;
27 birth
.tv_nsec
= 55500;
29 ProcessList_add(Process_List
,
34 g_critical("height : %u", height
);
37 birth
.tv_nsec
= 55500;
39 ProcessList_add(Process_List
,
44 g_critical("height : %u", height
);
47 birth
.tv_nsec
= 55700;
49 ProcessList_add(Process_List
,
56 birth
.tv_sec
= i
*12000;
57 birth
.tv_nsec
= i
*55700;
59 ProcessList_add(Process_List
,
65 g_critical("height : %u", height
);
68 birth
.tv_nsec
= 55600;
70 ProcessList_add(Process_List
,
74 g_critical("height : %u", height
);
76 ProcessList_add(Process_List
,
80 g_critical("height : %u", height
);
83 ProcessList_remove( Process_List
,
88 (GtkTreeRowReference
*)g_hash_table_lookup(
89 Process_List
->Process_Hash
,
92 g_critical("key found");
93 g_critical("position in the list : %s",
94 gtk_tree_path_to_string (
95 gtk_tree_row_reference_get_path(
96 (GtkTreeRowReference
*)got_RowRef
)
106 * Event Viewer's constructor hook
108 * This constructor is given as a parameter to the menuitem and toolbar button
109 * registration. It creates the list.
110 * @param pmParentWindow A pointer to the parent window.
111 * @return The widget created.
114 hGuiControlFlow(mainWindow
*pmParentWindow
)
116 g_critical("hGuiControlFlow");
117 ControlFlowData
*Control_Flow_Data
= GuiControlFlow() ;
119 return GuiControlFlow_get_Widget(Control_Flow_Data
) ;
123 int Event_Selected_Hook(void *hook_data
, void *call_data
)
125 ControlFlowData
*Control_Flow_Data
= (ControlFlowData
*) hook_data
;
126 guint
*Event_Number
= (guint
*) call_data
;
128 g_critical("DEBUG : event selected by main window : %u", *Event_Number
);
130 // Control_Flow_Data->Currently_Selected_Event = *Event_Number;
131 // Control_Flow_Data->Selected_Event = TRUE ;
133 // Tree_V_set_cursor(Control_Flow_Data);
138 /* Hook called before drawing. Gets the initial context at the beginning of the
139 * drawing interval and copy it to the context in Event_Request.
141 int Draw_Before_Hook(void *hook_data
, void *call_data
)
143 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
144 EventsContext Events_Context
= (EventsContext
*)call_data
;
146 Event_Request
->Events_Context
= Events_Context
;
152 * The draw event hook is called by the reading API to have a
153 * particular event drawn on the screen.
154 * @param hook_data ControlFlowData structure of the viewer.
155 * @param call_data Event context.
157 * This function basically draw lines and icons. Two types of lines are drawn :
158 * one small (3 pixels?) representing the state of the process and the second
159 * type is thicker (10 pixels?) representing on which CPU a process is running
160 * (and this only in running state).
162 * Extremums of the lines :
163 * x_min : time of the last event context for this process kept in memory.
164 * x_max : time of the current event.
165 * y : middle of the process in the process list. The process is found in the
166 * list, therefore is it's position in pixels.
168 * The choice of lines'color is defined by the context of the last event for this
171 int Draw_Event_Hook(void *hook_data
, void *call_data
)
173 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
179 int Draw_After_Hook(void *hook_data
, void *call_data
)
181 EventRequest
*Event_Request
= (EventRequest
*)hook_data
;
183 g_free(Event_Request
);