ce0214a6 |
1 | /* This file is part of the Linux Trace Toolkit viewer |
2 | * Copyright (C) 2003-2004 Mathieu Desnoyers |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License Version 2 as |
6 | * published by the Free Software Foundation; |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
16 | * MA 02111-1307, USA. |
17 | */ |
18 | |
19 | |
f0d936c0 |
20 | /***************************************************************************** |
21 | * Hooks to be called by the main window * |
22 | *****************************************************************************/ |
23 | |
f0d936c0 |
24 | |
189a5d08 |
25 | #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) |
26 | #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) |
27 | |
cf6cb7e0 |
28 | //#define PANGO_ENABLE_BACKEND |
558aa013 |
29 | #include <gtk/gtk.h> |
30 | #include <gdk/gdk.h> |
5f16133f |
31 | #include <glib.h> |
80a52ff8 |
32 | #include <assert.h> |
50439712 |
33 | #include <string.h> |
319e9d81 |
34 | #include <stdio.h> |
5f16133f |
35 | |
cf6cb7e0 |
36 | //#include <pango/pango.h> |
37 | |
80a52ff8 |
38 | #include <ltt/event.h> |
4ba42155 |
39 | #include <ltt/time.h> |
50439712 |
40 | #include <ltt/type.h> |
80a52ff8 |
41 | |
558aa013 |
42 | #include <lttv/hook.h> |
43 | #include <lttv/common.h> |
80a52ff8 |
44 | #include <lttv/state.h> |
cef97e7c |
45 | #include <lttv/gtktraceset.h> |
80a52ff8 |
46 | |
f0d936c0 |
47 | |
a117e3f7 |
48 | #include "eventhooks.h" |
49 | #include "cfv.h" |
50 | #include "processlist.h" |
51 | #include "drawing.h" |
52 | #include "cfv-private.h" |
5f16133f |
53 | |
80a52ff8 |
54 | |
1a31868c |
55 | #define MAX_PATH_LEN 256 |
56 | |
f0d936c0 |
57 | |
58 | /** |
59 | * Event Viewer's constructor hook |
60 | * |
61 | * This constructor is given as a parameter to the menuitem and toolbar button |
62 | * registration. It creates the list. |
14963be0 |
63 | * @param mw A pointer to the parent window. |
f0d936c0 |
64 | * @return The widget created. |
65 | */ |
66 | GtkWidget * |
14963be0 |
67 | h_guicontrolflow(MainWindow *mw, LttvTracesetSelector * s, char * key) |
f0d936c0 |
68 | { |
14963be0 |
69 | g_info("h_guicontrolflow, %p, %p, %s", mw, s, key); |
68997a22 |
70 | ControlFlowData *control_flow_data = guicontrolflow() ; |
a56a1ba4 |
71 | |
14963be0 |
72 | control_flow_data->mw = mw; |
68997a22 |
73 | TimeWindow *time_window = guicontrolflow_get_time_window(control_flow_data); |
a56a1ba4 |
74 | time_window->start_time.tv_sec = 0; |
75 | time_window->start_time.tv_nsec = 0; |
76 | time_window->time_width.tv_sec = 0; |
77 | time_window->time_width.tv_nsec = 0; |
78 | |
68997a22 |
79 | LttTime *current_time = guicontrolflow_get_current_time(control_flow_data); |
a56a1ba4 |
80 | current_time->tv_sec = 0; |
81 | current_time->tv_nsec = 0; |
82 | |
83 | //g_critical("time width1 : %u",time_window->time_width); |
84 | |
14963be0 |
85 | get_time_window(mw, |
a56a1ba4 |
86 | time_window); |
14963be0 |
87 | get_current_time(mw, |
a56a1ba4 |
88 | current_time); |
89 | |
90 | //g_critical("time width2 : %u",time_window->time_width); |
91 | // Unreg done in the GuiControlFlow_Destructor |
68997a22 |
92 | reg_update_time_window(update_time_window_hook, control_flow_data, |
14963be0 |
93 | mw); |
68997a22 |
94 | reg_update_current_time(update_current_time_hook, control_flow_data, |
14963be0 |
95 | mw); |
68997a22 |
96 | return guicontrolflow_get_widget(control_flow_data) ; |
a56a1ba4 |
97 | |
f0d936c0 |
98 | } |
99 | |
3cff8cc1 |
100 | int event_selected_hook(void *hook_data, void *call_data) |
f0d936c0 |
101 | { |
68997a22 |
102 | ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
14963be0 |
103 | guint *event_number = (guint*) call_data; |
f0d936c0 |
104 | |
14963be0 |
105 | g_critical("DEBUG : event selected by main window : %u", *event_number); |
a56a1ba4 |
106 | |
14963be0 |
107 | // control_flow_data->currently_Selected_Event = *event_number; |
68997a22 |
108 | // control_flow_data->Selected_Event = TRUE ; |
a56a1ba4 |
109 | |
68997a22 |
110 | // tree_v_set_cursor(control_flow_data); |
f0d936c0 |
111 | |
112 | } |
113 | |
f0d936c0 |
114 | /* Hook called before drawing. Gets the initial context at the beginning of the |
14963be0 |
115 | * drawing interval and copy it to the context in event_request. |
f0d936c0 |
116 | */ |
4c69e0cc |
117 | int draw_before_hook(void *hook_data, void *call_data) |
f0d936c0 |
118 | { |
14963be0 |
119 | EventRequest *event_request = (EventRequest*)hook_data; |
a56a1ba4 |
120 | //EventsContext Events_Context = (EventsContext*)call_data; |
121 | |
14963be0 |
122 | //event_request->Events_Context = Events_Context; |
f0d936c0 |
123 | |
a56a1ba4 |
124 | return 0; |
f0d936c0 |
125 | } |
126 | |
127 | /* |
128 | * The draw event hook is called by the reading API to have a |
129 | * particular event drawn on the screen. |
130 | * @param hook_data ControlFlowData structure of the viewer. |
131 | * @param call_data Event context. |
132 | * |
133 | * This function basically draw lines and icons. Two types of lines are drawn : |
134 | * one small (3 pixels?) representing the state of the process and the second |
135 | * type is thicker (10 pixels?) representing on which CPU a process is running |
136 | * (and this only in running state). |
137 | * |
138 | * Extremums of the lines : |
139 | * x_min : time of the last event context for this process kept in memory. |
140 | * x_max : time of the current event. |
141 | * y : middle of the process in the process list. The process is found in the |
142 | * list, therefore is it's position in pixels. |
143 | * |
144 | * The choice of lines'color is defined by the context of the last event for this |
145 | * process. |
146 | */ |
4c69e0cc |
147 | int draw_event_hook(void *hook_data, void *call_data) |
f0d936c0 |
148 | { |
14963be0 |
149 | EventRequest *event_request = (EventRequest*)hook_data; |
150 | ControlFlowData *control_flow_data = event_request->control_flow_data; |
e9a9c513 |
151 | |
a56a1ba4 |
152 | LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; |
e9a9c513 |
153 | |
154 | LttvTracefileState *tfs = (LttvTracefileState *)call_data; |
155 | |
a56a1ba4 |
156 | |
e9a9c513 |
157 | LttEvent *e; |
e9a9c513 |
158 | e = tfc->e; |
159 | |
9444deae |
160 | LttTime evtime = ltt_event_time(e); |
161 | TimeWindow *time_window = |
162 | guicontrolflow_get_time_window(control_flow_data); |
163 | |
164 | LttTime end_time = ltt_time_add(time_window->start_time, |
165 | time_window->time_width); |
166 | //if(time < time_beg || time > time_end) return; |
167 | if(ltt_time_compare(evtime, time_window->start_time) == -1 |
168 | || ltt_time_compare(evtime, end_time) == 1) |
169 | return; |
170 | |
a56a1ba4 |
171 | if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0) |
172 | { |
173 | g_critical("schedchange!"); |
174 | |
175 | /* Add process to process list (if not present) and get drawing "y" from |
176 | * process position */ |
177 | guint pid_out, pid_in; |
178 | LttvProcessState *process_out, *process_in; |
179 | LttTime birth; |
180 | guint y_in = 0, y_out = 0, height = 0, pl_height = 0; |
181 | |
182 | ProcessList *process_list = |
14963be0 |
183 | guicontrolflow_get_process_list(event_request->control_flow_data); |
a56a1ba4 |
184 | |
185 | |
186 | LttField *f = ltt_event_field(e); |
187 | LttField *element; |
188 | element = ltt_field_member(f,0); |
189 | pid_out = ltt_event_get_long_unsigned(e,element); |
190 | element = ltt_field_member(f,1); |
191 | pid_in = ltt_event_get_long_unsigned(e,element); |
192 | g_critical("out : %u in : %u", pid_out, pid_in); |
193 | |
194 | |
195 | /* Find process pid_out in the list... */ |
196 | process_out = lttv_state_find_process(tfs, pid_out); |
197 | g_critical("out : %s",g_quark_to_string(process_out->state->s)); |
198 | |
199 | birth = process_out->creation_time; |
200 | gchar *name = strdup(g_quark_to_string(process_out->name)); |
14963be0 |
201 | HashedProcessData *hashed_process_data_out = NULL; |
a56a1ba4 |
202 | |
203 | if(processlist_get_process_pixels(process_list, |
204 | pid_out, |
205 | &birth, |
206 | &y_out, |
207 | &height, |
14963be0 |
208 | &hashed_process_data_out) == 1) |
a56a1ba4 |
209 | { |
210 | /* Process not present */ |
211 | processlist_add(process_list, |
212 | pid_out, |
213 | &birth, |
214 | name, |
215 | &pl_height, |
14963be0 |
216 | &hashed_process_data_out); |
a56a1ba4 |
217 | processlist_get_process_pixels(process_list, |
218 | pid_out, |
219 | &birth, |
220 | &y_out, |
221 | &height, |
14963be0 |
222 | &hashed_process_data_out); |
501d5405 |
223 | drawing_insert_square( event_request->control_flow_data->drawing, y_out, height); |
a56a1ba4 |
224 | } |
225 | |
226 | g_free(name); |
227 | |
228 | /* Find process pid_in in the list... */ |
229 | process_in = lttv_state_find_process(tfs, pid_in); |
230 | g_critical("in : %s",g_quark_to_string(process_in->state->s)); |
231 | |
232 | birth = process_in->creation_time; |
233 | name = strdup(g_quark_to_string(process_in->name)); |
14963be0 |
234 | HashedProcessData *hashed_process_data_in = NULL; |
a56a1ba4 |
235 | |
236 | if(processlist_get_process_pixels(process_list, |
237 | pid_in, |
238 | &birth, |
239 | &y_in, |
240 | &height, |
14963be0 |
241 | &hashed_process_data_in) == 1) |
a56a1ba4 |
242 | { |
243 | /* Process not present */ |
244 | processlist_add(process_list, |
245 | pid_in, |
246 | &birth, |
247 | name, |
248 | &pl_height, |
14963be0 |
249 | &hashed_process_data_in); |
a56a1ba4 |
250 | processlist_get_process_pixels(process_list, |
251 | pid_in, |
252 | &birth, |
253 | &y_in, |
254 | &height, |
14963be0 |
255 | &hashed_process_data_in); |
a56a1ba4 |
256 | |
501d5405 |
257 | drawing_insert_square( event_request->control_flow_data->drawing, y_in, height); |
a56a1ba4 |
258 | } |
259 | g_free(name); |
260 | |
261 | |
262 | /* Find pixels corresponding to time of the event. If the time does |
263 | * not fit in the window, show a warning, not supposed to happend. */ |
264 | guint x = 0; |
501d5405 |
265 | guint width = control_flow_data->drawing->drawing_area->allocation.width; |
a56a1ba4 |
266 | |
267 | LttTime time = ltt_event_time(e); |
268 | |
ba90bc77 |
269 | LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width, |
270 | control_flow_data->time_window.start_time); |
a56a1ba4 |
271 | |
272 | |
273 | convert_time_to_pixels( |
ba90bc77 |
274 | control_flow_data->time_window.start_time, |
a56a1ba4 |
275 | window_end, |
276 | time, |
277 | width, |
278 | &x); |
9444deae |
279 | //assert(x <= width); |
a56a1ba4 |
280 | |
281 | /* draw what represents the event for outgoing process. */ |
282 | |
14963be0 |
283 | DrawContext *draw_context_out = hashed_process_data_out->draw_context; |
68997a22 |
284 | draw_context_out->current->modify_over->x = x; |
319e9d81 |
285 | draw_context_out->current->modify_under->x = x; |
68997a22 |
286 | draw_context_out->current->modify_over->y = y_out; |
319e9d81 |
287 | draw_context_out->current->modify_under->y = y_out+(height/2)+2; |
501d5405 |
288 | draw_context_out->drawable = control_flow_data->drawing->pixmap; |
289 | draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; |
290 | GtkWidget *widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
291 | //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
501d5405 |
292 | draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
a56a1ba4 |
293 | gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); |
294 | //draw_context_out->gc = widget->style->black_gc; |
295 | |
296 | //draw_arc((void*)&prop_arc, (void*)draw_context_out); |
501d5405 |
297 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
a56a1ba4 |
298 | |
299 | GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 }; |
2df6f2bd |
300 | GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
301 | PropertiesText prop_text_out; |
302 | prop_text_out.foreground = &colorfg_out; |
303 | prop_text_out.background = &colorbg_out; |
cfe526b1 |
304 | prop_text_out.size = 6; |
a56a1ba4 |
305 | prop_text_out.position = OVER; |
306 | |
cfe526b1 |
307 | /* color of text : status of the process */ |
308 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
309 | { |
310 | prop_text_out.foreground->red = 0xffff; |
311 | prop_text_out.foreground->green = 0xffff; |
312 | prop_text_out.foreground->blue = 0xffff; |
313 | } |
314 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
315 | { |
316 | prop_text_out.foreground->red = 0x0fff; |
d52cfc84 |
317 | prop_text_out.foreground->green = 0xffff; |
318 | prop_text_out.foreground->blue = 0xfff0; |
cfe526b1 |
319 | } |
320 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
321 | { |
2df6f2bd |
322 | prop_text_out.foreground->red = 0xffff; |
323 | prop_text_out.foreground->green = 0xffff; |
cfe526b1 |
324 | prop_text_out.foreground->blue = 0x0000; |
325 | } |
326 | else if(process_out->state->s == LTTV_STATE_EXIT) |
327 | { |
328 | prop_text_out.foreground->red = 0xffff; |
329 | prop_text_out.foreground->green = 0x0000; |
330 | prop_text_out.foreground->blue = 0xffff; |
331 | } |
332 | else if(process_out->state->s == LTTV_STATE_WAIT) |
333 | { |
334 | prop_text_out.foreground->red = 0xffff; |
335 | prop_text_out.foreground->green = 0x0000; |
336 | prop_text_out.foreground->blue = 0x0000; |
337 | } |
338 | else if(process_out->state->s == LTTV_STATE_RUN) |
339 | { |
340 | prop_text_out.foreground->red = 0x0000; |
341 | prop_text_out.foreground->green = 0xffff; |
342 | prop_text_out.foreground->blue = 0x0000; |
343 | } |
344 | else |
345 | { |
346 | prop_text_out.foreground->red = 0xffff; |
347 | prop_text_out.foreground->green = 0xffff; |
348 | prop_text_out.foreground->blue = 0xffff; |
349 | } |
350 | |
d52cfc84 |
351 | |
a56a1ba4 |
352 | /* Print status of the process : U, WF, WC, E, W, R */ |
353 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
cfe526b1 |
354 | prop_text_out.text = "U->"; |
a56a1ba4 |
355 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
cfe526b1 |
356 | prop_text_out.text = "WF->"; |
a56a1ba4 |
357 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
cfe526b1 |
358 | prop_text_out.text = "WC->"; |
a56a1ba4 |
359 | else if(process_out->state->s == LTTV_STATE_EXIT) |
cfe526b1 |
360 | prop_text_out.text = "E->"; |
a56a1ba4 |
361 | else if(process_out->state->s == LTTV_STATE_WAIT) |
cfe526b1 |
362 | prop_text_out.text = "W->"; |
a56a1ba4 |
363 | else if(process_out->state->s == LTTV_STATE_RUN) |
cfe526b1 |
364 | prop_text_out.text = "R->"; |
a56a1ba4 |
365 | else |
68997a22 |
366 | prop_text_out.text = "U"; |
a56a1ba4 |
367 | |
368 | draw_text((void*)&prop_text_out, (void*)draw_context_out); |
369 | gdk_gc_unref(draw_context_out->gc); |
370 | |
371 | /* Draw the line of the out process */ |
68997a22 |
372 | if(draw_context_out->previous->middle->x == -1) |
a56a1ba4 |
373 | { |
14963be0 |
374 | draw_context_out->previous->middle->x = event_request->x_begin; |
375 | g_critical("out middle x_beg : %u",event_request->x_begin); |
a56a1ba4 |
376 | } |
377 | |
68997a22 |
378 | draw_context_out->current->middle->x = x; |
379 | draw_context_out->current->middle->y = y_out + height/2; |
380 | draw_context_out->previous->middle->y = y_out + height/2; |
501d5405 |
381 | draw_context_out->drawable = control_flow_data->drawing->pixmap; |
382 | draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; |
a56a1ba4 |
383 | //draw_context_out->gc = widget->style->black_gc; |
501d5405 |
384 | draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
a56a1ba4 |
385 | gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); |
386 | |
387 | PropertiesLine prop_line_out; |
388 | prop_line_out.color = g_new(GdkColor,1); |
cfe526b1 |
389 | prop_line_out.line_width = 2; |
a56a1ba4 |
390 | prop_line_out.style = GDK_LINE_SOLID; |
391 | prop_line_out.position = MIDDLE; |
d52cfc84 |
392 | |
393 | g_critical("out state : %s", g_quark_to_string(process_out->state->s)); |
a56a1ba4 |
394 | |
395 | /* color of line : status of the process */ |
396 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
397 | { |
cfe526b1 |
398 | prop_line_out.color->red = 0xffff; |
399 | prop_line_out.color->green = 0xffff; |
400 | prop_line_out.color->blue = 0xffff; |
a56a1ba4 |
401 | } |
402 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
403 | { |
404 | prop_line_out.color->red = 0x0fff; |
d52cfc84 |
405 | prop_line_out.color->green = 0xffff; |
406 | prop_line_out.color->blue = 0xfff0; |
a56a1ba4 |
407 | } |
408 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
409 | { |
2df6f2bd |
410 | prop_line_out.color->red = 0xffff; |
411 | prop_line_out.color->green = 0xffff; |
a56a1ba4 |
412 | prop_line_out.color->blue = 0x0000; |
413 | } |
414 | else if(process_out->state->s == LTTV_STATE_EXIT) |
415 | { |
416 | prop_line_out.color->red = 0xffff; |
417 | prop_line_out.color->green = 0x0000; |
418 | prop_line_out.color->blue = 0xffff; |
419 | } |
420 | else if(process_out->state->s == LTTV_STATE_WAIT) |
421 | { |
422 | prop_line_out.color->red = 0xffff; |
423 | prop_line_out.color->green = 0x0000; |
424 | prop_line_out.color->blue = 0x0000; |
425 | } |
426 | else if(process_out->state->s == LTTV_STATE_RUN) |
427 | { |
428 | prop_line_out.color->red = 0x0000; |
429 | prop_line_out.color->green = 0xffff; |
430 | prop_line_out.color->blue = 0x0000; |
431 | } |
432 | else |
433 | { |
cfe526b1 |
434 | prop_line_out.color->red = 0xffff; |
435 | prop_line_out.color->green = 0xffff; |
436 | prop_line_out.color->blue = 0xffff; |
a56a1ba4 |
437 | } |
438 | |
439 | draw_line((void*)&prop_line_out, (void*)draw_context_out); |
440 | g_free(prop_line_out.color); |
441 | gdk_gc_unref(draw_context_out->gc); |
442 | /* Note : finishing line will have to be added when trace read over. */ |
443 | |
444 | /* Finally, update the drawing context of the pid_in. */ |
445 | |
14963be0 |
446 | DrawContext *draw_context_in = hashed_process_data_in->draw_context; |
68997a22 |
447 | draw_context_in->current->modify_over->x = x; |
319e9d81 |
448 | draw_context_in->current->modify_under->x = x; |
68997a22 |
449 | draw_context_in->current->modify_over->y = y_in; |
319e9d81 |
450 | draw_context_in->current->modify_under->y = y_in+(height/2)+2; |
501d5405 |
451 | draw_context_in->drawable = control_flow_data->drawing->pixmap; |
452 | draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; |
453 | widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
454 | //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
455 | //draw_context_in->gc = widget->style->black_gc; |
501d5405 |
456 | draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
a56a1ba4 |
457 | gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); |
458 | |
459 | //draw_arc((void*)&prop_arc, (void*)draw_context_in); |
501d5405 |
460 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
a56a1ba4 |
461 | |
462 | GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 }; |
2df6f2bd |
463 | GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
464 | PropertiesText prop_text_in; |
465 | prop_text_in.foreground = &colorfg_in; |
466 | prop_text_in.background = &colorbg_in; |
cfe526b1 |
467 | prop_text_in.size = 6; |
a56a1ba4 |
468 | prop_text_in.position = OVER; |
469 | |
d52cfc84 |
470 | g_critical("in state : %s", g_quark_to_string(process_in->state->s)); |
cfe526b1 |
471 | /* foreground of text : status of the process */ |
472 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
473 | { |
474 | prop_text_in.foreground->red = 0xffff; |
475 | prop_text_in.foreground->green = 0xffff; |
476 | prop_text_in.foreground->blue = 0xffff; |
477 | } |
478 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
479 | { |
480 | prop_text_in.foreground->red = 0x0fff; |
d52cfc84 |
481 | prop_text_in.foreground->green = 0xffff; |
482 | prop_text_in.foreground->blue = 0xfff0; |
cfe526b1 |
483 | } |
484 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
485 | { |
2df6f2bd |
486 | prop_text_in.foreground->red = 0xffff; |
487 | prop_text_in.foreground->green = 0xffff; |
cfe526b1 |
488 | prop_text_in.foreground->blue = 0x0000; |
489 | } |
490 | else if(process_in->state->s == LTTV_STATE_EXIT) |
491 | { |
492 | prop_text_in.foreground->red = 0xffff; |
493 | prop_text_in.foreground->green = 0x0000; |
494 | prop_text_in.foreground->blue = 0xffff; |
495 | } |
496 | else if(process_in->state->s == LTTV_STATE_WAIT) |
497 | { |
498 | prop_text_in.foreground->red = 0xffff; |
499 | prop_text_in.foreground->green = 0x0000; |
500 | prop_text_in.foreground->blue = 0x0000; |
501 | } |
502 | else if(process_in->state->s == LTTV_STATE_RUN) |
503 | { |
504 | prop_text_in.foreground->red = 0x0000; |
505 | prop_text_in.foreground->green = 0xffff; |
506 | prop_text_in.foreground->blue = 0x0000; |
507 | } |
508 | else |
509 | { |
510 | prop_text_in.foreground->red = 0xffff; |
511 | prop_text_in.foreground->green = 0xffff; |
512 | prop_text_in.foreground->blue = 0xffff; |
513 | } |
514 | |
515 | |
516 | |
a56a1ba4 |
517 | /* Print status of the process : U, WF, WC, E, W, R */ |
518 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
cfe526b1 |
519 | prop_text_in.text = "U->"; |
a56a1ba4 |
520 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
cfe526b1 |
521 | prop_text_in.text = "WF->"; |
a56a1ba4 |
522 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
cfe526b1 |
523 | prop_text_in.text = "WC->"; |
a56a1ba4 |
524 | else if(process_in->state->s == LTTV_STATE_EXIT) |
cfe526b1 |
525 | prop_text_in.text = "E->"; |
a56a1ba4 |
526 | else if(process_in->state->s == LTTV_STATE_WAIT) |
cfe526b1 |
527 | prop_text_in.text = "W->"; |
a56a1ba4 |
528 | else if(process_in->state->s == LTTV_STATE_RUN) |
cfe526b1 |
529 | prop_text_in.text = "R->"; |
a56a1ba4 |
530 | else |
68997a22 |
531 | prop_text_in.text = "U"; |
a56a1ba4 |
532 | |
533 | draw_text((void*)&prop_text_in, (void*)draw_context_in); |
534 | gdk_gc_unref(draw_context_in->gc); |
535 | |
536 | /* Draw the line of the in process */ |
68997a22 |
537 | if(draw_context_in->previous->middle->x == -1) |
a56a1ba4 |
538 | { |
14963be0 |
539 | draw_context_in->previous->middle->x = event_request->x_begin; |
540 | g_critical("in middle x_beg : %u",event_request->x_begin); |
a56a1ba4 |
541 | } |
542 | |
68997a22 |
543 | draw_context_in->current->middle->x = x; |
544 | draw_context_in->previous->middle->y = y_in + height/2; |
545 | draw_context_in->current->middle->y = y_in + height/2; |
501d5405 |
546 | draw_context_in->drawable = control_flow_data->drawing->pixmap; |
547 | draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; |
a56a1ba4 |
548 | //draw_context_in->gc = widget->style->black_gc; |
501d5405 |
549 | draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
a56a1ba4 |
550 | gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); |
551 | |
552 | PropertiesLine prop_line_in; |
553 | prop_line_in.color = g_new(GdkColor,1); |
cfe526b1 |
554 | prop_line_in.line_width = 2; |
a56a1ba4 |
555 | prop_line_in.style = GDK_LINE_SOLID; |
556 | prop_line_in.position = MIDDLE; |
557 | |
558 | /* color of line : status of the process */ |
559 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
560 | { |
cfe526b1 |
561 | prop_line_in.color->red = 0xffff; |
562 | prop_line_in.color->green = 0xffff; |
563 | prop_line_in.color->blue = 0xffff; |
a56a1ba4 |
564 | } |
565 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
566 | { |
567 | prop_line_in.color->red = 0x0fff; |
d52cfc84 |
568 | prop_line_in.color->green = 0xffff; |
569 | prop_line_in.color->blue = 0xfff0; |
a56a1ba4 |
570 | } |
571 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
572 | { |
2df6f2bd |
573 | prop_line_in.color->red = 0xffff; |
574 | prop_line_in.color->green = 0xffff; |
a56a1ba4 |
575 | prop_line_in.color->blue = 0x0000; |
576 | } |
577 | else if(process_in->state->s == LTTV_STATE_EXIT) |
578 | { |
579 | prop_line_in.color->red = 0xffff; |
580 | prop_line_in.color->green = 0x0000; |
581 | prop_line_in.color->blue = 0xffff; |
582 | } |
583 | else if(process_in->state->s == LTTV_STATE_WAIT) |
584 | { |
585 | prop_line_in.color->red = 0xffff; |
586 | prop_line_in.color->green = 0x0000; |
587 | prop_line_in.color->blue = 0x0000; |
588 | } |
589 | else if(process_in->state->s == LTTV_STATE_RUN) |
590 | { |
591 | prop_line_in.color->red = 0x0000; |
592 | prop_line_in.color->green = 0xffff; |
593 | prop_line_in.color->blue = 0x0000; |
594 | } |
595 | else |
596 | { |
cfe526b1 |
597 | prop_line_in.color->red = 0xffff; |
598 | prop_line_in.color->green = 0xffff; |
599 | prop_line_in.color->blue = 0xffff; |
a56a1ba4 |
600 | } |
601 | |
602 | draw_line((void*)&prop_line_in, (void*)draw_context_in); |
603 | g_free(prop_line_in.color); |
604 | gdk_gc_unref(draw_context_in->gc); |
605 | } |
606 | |
607 | return 0; |
608 | |
609 | /* Temp dump */ |
80a52ff8 |
610 | #ifdef DONTSHOW |
a56a1ba4 |
611 | GString *string = g_string_new("");; |
612 | gboolean field_names = TRUE, state = TRUE; |
80a52ff8 |
613 | |
e9a9c513 |
614 | lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs); |
615 | g_string_append_printf(string,"\n"); |
616 | |
617 | if(state) { |
618 | g_string_append_printf(string, " %s", |
619 | g_quark_to_string(tfs->process->state->s)); |
620 | } |
621 | |
622 | g_info("%s",string->str); |
623 | |
a56a1ba4 |
624 | g_string_free(string, TRUE); |
625 | |
626 | /* End of text dump */ |
80a52ff8 |
627 | #endif //DONTSHOW |
50439712 |
628 | |
f0d936c0 |
629 | } |
630 | |
631 | |
4c69e0cc |
632 | int draw_after_hook(void *hook_data, void *call_data) |
f0d936c0 |
633 | { |
14963be0 |
634 | EventRequest *event_request = (EventRequest*)hook_data; |
635 | ControlFlowData *control_flow_data = event_request->control_flow_data; |
50439712 |
636 | |
a56a1ba4 |
637 | LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; |
50439712 |
638 | |
639 | LttvTracefileState *tfs = (LttvTracefileState *)call_data; |
640 | |
a56a1ba4 |
641 | |
50439712 |
642 | LttEvent *e; |
643 | e = tfc->e; |
644 | |
9444deae |
645 | LttTime evtime = ltt_event_time(e); |
646 | TimeWindow *time_window = |
647 | guicontrolflow_get_time_window(control_flow_data); |
648 | |
649 | LttTime end_time = ltt_time_add(time_window->start_time, |
650 | time_window->time_width); |
651 | //if(time < time_beg || time > time_end) return; |
652 | if(ltt_time_compare(evtime, time_window->start_time) == -1 |
653 | || ltt_time_compare(evtime, end_time) == 1) |
654 | return; |
655 | |
656 | |
a56a1ba4 |
657 | if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0) |
658 | { |
659 | g_critical("schedchange!"); |
660 | |
661 | /* Add process to process list (if not present) and get drawing "y" from |
662 | * process position */ |
663 | guint pid_out, pid_in; |
664 | LttvProcessState *process_out, *process_in; |
665 | LttTime birth; |
666 | guint y_in = 0, y_out = 0, height = 0, pl_height = 0; |
667 | |
668 | ProcessList *process_list = |
14963be0 |
669 | guicontrolflow_get_process_list(event_request->control_flow_data); |
a56a1ba4 |
670 | |
671 | |
672 | LttField *f = ltt_event_field(e); |
673 | LttField *element; |
674 | element = ltt_field_member(f,0); |
675 | pid_out = ltt_event_get_long_unsigned(e,element); |
676 | element = ltt_field_member(f,1); |
677 | pid_in = ltt_event_get_long_unsigned(e,element); |
cfe526b1 |
678 | //g_critical("out : %u in : %u", pid_out, pid_in); |
a56a1ba4 |
679 | |
680 | |
681 | /* Find process pid_out in the list... */ |
682 | process_out = lttv_state_find_process(tfs, pid_out); |
cfe526b1 |
683 | //g_critical("out : %s",g_quark_to_string(process_out->state->s)); |
a56a1ba4 |
684 | |
685 | birth = process_out->creation_time; |
686 | gchar *name = strdup(g_quark_to_string(process_out->name)); |
14963be0 |
687 | HashedProcessData *hashed_process_data_out = NULL; |
a56a1ba4 |
688 | |
689 | if(processlist_get_process_pixels(process_list, |
690 | pid_out, |
691 | &birth, |
692 | &y_out, |
693 | &height, |
14963be0 |
694 | &hashed_process_data_out) == 1) |
a56a1ba4 |
695 | { |
696 | /* Process not present */ |
697 | processlist_add(process_list, |
698 | pid_out, |
699 | &birth, |
700 | name, |
701 | &pl_height, |
14963be0 |
702 | &hashed_process_data_out); |
a56a1ba4 |
703 | processlist_get_process_pixels(process_list, |
704 | pid_out, |
705 | &birth, |
706 | &y_out, |
707 | &height, |
14963be0 |
708 | &hashed_process_data_out); |
501d5405 |
709 | drawing_insert_square( event_request->control_flow_data->drawing, y_out, height); |
a56a1ba4 |
710 | } |
711 | |
712 | g_free(name); |
713 | |
714 | /* Find process pid_in in the list... */ |
715 | process_in = lttv_state_find_process(tfs, pid_in); |
cfe526b1 |
716 | //g_critical("in : %s",g_quark_to_string(process_in->state->s)); |
a56a1ba4 |
717 | |
718 | birth = process_in->creation_time; |
719 | name = strdup(g_quark_to_string(process_in->name)); |
14963be0 |
720 | HashedProcessData *hashed_process_data_in = NULL; |
a56a1ba4 |
721 | |
722 | if(processlist_get_process_pixels(process_list, |
723 | pid_in, |
724 | &birth, |
725 | &y_in, |
726 | &height, |
14963be0 |
727 | &hashed_process_data_in) == 1) |
a56a1ba4 |
728 | { |
729 | /* Process not present */ |
730 | processlist_add(process_list, |
731 | pid_in, |
732 | &birth, |
733 | name, |
734 | &pl_height, |
14963be0 |
735 | &hashed_process_data_in); |
a56a1ba4 |
736 | processlist_get_process_pixels(process_list, |
737 | pid_in, |
738 | &birth, |
739 | &y_in, |
740 | &height, |
14963be0 |
741 | &hashed_process_data_in); |
a56a1ba4 |
742 | |
501d5405 |
743 | drawing_insert_square( event_request->control_flow_data->drawing, y_in, height); |
a56a1ba4 |
744 | } |
745 | g_free(name); |
746 | |
747 | |
748 | /* Find pixels corresponding to time of the event. If the time does |
749 | * not fit in the window, show a warning, not supposed to happend. */ |
750 | //guint x = 0; |
501d5405 |
751 | //guint width = control_flow_data->drawing->drawing_area->allocation.width; |
a56a1ba4 |
752 | |
753 | //LttTime time = ltt_event_time(e); |
754 | |
ba90bc77 |
755 | //LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width, |
756 | // control_flow_data->time_window.start_time); |
a56a1ba4 |
757 | |
758 | |
759 | //convert_time_to_pixels( |
ba90bc77 |
760 | // control_flow_data->time_window.start_time, |
a56a1ba4 |
761 | // window_end, |
762 | // time, |
763 | // width, |
764 | // &x); |
765 | |
766 | //assert(x <= width); |
767 | |
768 | /* draw what represents the event for outgoing process. */ |
769 | |
14963be0 |
770 | DrawContext *draw_context_out = hashed_process_data_out->draw_context; |
68997a22 |
771 | //draw_context_out->current->modify_over->x = x; |
772 | draw_context_out->current->modify_over->y = y_out; |
319e9d81 |
773 | draw_context_out->current->modify_under->y = y_out+(height/2)+2; |
501d5405 |
774 | draw_context_out->drawable = control_flow_data->drawing->pixmap; |
775 | draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; |
776 | GtkWidget *widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
777 | //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
778 | draw_context_out->gc = widget->style->black_gc; |
779 | |
780 | //draw_arc((void*)&prop_arc, (void*)draw_context_out); |
501d5405 |
781 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
a56a1ba4 |
782 | |
783 | GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 }; |
2df6f2bd |
784 | GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
785 | PropertiesText prop_text_out; |
786 | prop_text_out.foreground = &colorfg_out; |
787 | prop_text_out.background = &colorbg_out; |
cfe526b1 |
788 | prop_text_out.size = 6; |
a56a1ba4 |
789 | prop_text_out.position = OVER; |
790 | |
cfe526b1 |
791 | /* color of text : status of the process */ |
792 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
793 | { |
794 | prop_text_out.foreground->red = 0xffff; |
795 | prop_text_out.foreground->green = 0xffff; |
796 | prop_text_out.foreground->blue = 0xffff; |
797 | } |
798 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
799 | { |
800 | prop_text_out.foreground->red = 0x0fff; |
d52cfc84 |
801 | prop_text_out.foreground->green = 0xffff; |
802 | prop_text_out.foreground->blue = 0xfff0; |
cfe526b1 |
803 | } |
804 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
805 | { |
2df6f2bd |
806 | prop_text_out.foreground->red = 0xffff; |
807 | prop_text_out.foreground->green = 0xffff; |
cfe526b1 |
808 | prop_text_out.foreground->blue = 0x0000; |
809 | } |
810 | else if(process_out->state->s == LTTV_STATE_EXIT) |
811 | { |
812 | prop_text_out.foreground->red = 0xffff; |
813 | prop_text_out.foreground->green = 0x0000; |
814 | prop_text_out.foreground->blue = 0xffff; |
815 | } |
816 | else if(process_out->state->s == LTTV_STATE_WAIT) |
817 | { |
818 | prop_text_out.foreground->red = 0xffff; |
819 | prop_text_out.foreground->green = 0x0000; |
820 | prop_text_out.foreground->blue = 0x0000; |
821 | } |
822 | else if(process_out->state->s == LTTV_STATE_RUN) |
823 | { |
824 | prop_text_out.foreground->red = 0x0000; |
825 | prop_text_out.foreground->green = 0xffff; |
826 | prop_text_out.foreground->blue = 0x0000; |
827 | } |
828 | else |
829 | { |
830 | prop_text_out.foreground->red = 0xffff; |
831 | prop_text_out.foreground->green = 0xffff; |
832 | prop_text_out.foreground->blue = 0xffff; |
833 | } |
834 | |
a56a1ba4 |
835 | /* Print status of the process : U, WF, WC, E, W, R */ |
836 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
68997a22 |
837 | prop_text_out.text = "U"; |
a56a1ba4 |
838 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
68997a22 |
839 | prop_text_out.text = "WF"; |
a56a1ba4 |
840 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
68997a22 |
841 | prop_text_out.text = "WC"; |
a56a1ba4 |
842 | else if(process_out->state->s == LTTV_STATE_EXIT) |
68997a22 |
843 | prop_text_out.text = "E"; |
a56a1ba4 |
844 | else if(process_out->state->s == LTTV_STATE_WAIT) |
68997a22 |
845 | prop_text_out.text = "W"; |
a56a1ba4 |
846 | else if(process_out->state->s == LTTV_STATE_RUN) |
68997a22 |
847 | prop_text_out.text = "R"; |
a56a1ba4 |
848 | else |
68997a22 |
849 | prop_text_out.text = "U"; |
a56a1ba4 |
850 | |
851 | draw_text((void*)&prop_text_out, (void*)draw_context_out); |
319e9d81 |
852 | |
68997a22 |
853 | draw_context_out->current->middle->y = y_out+height/2; |
854 | draw_context_out->current->status = process_out->state->s; |
a56a1ba4 |
855 | |
68997a22 |
856 | /* for pid_out : remove previous, Prev = current, new current (default) */ |
857 | g_free(draw_context_out->previous->modify_under); |
858 | g_free(draw_context_out->previous->modify_middle); |
859 | g_free(draw_context_out->previous->modify_over); |
860 | g_free(draw_context_out->previous->under); |
861 | g_free(draw_context_out->previous->middle); |
862 | g_free(draw_context_out->previous->over); |
863 | g_free(draw_context_out->previous); |
864 | |
865 | draw_context_out->previous = draw_context_out->current; |
a56a1ba4 |
866 | |
68997a22 |
867 | draw_context_out->current = g_new(DrawInfo,1); |
868 | draw_context_out->current->over = g_new(ItemInfo,1); |
869 | draw_context_out->current->over->x = -1; |
870 | draw_context_out->current->over->y = -1; |
871 | draw_context_out->current->middle = g_new(ItemInfo,1); |
872 | draw_context_out->current->middle->x = -1; |
873 | draw_context_out->current->middle->y = -1; |
874 | draw_context_out->current->under = g_new(ItemInfo,1); |
875 | draw_context_out->current->under->x = -1; |
876 | draw_context_out->current->under->y = -1; |
877 | draw_context_out->current->modify_over = g_new(ItemInfo,1); |
878 | draw_context_out->current->modify_over->x = -1; |
879 | draw_context_out->current->modify_over->y = -1; |
880 | draw_context_out->current->modify_middle = g_new(ItemInfo,1); |
881 | draw_context_out->current->modify_middle->x = -1; |
882 | draw_context_out->current->modify_middle->y = -1; |
883 | draw_context_out->current->modify_under = g_new(ItemInfo,1); |
884 | draw_context_out->current->modify_under->x = -1; |
885 | draw_context_out->current->modify_under->y = -1; |
886 | draw_context_out->current->status = LTTV_STATE_UNNAMED; |
a56a1ba4 |
887 | |
888 | /* Finally, update the drawing context of the pid_in. */ |
889 | |
14963be0 |
890 | DrawContext *draw_context_in = hashed_process_data_in->draw_context; |
68997a22 |
891 | //draw_context_in->current->modify_over->x = x; |
892 | draw_context_in->current->modify_over->y = y_in; |
319e9d81 |
893 | draw_context_in->current->modify_under->y = y_in+(height/2)+2; |
501d5405 |
894 | draw_context_in->drawable = control_flow_data->drawing->pixmap; |
895 | draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; |
896 | widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
897 | //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
898 | draw_context_in->gc = widget->style->black_gc; |
899 | |
900 | //draw_arc((void*)&prop_arc, (void*)draw_context_in); |
501d5405 |
901 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
a56a1ba4 |
902 | |
903 | GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 }; |
2df6f2bd |
904 | GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
905 | PropertiesText prop_text_in; |
906 | prop_text_in.foreground = &colorfg_in; |
907 | prop_text_in.background = &colorbg_in; |
cfe526b1 |
908 | prop_text_in.size = 6; |
a56a1ba4 |
909 | prop_text_in.position = OVER; |
910 | |
cfe526b1 |
911 | /* foreground of text : status of the process */ |
912 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
913 | { |
914 | prop_text_in.foreground->red = 0xffff; |
915 | prop_text_in.foreground->green = 0xffff; |
916 | prop_text_in.foreground->blue = 0xffff; |
917 | } |
918 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
919 | { |
920 | prop_text_in.foreground->red = 0x0fff; |
d52cfc84 |
921 | prop_text_in.foreground->green = 0xffff; |
922 | prop_text_in.foreground->blue = 0xfff0; |
cfe526b1 |
923 | } |
924 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
925 | { |
2df6f2bd |
926 | prop_text_in.foreground->red = 0xffff; |
927 | prop_text_in.foreground->green = 0xffff; |
cfe526b1 |
928 | prop_text_in.foreground->blue = 0x0000; |
929 | } |
930 | else if(process_in->state->s == LTTV_STATE_EXIT) |
931 | { |
932 | prop_text_in.foreground->red = 0xffff; |
933 | prop_text_in.foreground->green = 0x0000; |
934 | prop_text_in.foreground->blue = 0xffff; |
935 | } |
936 | else if(process_in->state->s == LTTV_STATE_WAIT) |
937 | { |
938 | prop_text_in.foreground->red = 0xffff; |
939 | prop_text_in.foreground->green = 0x0000; |
940 | prop_text_in.foreground->blue = 0x0000; |
941 | } |
942 | else if(process_in->state->s == LTTV_STATE_RUN) |
943 | { |
944 | prop_text_in.foreground->red = 0x0000; |
945 | prop_text_in.foreground->green = 0xffff; |
946 | prop_text_in.foreground->blue = 0x0000; |
947 | } |
948 | else |
949 | { |
950 | prop_text_in.foreground->red = 0xffff; |
951 | prop_text_in.foreground->green = 0xffff; |
952 | prop_text_in.foreground->blue = 0xffff; |
953 | } |
954 | |
955 | |
a56a1ba4 |
956 | /* Print status of the process : U, WF, WC, E, W, R */ |
957 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
68997a22 |
958 | prop_text_in.text = "U"; |
a56a1ba4 |
959 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
68997a22 |
960 | prop_text_in.text = "WF"; |
a56a1ba4 |
961 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
68997a22 |
962 | prop_text_in.text = "WC"; |
a56a1ba4 |
963 | else if(process_in->state->s == LTTV_STATE_EXIT) |
68997a22 |
964 | prop_text_in.text = "E"; |
a56a1ba4 |
965 | else if(process_in->state->s == LTTV_STATE_WAIT) |
68997a22 |
966 | prop_text_in.text = "W"; |
a56a1ba4 |
967 | else if(process_in->state->s == LTTV_STATE_RUN) |
68997a22 |
968 | prop_text_in.text = "R"; |
a56a1ba4 |
969 | else |
68997a22 |
970 | prop_text_in.text = "U"; |
a56a1ba4 |
971 | |
972 | draw_text((void*)&prop_text_in, (void*)draw_context_in); |
973 | |
319e9d81 |
974 | if(process_in->state->s == LTTV_STATE_RUN) |
975 | { |
976 | gchar tmp[255]; |
977 | prop_text_in.foreground = &colorfg_in; |
978 | prop_text_in.background = &colorbg_in; |
979 | prop_text_in.foreground->red = 0xffff; |
980 | prop_text_in.foreground->green = 0xffff; |
981 | prop_text_in.foreground->blue = 0xffff; |
982 | prop_text_in.size = 6; |
983 | prop_text_in.position = UNDER; |
984 | |
985 | prop_text_in.text = g_new(gchar, 260); |
986 | strcpy(prop_text_in.text, "CPU "); |
987 | snprintf(tmp, 255, "%u", tfc->index); |
988 | strcat(prop_text_in.text, tmp); |
989 | |
990 | draw_text((void*)&prop_text_in, (void*)draw_context_in); |
991 | g_free(prop_text_in.text); |
992 | } |
993 | |
994 | |
68997a22 |
995 | draw_context_in->current->middle->y = y_in+height/2; |
996 | draw_context_in->current->status = process_in->state->s; |
997 | |
998 | /* for pid_in : remove previous, Prev = current, new current (default) */ |
999 | g_free(draw_context_in->previous->modify_under); |
1000 | g_free(draw_context_in->previous->modify_middle); |
1001 | g_free(draw_context_in->previous->modify_over); |
1002 | g_free(draw_context_in->previous->under); |
1003 | g_free(draw_context_in->previous->middle); |
1004 | g_free(draw_context_in->previous->over); |
1005 | g_free(draw_context_in->previous); |
1006 | |
1007 | draw_context_in->previous = draw_context_in->current; |
a56a1ba4 |
1008 | |
68997a22 |
1009 | draw_context_in->current = g_new(DrawInfo,1); |
1010 | draw_context_in->current->over = g_new(ItemInfo,1); |
1011 | draw_context_in->current->over->x = -1; |
1012 | draw_context_in->current->over->y = -1; |
1013 | draw_context_in->current->middle = g_new(ItemInfo,1); |
1014 | draw_context_in->current->middle->x = -1; |
1015 | draw_context_in->current->middle->y = -1; |
1016 | draw_context_in->current->under = g_new(ItemInfo,1); |
1017 | draw_context_in->current->under->x = -1; |
1018 | draw_context_in->current->under->y = -1; |
1019 | draw_context_in->current->modify_over = g_new(ItemInfo,1); |
1020 | draw_context_in->current->modify_over->x = -1; |
1021 | draw_context_in->current->modify_over->y = -1; |
1022 | draw_context_in->current->modify_middle = g_new(ItemInfo,1); |
1023 | draw_context_in->current->modify_middle->x = -1; |
1024 | draw_context_in->current->modify_middle->y = -1; |
1025 | draw_context_in->current->modify_under = g_new(ItemInfo,1); |
1026 | draw_context_in->current->modify_under->x = -1; |
1027 | draw_context_in->current->modify_under->y = -1; |
1028 | draw_context_in->current->status = LTTV_STATE_UNNAMED; |
a56a1ba4 |
1029 | |
1030 | } |
1031 | |
1032 | return 0; |
f0d936c0 |
1033 | } |
f7afe191 |
1034 | |
1035 | |
1036 | |
1037 | |
1b238973 |
1038 | gint update_time_window_hook(void *hook_data, void *call_data) |
f7afe191 |
1039 | { |
a56a1ba4 |
1040 | ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
14963be0 |
1041 | TimeWindow *old_time_window = |
a56a1ba4 |
1042 | guicontrolflow_get_time_window(control_flow_data); |
14963be0 |
1043 | TimeWindow *new_time_window = ((TimeWindow*)call_data); |
a56a1ba4 |
1044 | |
3cb8b205 |
1045 | /* Update the ruler */ |
1046 | drawing_update_ruler(control_flow_data->drawing, |
1047 | new_time_window); |
1048 | |
1049 | |
a56a1ba4 |
1050 | /* Two cases : zoom in/out or scrolling */ |
1051 | |
1052 | /* In order to make sure we can reuse the old drawing, the scale must |
1053 | * be the same and the new time interval being partly located in the |
1054 | * currently shown time interval. (reuse is only for scrolling) |
1055 | */ |
1056 | |
1057 | g_info("Old time window HOOK : %u, %u to %u, %u", |
14963be0 |
1058 | old_time_window->start_time.tv_sec, |
1059 | old_time_window->start_time.tv_nsec, |
1060 | old_time_window->time_width.tv_sec, |
1061 | old_time_window->time_width.tv_nsec); |
a56a1ba4 |
1062 | |
1063 | g_info("New time window HOOK : %u, %u to %u, %u", |
14963be0 |
1064 | new_time_window->start_time.tv_sec, |
1065 | new_time_window->start_time.tv_nsec, |
1066 | new_time_window->time_width.tv_sec, |
1067 | new_time_window->time_width.tv_nsec); |
a56a1ba4 |
1068 | |
14963be0 |
1069 | if( new_time_window->time_width.tv_sec == old_time_window->time_width.tv_sec |
1070 | && new_time_window->time_width.tv_nsec == old_time_window->time_width.tv_nsec) |
a56a1ba4 |
1071 | { |
1072 | /* Same scale (scrolling) */ |
1073 | g_info("scrolling"); |
14963be0 |
1074 | LttTime *ns = &new_time_window->start_time; |
1075 | LttTime *os = &old_time_window->start_time; |
1076 | LttTime old_end = ltt_time_add(old_time_window->start_time, |
1077 | old_time_window->time_width); |
1078 | LttTime new_end = ltt_time_add(new_time_window->start_time, |
1079 | new_time_window->time_width); |
a56a1ba4 |
1080 | //if(ns<os+w<ns+w) |
1081 | //if(ns<os+w && os+w<ns+w) |
1082 | //if(ns<old_end && os<ns) |
1083 | if(ltt_time_compare(*ns, old_end) == -1 |
1084 | && ltt_time_compare(*os, *ns) == -1) |
1085 | { |
1086 | g_info("scrolling near right"); |
1087 | /* Scroll right, keep right part of the screen */ |
1088 | guint x = 0; |
501d5405 |
1089 | guint width = control_flow_data->drawing->drawing_area->allocation.width; |
a56a1ba4 |
1090 | convert_time_to_pixels( |
1091 | *os, |
1092 | old_end, |
1093 | *ns, |
1094 | width, |
1095 | &x); |
1096 | |
1097 | /* Copy old data to new location */ |
501d5405 |
1098 | gdk_draw_drawable (control_flow_data->drawing->pixmap, |
cfe526b1 |
1099 | control_flow_data->drawing->drawing_area->style->black_gc, |
501d5405 |
1100 | control_flow_data->drawing->pixmap, |
a56a1ba4 |
1101 | x, 0, |
1102 | 0, 0, |
1103 | -1, -1); |
1104 | |
1105 | convert_time_to_pixels( |
1106 | *ns, |
1107 | new_end, |
1108 | old_end, |
1109 | width, |
1110 | &x); |
1111 | |
14963be0 |
1112 | *old_time_window = *new_time_window; |
a56a1ba4 |
1113 | /* Clear the data request background, but not SAFETY */ |
501d5405 |
1114 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
cfe526b1 |
1115 | control_flow_data->drawing->drawing_area->style->black_gc, |
a56a1ba4 |
1116 | TRUE, |
1117 | x+SAFETY, 0, |
501d5405 |
1118 | control_flow_data->drawing->width - x, // do not overlap |
1119 | control_flow_data->drawing->height+SAFETY); |
a56a1ba4 |
1120 | /* Get new data for the rest. */ |
501d5405 |
1121 | drawing_data_request(control_flow_data->drawing, |
1122 | &control_flow_data->drawing->pixmap, |
a56a1ba4 |
1123 | x, 0, |
501d5405 |
1124 | control_flow_data->drawing->width - x, |
1125 | control_flow_data->drawing->height); |
a56a1ba4 |
1126 | |
501d5405 |
1127 | drawing_refresh(control_flow_data->drawing, |
a56a1ba4 |
1128 | 0, 0, |
501d5405 |
1129 | control_flow_data->drawing->width, |
1130 | control_flow_data->drawing->height); |
a56a1ba4 |
1131 | |
1132 | |
1133 | } else { |
1134 | //if(ns<os<ns+w) |
1135 | //if(ns<os && os<ns+w) |
1136 | //if(ns<os && os<new_end) |
1137 | if(ltt_time_compare(*ns,*os) == -1 |
1138 | && ltt_time_compare(*os,new_end) == -1) |
1139 | { |
1140 | g_info("scrolling near left"); |
1141 | /* Scroll left, keep left part of the screen */ |
1142 | guint x = 0; |
501d5405 |
1143 | guint width = control_flow_data->drawing->drawing_area->allocation.width; |
a56a1ba4 |
1144 | convert_time_to_pixels( |
1145 | *ns, |
1146 | new_end, |
1147 | *os, |
1148 | width, |
1149 | &x); |
1150 | |
1151 | /* Copy old data to new location */ |
501d5405 |
1152 | gdk_draw_drawable (control_flow_data->drawing->pixmap, |
cfe526b1 |
1153 | control_flow_data->drawing->drawing_area->style->black_gc, |
501d5405 |
1154 | control_flow_data->drawing->pixmap, |
a56a1ba4 |
1155 | 0, 0, |
1156 | x, 0, |
1157 | -1, -1); |
1158 | |
14963be0 |
1159 | *old_time_window = *new_time_window; |
a56a1ba4 |
1160 | |
1161 | /* Clean the data request background */ |
501d5405 |
1162 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
cfe526b1 |
1163 | control_flow_data->drawing->drawing_area->style->black_gc, |
a56a1ba4 |
1164 | TRUE, |
1165 | 0, 0, |
1166 | x, // do not overlap |
501d5405 |
1167 | control_flow_data->drawing->height+SAFETY); |
a56a1ba4 |
1168 | /* Get new data for the rest. */ |
501d5405 |
1169 | drawing_data_request(control_flow_data->drawing, |
1170 | &control_flow_data->drawing->pixmap, |
a56a1ba4 |
1171 | 0, 0, |
1172 | x, |
501d5405 |
1173 | control_flow_data->drawing->height); |
a56a1ba4 |
1174 | |
501d5405 |
1175 | drawing_refresh(control_flow_data->drawing, |
a56a1ba4 |
1176 | 0, 0, |
501d5405 |
1177 | control_flow_data->drawing->width, |
1178 | control_flow_data->drawing->height); |
a56a1ba4 |
1179 | |
1180 | } else { |
1181 | g_info("scrolling far"); |
1182 | /* Cannot reuse any part of the screen : far jump */ |
14963be0 |
1183 | *old_time_window = *new_time_window; |
a56a1ba4 |
1184 | |
1185 | |
501d5405 |
1186 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
cfe526b1 |
1187 | control_flow_data->drawing->drawing_area->style->black_gc, |
a56a1ba4 |
1188 | TRUE, |
1189 | 0, 0, |
501d5405 |
1190 | control_flow_data->drawing->width+SAFETY, // do not overlap |
1191 | control_flow_data->drawing->height+SAFETY); |
a56a1ba4 |
1192 | |
501d5405 |
1193 | drawing_data_request(control_flow_data->drawing, |
1194 | &control_flow_data->drawing->pixmap, |
a56a1ba4 |
1195 | 0, 0, |
501d5405 |
1196 | control_flow_data->drawing->width, |
1197 | control_flow_data->drawing->height); |
a56a1ba4 |
1198 | |
501d5405 |
1199 | drawing_refresh(control_flow_data->drawing, |
a56a1ba4 |
1200 | 0, 0, |
501d5405 |
1201 | control_flow_data->drawing->width, |
1202 | control_flow_data->drawing->height); |
a56a1ba4 |
1203 | } |
1204 | } |
1205 | } else { |
1206 | /* Different scale (zoom) */ |
1207 | g_info("zoom"); |
1208 | |
14963be0 |
1209 | *old_time_window = *new_time_window; |
a56a1ba4 |
1210 | |
501d5405 |
1211 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
cfe526b1 |
1212 | control_flow_data->drawing->drawing_area->style->black_gc, |
a56a1ba4 |
1213 | TRUE, |
1214 | 0, 0, |
501d5405 |
1215 | control_flow_data->drawing->width+SAFETY, // do not overlap |
1216 | control_flow_data->drawing->height+SAFETY); |
a56a1ba4 |
1217 | |
1218 | |
501d5405 |
1219 | drawing_data_request(control_flow_data->drawing, |
1220 | &control_flow_data->drawing->pixmap, |
a56a1ba4 |
1221 | 0, 0, |
501d5405 |
1222 | control_flow_data->drawing->width, |
1223 | control_flow_data->drawing->height); |
a56a1ba4 |
1224 | |
501d5405 |
1225 | drawing_refresh(control_flow_data->drawing, |
a56a1ba4 |
1226 | 0, 0, |
501d5405 |
1227 | control_flow_data->drawing->width, |
1228 | control_flow_data->drawing->height); |
a56a1ba4 |
1229 | } |
1230 | |
3cb8b205 |
1231 | |
1232 | |
a56a1ba4 |
1233 | return 0; |
f7afe191 |
1234 | } |
1235 | |
1b238973 |
1236 | gint update_current_time_hook(void *hook_data, void *call_data) |
f7afe191 |
1237 | { |
14963be0 |
1238 | ControlFlowData *control_flow_data = (ControlFlowData*)hook_data; |
a56a1ba4 |
1239 | |
1240 | LttTime* current_time = |
1241 | guicontrolflow_get_current_time(control_flow_data); |
1242 | *current_time = *((LttTime*)call_data); |
1243 | |
1244 | TimeWindow time_window; |
1245 | |
ba90bc77 |
1246 | LttTime time_begin = control_flow_data->time_window.start_time; |
1247 | LttTime width = control_flow_data->time_window.time_width; |
a56a1ba4 |
1248 | LttTime half_width = ltt_time_div(width,2.0); |
1249 | LttTime time_end = ltt_time_add(time_begin, width); |
1250 | |
1251 | LttvTracesetContext * tsc = |
ba90bc77 |
1252 | get_traceset_context(control_flow_data->mw); |
a56a1ba4 |
1253 | |
1254 | LttTime trace_start = tsc->Time_Span->startTime; |
1255 | LttTime trace_end = tsc->Time_Span->endTime; |
1256 | |
68997a22 |
1257 | g_info("New current time HOOK : %u, %u", current_time->tv_sec, |
a56a1ba4 |
1258 | current_time->tv_nsec); |
1259 | |
1260 | |
1261 | |
1262 | /* If current time is inside time interval, just move the highlight |
1263 | * bar */ |
1264 | |
1265 | /* Else, we have to change the time interval. We have to tell it |
1266 | * to the main window. */ |
1267 | /* The time interval change will take care of placing the current |
1268 | * time at the center of the visible area, or nearest possible if we are |
1269 | * at one end of the trace. */ |
1270 | |
1271 | |
1272 | if(ltt_time_compare(*current_time, time_begin) == -1) |
1273 | { |
1274 | if(ltt_time_compare(*current_time, |
1275 | ltt_time_add(trace_start,half_width)) == -1) |
1276 | time_begin = trace_start; |
1277 | else |
1278 | time_begin = ltt_time_sub(*current_time,half_width); |
1279 | |
1280 | time_window.start_time = time_begin; |
1281 | time_window.time_width = width; |
1282 | |
ba90bc77 |
1283 | set_time_window(control_flow_data->mw, &time_window); |
a56a1ba4 |
1284 | } |
1285 | else if(ltt_time_compare(*current_time, time_end) == 1) |
1286 | { |
1287 | if(ltt_time_compare(*current_time, ltt_time_sub(trace_end, half_width)) == 1) |
1288 | time_begin = ltt_time_sub(trace_end,width); |
1289 | else |
1290 | time_begin = ltt_time_sub(*current_time,half_width); |
1291 | |
1292 | time_window.start_time = time_begin; |
1293 | time_window.time_width = width; |
1294 | |
ba90bc77 |
1295 | set_time_window(control_flow_data->mw, &time_window); |
a56a1ba4 |
1296 | |
1297 | } |
501d5405 |
1298 | gtk_widget_queue_draw(control_flow_data->drawing->drawing_area); |
a56a1ba4 |
1299 | |
1300 | return 0; |
f7afe191 |
1301 | } |
1302 | |
8b90e648 |
1303 | typedef struct _ClosureData { |
a56a1ba4 |
1304 | EventRequest *event_request; |
1305 | LttvTraceState *ts; |
8b90e648 |
1306 | } ClosureData; |
a56a1ba4 |
1307 | |
8b90e648 |
1308 | |
1309 | void draw_closure(gpointer key, gpointer value, gpointer user_data) |
1310 | { |
a56a1ba4 |
1311 | ProcessInfo *process_info = (ProcessInfo*)key; |
1312 | HashedProcessData *hashed_process_data = (HashedProcessData*)value; |
1313 | ClosureData *closure_data = (ClosureData*)user_data; |
1314 | |
1315 | ControlFlowData *control_flow_data = |
68997a22 |
1316 | closure_data->event_request->control_flow_data; |
a56a1ba4 |
1317 | |
501d5405 |
1318 | GtkWidget *widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
1319 | |
1320 | /* Get y position of process */ |
1321 | gint y=0, height=0; |
1322 | |
ba90bc77 |
1323 | processlist_get_pixels_from_data( control_flow_data->process_list, |
a56a1ba4 |
1324 | process_info, |
1325 | hashed_process_data, |
1326 | &y, |
1327 | &height); |
1328 | /* Get last state of process */ |
1329 | LttvTraceContext *tc = |
1330 | (LttvTraceContext *)closure_data->ts; |
8b90e648 |
1331 | |
1332 | LttvTraceState *ts = closure_data->ts; |
a56a1ba4 |
1333 | LttvProcessState *process; |
1334 | |
1335 | process = lttv_state_find_process((LttvTracefileState*)ts, process_info->pid); |
1336 | |
1337 | /* Draw the closing line */ |
1338 | DrawContext *draw_context = hashed_process_data->draw_context; |
68997a22 |
1339 | if(draw_context->previous->middle->x == -1) |
a56a1ba4 |
1340 | { |
68997a22 |
1341 | draw_context->previous->middle->x = closure_data->event_request->x_begin; |
a56a1ba4 |
1342 | g_critical("out middle x_beg : %u",closure_data->event_request->x_begin); |
1343 | } |
1344 | |
68997a22 |
1345 | draw_context->current->middle->x = closure_data->event_request->x_end; |
1346 | draw_context->current->middle->y = y + height/2; |
1347 | draw_context->previous->middle->y = y + height/2; |
501d5405 |
1348 | draw_context->drawable = control_flow_data->drawing->pixmap; |
1349 | draw_context->pango_layout = control_flow_data->drawing->pango_layout; |
a56a1ba4 |
1350 | //draw_context->gc = widget->style->black_gc; |
501d5405 |
1351 | draw_context->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
a56a1ba4 |
1352 | gdk_gc_copy(draw_context->gc, widget->style->black_gc); |
1353 | |
1354 | PropertiesLine prop_line; |
1355 | prop_line.color = g_new(GdkColor,1); |
cfe526b1 |
1356 | prop_line.line_width = 2; |
a56a1ba4 |
1357 | prop_line.style = GDK_LINE_SOLID; |
1358 | prop_line.position = MIDDLE; |
1359 | |
1360 | /* color of line : status of the process */ |
1361 | if(process->state->s == LTTV_STATE_UNNAMED) |
1362 | { |
cfe526b1 |
1363 | prop_line.color->red = 0xffff; |
1364 | prop_line.color->green = 0xffff; |
1365 | prop_line.color->blue = 0xffff; |
a56a1ba4 |
1366 | } |
1367 | else if(process->state->s == LTTV_STATE_WAIT_FORK) |
1368 | { |
1369 | prop_line.color->red = 0x0fff; |
d52cfc84 |
1370 | prop_line.color->green = 0xffff; |
1371 | prop_line.color->blue = 0xfff0; |
a56a1ba4 |
1372 | } |
1373 | else if(process->state->s == LTTV_STATE_WAIT_CPU) |
1374 | { |
2df6f2bd |
1375 | prop_line.color->red = 0xffff; |
1376 | prop_line.color->green = 0xffff; |
a56a1ba4 |
1377 | prop_line.color->blue = 0x0000; |
1378 | } |
1379 | else if(process->state->s == LTTV_STATE_EXIT) |
1380 | { |
1381 | prop_line.color->red = 0xffff; |
1382 | prop_line.color->green = 0x0000; |
1383 | prop_line.color->blue = 0xffff; |
1384 | } |
1385 | else if(process->state->s == LTTV_STATE_WAIT) |
1386 | { |
1387 | prop_line.color->red = 0xffff; |
1388 | prop_line.color->green = 0x0000; |
1389 | prop_line.color->blue = 0x0000; |
1390 | } |
1391 | else if(process->state->s == LTTV_STATE_RUN) |
1392 | { |
1393 | prop_line.color->red = 0x0000; |
1394 | prop_line.color->green = 0xffff; |
1395 | prop_line.color->blue = 0x0000; |
1396 | } |
1397 | else |
1398 | { |
cfe526b1 |
1399 | prop_line.color->red = 0xffff; |
1400 | prop_line.color->green = 0xffff; |
1401 | prop_line.color->blue = 0xffff; |
a56a1ba4 |
1402 | } |
1403 | |
1404 | draw_line((void*)&prop_line, (void*)draw_context); |
1405 | g_free(prop_line.color); |
1406 | gdk_gc_unref(draw_context->gc); |
1407 | |
1408 | /* Reset draw_context of the process for next request */ |
1409 | |
1410 | hashed_process_data->draw_context->drawable = NULL; |
1411 | hashed_process_data->draw_context->gc = NULL; |
1412 | hashed_process_data->draw_context->pango_layout = NULL; |
68997a22 |
1413 | hashed_process_data->draw_context->current->over->x = -1; |
1414 | hashed_process_data->draw_context->current->over->y = -1; |
1415 | hashed_process_data->draw_context->current->middle->x = -1; |
1416 | hashed_process_data->draw_context->current->middle->y = -1; |
1417 | hashed_process_data->draw_context->current->under->x = -1; |
1418 | hashed_process_data->draw_context->current->under->y = -1; |
1419 | hashed_process_data->draw_context->current->modify_over->x = -1; |
1420 | hashed_process_data->draw_context->current->modify_over->y = -1; |
1421 | hashed_process_data->draw_context->current->modify_middle->x = -1; |
1422 | hashed_process_data->draw_context->current->modify_middle->y = -1; |
1423 | hashed_process_data->draw_context->current->modify_under->x = -1; |
1424 | hashed_process_data->draw_context->current->modify_under->y = -1; |
1425 | hashed_process_data->draw_context->current->status = LTTV_STATE_UNNAMED; |
1426 | hashed_process_data->draw_context->previous->over->x = -1; |
1427 | hashed_process_data->draw_context->previous->over->y = -1; |
1428 | hashed_process_data->draw_context->previous->middle->x = -1; |
1429 | hashed_process_data->draw_context->previous->middle->y = -1; |
1430 | hashed_process_data->draw_context->previous->under->x = -1; |
1431 | hashed_process_data->draw_context->previous->under->y = -1; |
1432 | hashed_process_data->draw_context->previous->modify_over->x = -1; |
1433 | hashed_process_data->draw_context->previous->modify_over->y = -1; |
1434 | hashed_process_data->draw_context->previous->modify_middle->x = -1; |
1435 | hashed_process_data->draw_context->previous->modify_middle->y = -1; |
1436 | hashed_process_data->draw_context->previous->modify_under->x = -1; |
1437 | hashed_process_data->draw_context->previous->modify_under->y = -1; |
1438 | hashed_process_data->draw_context->previous->status = LTTV_STATE_UNNAMED; |
a56a1ba4 |
1439 | |
8b90e648 |
1440 | |
1441 | } |
1442 | |
1443 | /* |
1444 | * for each process |
a56a1ba4 |
1445 | * draw closing line |
1446 | * new default prev and current |
8b90e648 |
1447 | */ |
1448 | int after_data_request(void *hook_data, void *call_data) |
1449 | { |
14963be0 |
1450 | EventRequest *event_request = (EventRequest*)hook_data; |
1451 | ControlFlowData *control_flow_data = event_request->control_flow_data; |
a56a1ba4 |
1452 | |
1453 | ProcessList *process_list = |
14963be0 |
1454 | guicontrolflow_get_process_list(event_request->control_flow_data); |
a56a1ba4 |
1455 | |
1456 | ClosureData closure_data; |
1457 | closure_data.event_request = (EventRequest*)hook_data; |
1458 | closure_data.ts = (LttvTraceState*)call_data; |
1459 | |
14963be0 |
1460 | g_hash_table_foreach(process_list->process_hash, draw_closure, |
a56a1ba4 |
1461 | (void*)&closure_data); |
1462 | |
8b90e648 |
1463 | } |
1464 | |