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 | |
cf6cb7e0 |
25 | //#define PANGO_ENABLE_BACKEND |
558aa013 |
26 | #include <gtk/gtk.h> |
27 | #include <gdk/gdk.h> |
5f16133f |
28 | #include <glib.h> |
80a52ff8 |
29 | #include <assert.h> |
50439712 |
30 | #include <string.h> |
319e9d81 |
31 | #include <stdio.h> |
5f16133f |
32 | |
cf6cb7e0 |
33 | //#include <pango/pango.h> |
34 | |
80a52ff8 |
35 | #include <ltt/event.h> |
4ba42155 |
36 | #include <ltt/time.h> |
50439712 |
37 | #include <ltt/type.h> |
80a52ff8 |
38 | |
2a2fa4f0 |
39 | #include <lttv/lttv.h> |
558aa013 |
40 | #include <lttv/hook.h> |
80a52ff8 |
41 | #include <lttv/state.h> |
2d262115 |
42 | #include <lttvwindow/lttvwindow.h> |
6395d57c |
43 | #include <lttvwindow/lttvwindowtraces.h> |
80a52ff8 |
44 | |
f0d936c0 |
45 | |
a117e3f7 |
46 | #include "eventhooks.h" |
47 | #include "cfv.h" |
48 | #include "processlist.h" |
49 | #include "drawing.h" |
50 | #include "cfv-private.h" |
5f16133f |
51 | |
80a52ff8 |
52 | |
1a31868c |
53 | #define MAX_PATH_LEN 256 |
54 | |
f0d936c0 |
55 | |
6395d57c |
56 | /* Action to do when background computation completed. |
57 | * |
58 | * Eventually, will have to check that every requested traces are finished |
59 | * before doing the redraw. |
60 | */ |
61 | |
62 | gint background_ready(void *hook_data, void *call_data) |
63 | { |
64 | ControlFlowData *control_flow_data = (ControlFlowData *)hook_data; |
65 | LttvTrace *trace = (LttvTrace*)call_data; |
66 | |
67 | g_debug("control flow viewer : background computation data ready."); |
68 | |
69 | redraw_notify(control_flow_data, NULL); |
70 | |
71 | return 0; |
72 | } |
73 | |
74 | |
75 | /* Request background computation. Verify if it is in progress or ready first. |
76 | * |
77 | * Right now, for all loaded traces. |
78 | * |
79 | * Later : must be only for each trace in the tab's traceset. |
80 | */ |
81 | void request_background_data(ControlFlowData *control_flow_data) |
82 | { |
83 | gint num_traces = lttvwindowtraces_get_number(); |
84 | gint i; |
85 | LttvTrace *trace; |
86 | |
87 | LttvHooks *background_ready_hook = |
88 | lttv_hooks_new(); |
89 | lttv_hooks_add(background_ready_hook, background_ready, control_flow_data, |
90 | LTTV_PRIO_DEFAULT); |
91 | |
92 | for(i=0;i<num_traces;i++) { |
93 | trace = lttvwindowtraces_get_trace(i); |
94 | |
95 | if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE) { |
96 | |
97 | if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"), |
98 | trace) == FALSE) { |
99 | /* We first remove requests that could have been done for the same |
100 | * information. Happens when two viewers ask for it before servicing |
101 | * starts. |
102 | */ |
103 | lttvwindowtraces_background_request_remove(trace, "state"); |
104 | lttvwindowtraces_background_request_queue(trace, |
105 | "state"); |
106 | lttvwindowtraces_background_notify_queue(control_flow_data, |
107 | trace, |
108 | ltt_time_infinite, |
109 | NULL, |
110 | background_ready_hook); |
111 | } else { /* in progress */ |
112 | |
113 | lttvwindowtraces_background_notify_current(control_flow_data, |
114 | trace, |
115 | ltt_time_infinite, |
116 | NULL, |
117 | background_ready_hook); |
118 | |
119 | } |
120 | } |
121 | } |
122 | |
123 | lttv_hooks_destroy(background_ready_hook); |
124 | } |
125 | |
126 | |
127 | |
128 | |
f0d936c0 |
129 | /** |
130 | * Event Viewer's constructor hook |
131 | * |
132 | * This constructor is given as a parameter to the menuitem and toolbar button |
133 | * registration. It creates the list. |
ca0f8a8e |
134 | * @param tab A pointer to the parent tab. |
f0d936c0 |
135 | * @return The widget created. |
136 | */ |
137 | GtkWidget * |
ca0f8a8e |
138 | h_guicontrolflow(Tab *tab, LttvTracesetSelector * s, char * key) |
f0d936c0 |
139 | { |
ca0f8a8e |
140 | g_info("h_guicontrolflow, %p, %p, %s", tab, s, key); |
68997a22 |
141 | ControlFlowData *control_flow_data = guicontrolflow() ; |
a56a1ba4 |
142 | |
ca0f8a8e |
143 | control_flow_data->tab = tab; |
a56a1ba4 |
144 | |
2a2fa4f0 |
145 | //g_debug("time width2 : %u",time_window->time_width); |
a56a1ba4 |
146 | // Unreg done in the GuiControlFlow_Destructor |
6395d57c |
147 | lttvwindow_register_traceset_notify(tab, |
148 | traceset_notify, |
149 | control_flow_data); |
150 | |
ca0f8a8e |
151 | lttvwindow_register_time_window_notify(tab, |
224446ce |
152 | update_time_window_hook, |
153 | control_flow_data); |
ca0f8a8e |
154 | lttvwindow_register_current_time_notify(tab, |
224446ce |
155 | update_current_time_hook, |
156 | control_flow_data); |
ca0f8a8e |
157 | lttvwindow_register_redraw_notify(tab, |
158 | redraw_notify, |
159 | control_flow_data); |
160 | lttvwindow_register_continue_notify(tab, |
161 | continue_notify, |
162 | control_flow_data); |
6395d57c |
163 | request_background_data(control_flow_data); |
164 | |
ca0f8a8e |
165 | |
68997a22 |
166 | return guicontrolflow_get_widget(control_flow_data) ; |
a56a1ba4 |
167 | |
f0d936c0 |
168 | } |
169 | |
3cff8cc1 |
170 | int event_selected_hook(void *hook_data, void *call_data) |
f0d936c0 |
171 | { |
68997a22 |
172 | ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
14963be0 |
173 | guint *event_number = (guint*) call_data; |
f0d936c0 |
174 | |
2a2fa4f0 |
175 | g_debug("DEBUG : event selected by main window : %u", *event_number); |
a56a1ba4 |
176 | |
14963be0 |
177 | // control_flow_data->currently_Selected_Event = *event_number; |
68997a22 |
178 | // control_flow_data->Selected_Event = TRUE ; |
a56a1ba4 |
179 | |
68997a22 |
180 | // tree_v_set_cursor(control_flow_data); |
f0d936c0 |
181 | |
182 | } |
183 | |
f0d936c0 |
184 | /* Hook called before drawing. Gets the initial context at the beginning of the |
14963be0 |
185 | * drawing interval and copy it to the context in event_request. |
f0d936c0 |
186 | */ |
4c69e0cc |
187 | int draw_before_hook(void *hook_data, void *call_data) |
f0d936c0 |
188 | { |
ca0f8a8e |
189 | EventsRequest *events_request = (EventsRequest*)hook_data; |
a56a1ba4 |
190 | //EventsContext Events_Context = (EventsContext*)call_data; |
191 | |
14963be0 |
192 | //event_request->Events_Context = Events_Context; |
f0d936c0 |
193 | |
a56a1ba4 |
194 | return 0; |
f0d936c0 |
195 | } |
196 | |
197 | /* |
198 | * The draw event hook is called by the reading API to have a |
199 | * particular event drawn on the screen. |
200 | * @param hook_data ControlFlowData structure of the viewer. |
201 | * @param call_data Event context. |
202 | * |
203 | * This function basically draw lines and icons. Two types of lines are drawn : |
204 | * one small (3 pixels?) representing the state of the process and the second |
205 | * type is thicker (10 pixels?) representing on which CPU a process is running |
206 | * (and this only in running state). |
207 | * |
208 | * Extremums of the lines : |
209 | * x_min : time of the last event context for this process kept in memory. |
210 | * x_max : time of the current event. |
211 | * y : middle of the process in the process list. The process is found in the |
212 | * list, therefore is it's position in pixels. |
213 | * |
214 | * The choice of lines'color is defined by the context of the last event for this |
215 | * process. |
216 | */ |
4c69e0cc |
217 | int draw_event_hook(void *hook_data, void *call_data) |
f0d936c0 |
218 | { |
ca0f8a8e |
219 | EventsRequest *events_request = (EventsRequest*)hook_data; |
220 | ControlFlowData *control_flow_data = |
221 | (ControlFlowData*)events_request->viewer_data; |
222 | Tab *tab = control_flow_data->tab; |
e9a9c513 |
223 | |
a56a1ba4 |
224 | LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; |
e9a9c513 |
225 | |
226 | LttvTracefileState *tfs = (LttvTracefileState *)call_data; |
1aff52a2 |
227 | LttvTraceState *ts =(LttvTraceState *)LTTV_TRACEFILE_CONTEXT(tfs)->t_context; |
a56a1ba4 |
228 | |
e9a9c513 |
229 | LttEvent *e; |
e9a9c513 |
230 | e = tfc->e; |
231 | |
9444deae |
232 | LttTime evtime = ltt_event_time(e); |
ca0f8a8e |
233 | TimeWindow time_window = |
234 | lttvwindow_get_time_window(tab); |
9444deae |
235 | |
ca0f8a8e |
236 | LttTime end_time = ltt_time_add(time_window.start_time, |
237 | time_window.time_width); |
9444deae |
238 | //if(time < time_beg || time > time_end) return; |
ca0f8a8e |
239 | if(ltt_time_compare(evtime, time_window.start_time) == -1 |
9444deae |
240 | || ltt_time_compare(evtime, end_time) == 1) |
241 | return; |
242 | |
a56a1ba4 |
243 | if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0) |
244 | { |
2a2fa4f0 |
245 | g_debug("schedchange!"); |
a56a1ba4 |
246 | |
247 | /* Add process to process list (if not present) and get drawing "y" from |
248 | * process position */ |
249 | guint pid_out, pid_in; |
250 | LttvProcessState *process_out, *process_in; |
251 | LttTime birth; |
252 | guint y_in = 0, y_out = 0, height = 0, pl_height = 0; |
253 | |
254 | ProcessList *process_list = |
ca0f8a8e |
255 | guicontrolflow_get_process_list(control_flow_data); |
a56a1ba4 |
256 | |
257 | |
258 | LttField *f = ltt_event_field(e); |
259 | LttField *element; |
260 | element = ltt_field_member(f,0); |
261 | pid_out = ltt_event_get_long_unsigned(e,element); |
262 | element = ltt_field_member(f,1); |
263 | pid_in = ltt_event_get_long_unsigned(e,element); |
2a2fa4f0 |
264 | g_debug("out : %u in : %u", pid_out, pid_in); |
a56a1ba4 |
265 | |
266 | |
267 | /* Find process pid_out in the list... */ |
87658614 |
268 | process_out = lttv_state_find_process(tfs, pid_out); |
1aff52a2 |
269 | if(process_out == NULL) return 0; |
2a2fa4f0 |
270 | g_debug("out : %s",g_quark_to_string(process_out->state->s)); |
1aff52a2 |
271 | |
a56a1ba4 |
272 | birth = process_out->creation_time; |
51705146 |
273 | const gchar *name = g_quark_to_string(process_out->name); |
14963be0 |
274 | HashedProcessData *hashed_process_data_out = NULL; |
a56a1ba4 |
275 | |
276 | if(processlist_get_process_pixels(process_list, |
277 | pid_out, |
278 | &birth, |
d0cd7f09 |
279 | tfc->t_context->index, |
a56a1ba4 |
280 | &y_out, |
281 | &height, |
14963be0 |
282 | &hashed_process_data_out) == 1) |
a56a1ba4 |
283 | { |
51705146 |
284 | /* Process not present */ |
285 | processlist_add(process_list, |
286 | pid_out, |
287 | &birth, |
288 | tfc->t_context->index, |
289 | name, |
290 | &pl_height, |
291 | &hashed_process_data_out); |
292 | g_assert(processlist_get_process_pixels(process_list, |
293 | pid_out, |
294 | &birth, |
295 | tfc->t_context->index, |
296 | &y_out, |
297 | &height, |
298 | &hashed_process_data_out)==0); |
299 | drawing_insert_square( control_flow_data->drawing, y_out, height); |
a56a1ba4 |
300 | } |
51705146 |
301 | //g_free(name); |
a56a1ba4 |
302 | |
303 | /* Find process pid_in in the list... */ |
87658614 |
304 | process_in = lttv_state_find_process(tfs, pid_in); |
1aff52a2 |
305 | if(process_in == NULL) return 0; |
2a2fa4f0 |
306 | g_debug("in : %s",g_quark_to_string(process_in->state->s)); |
a56a1ba4 |
307 | |
308 | birth = process_in->creation_time; |
51705146 |
309 | name = g_quark_to_string(process_in->name); |
14963be0 |
310 | HashedProcessData *hashed_process_data_in = NULL; |
a56a1ba4 |
311 | |
312 | if(processlist_get_process_pixels(process_list, |
313 | pid_in, |
314 | &birth, |
d0cd7f09 |
315 | tfc->t_context->index, |
a56a1ba4 |
316 | &y_in, |
317 | &height, |
14963be0 |
318 | &hashed_process_data_in) == 1) |
a56a1ba4 |
319 | { |
51705146 |
320 | /* Process not present */ |
a56a1ba4 |
321 | processlist_add(process_list, |
322 | pid_in, |
323 | &birth, |
d0cd7f09 |
324 | tfc->t_context->index, |
a56a1ba4 |
325 | name, |
326 | &pl_height, |
14963be0 |
327 | &hashed_process_data_in); |
a56a1ba4 |
328 | processlist_get_process_pixels(process_list, |
329 | pid_in, |
330 | &birth, |
d0cd7f09 |
331 | tfc->t_context->index, |
a56a1ba4 |
332 | &y_in, |
333 | &height, |
14963be0 |
334 | &hashed_process_data_in); |
a56a1ba4 |
335 | |
ca0f8a8e |
336 | drawing_insert_square( control_flow_data->drawing, y_in, height); |
a56a1ba4 |
337 | } |
51705146 |
338 | //g_free(name); |
a56a1ba4 |
339 | |
340 | |
341 | /* Find pixels corresponding to time of the event. If the time does |
342 | * not fit in the window, show a warning, not supposed to happend. */ |
343 | guint x = 0; |
51705146 |
344 | guint width = control_flow_data->drawing->width; |
a56a1ba4 |
345 | |
346 | LttTime time = ltt_event_time(e); |
347 | |
ca0f8a8e |
348 | LttTime window_end = ltt_time_add(time_window.time_width, |
349 | time_window.start_time); |
a56a1ba4 |
350 | |
351 | |
352 | convert_time_to_pixels( |
ca0f8a8e |
353 | time_window.start_time, |
a56a1ba4 |
354 | window_end, |
355 | time, |
356 | width, |
357 | &x); |
9444deae |
358 | //assert(x <= width); |
51705146 |
359 | // |
a56a1ba4 |
360 | /* draw what represents the event for outgoing process. */ |
361 | |
14963be0 |
362 | DrawContext *draw_context_out = hashed_process_data_out->draw_context; |
68997a22 |
363 | draw_context_out->current->modify_over->x = x; |
319e9d81 |
364 | draw_context_out->current->modify_under->x = x; |
68997a22 |
365 | draw_context_out->current->modify_over->y = y_out; |
319e9d81 |
366 | draw_context_out->current->modify_under->y = y_out+(height/2)+2; |
501d5405 |
367 | draw_context_out->drawable = control_flow_data->drawing->pixmap; |
368 | draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; |
369 | GtkWidget *widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
370 | //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
d0cd7f09 |
371 | //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
372 | //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); |
a56a1ba4 |
373 | //draw_context_out->gc = widget->style->black_gc; |
374 | |
375 | //draw_arc((void*)&prop_arc, (void*)draw_context_out); |
501d5405 |
376 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
a56a1ba4 |
377 | |
d0cd7f09 |
378 | /* Draw the line/background of the out process */ |
379 | if(draw_context_out->previous->middle->x == -1) |
380 | { |
ca0f8a8e |
381 | draw_context_out->previous->over->x = |
382 | control_flow_data->drawing->damage_begin; |
383 | draw_context_out->previous->middle->x = |
384 | control_flow_data->drawing->damage_begin; |
385 | draw_context_out->previous->under->x = |
386 | control_flow_data->drawing->damage_begin; |
387 | |
388 | g_debug("out middle x_beg : %u",control_flow_data->drawing->damage_begin); |
d0cd7f09 |
389 | } |
390 | |
391 | draw_context_out->current->middle->x = x; |
392 | draw_context_out->current->over->x = x; |
393 | draw_context_out->current->under->x = x; |
394 | draw_context_out->current->middle->y = y_out + height/2; |
395 | draw_context_out->current->over->y = y_out; |
396 | draw_context_out->current->under->y = y_out + height; |
397 | draw_context_out->previous->middle->y = y_out + height/2; |
398 | draw_context_out->previous->over->y = y_out; |
399 | draw_context_out->previous->under->y = y_out + height; |
400 | |
401 | draw_context_out->drawable = control_flow_data->drawing->pixmap; |
402 | draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; |
403 | |
404 | if(process_out->state->s == LTTV_STATE_RUN) |
405 | { |
51705146 |
406 | //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
407 | //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); |
408 | draw_context_out->gc = control_flow_data->drawing->gc; |
d0cd7f09 |
409 | |
410 | PropertiesBG prop_bg; |
411 | prop_bg.color = g_new(GdkColor,1); |
412 | |
413 | switch(tfc->index) { |
414 | case 0: |
415 | prop_bg.color->red = 0x1515; |
416 | prop_bg.color->green = 0x1515; |
417 | prop_bg.color->blue = 0x8c8c; |
418 | break; |
419 | case 1: |
420 | prop_bg.color->red = 0x4e4e; |
421 | prop_bg.color->green = 0xa9a9; |
422 | prop_bg.color->blue = 0xa4a4; |
423 | break; |
424 | case 2: |
425 | prop_bg.color->red = 0x7a7a; |
426 | prop_bg.color->green = 0x4a4a; |
427 | prop_bg.color->blue = 0x8b8b; |
428 | break; |
429 | case 3: |
430 | prop_bg.color->red = 0x8080; |
431 | prop_bg.color->green = 0x7777; |
432 | prop_bg.color->blue = 0x4747; |
433 | break; |
434 | default: |
435 | prop_bg.color->red = 0xe7e7; |
436 | prop_bg.color->green = 0xe7e7; |
437 | prop_bg.color->blue = 0xe7e7; |
438 | } |
439 | |
2a2fa4f0 |
440 | g_debug("calling from draw_event"); |
d0cd7f09 |
441 | draw_bg((void*)&prop_bg, (void*)draw_context_out); |
442 | g_free(prop_bg.color); |
51705146 |
443 | //gdk_gc_unref(draw_context_out->gc); |
d0cd7f09 |
444 | } |
445 | |
446 | draw_context_out->gc = widget->style->black_gc; |
447 | |
a56a1ba4 |
448 | GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 }; |
2df6f2bd |
449 | GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
450 | PropertiesText prop_text_out; |
451 | prop_text_out.foreground = &colorfg_out; |
452 | prop_text_out.background = &colorbg_out; |
cfe526b1 |
453 | prop_text_out.size = 6; |
a56a1ba4 |
454 | prop_text_out.position = OVER; |
455 | |
cfe526b1 |
456 | /* color of text : status of the process */ |
457 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
458 | { |
459 | prop_text_out.foreground->red = 0xffff; |
460 | prop_text_out.foreground->green = 0xffff; |
461 | prop_text_out.foreground->blue = 0xffff; |
462 | } |
463 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
464 | { |
465 | prop_text_out.foreground->red = 0x0fff; |
d52cfc84 |
466 | prop_text_out.foreground->green = 0xffff; |
467 | prop_text_out.foreground->blue = 0xfff0; |
cfe526b1 |
468 | } |
469 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
470 | { |
2df6f2bd |
471 | prop_text_out.foreground->red = 0xffff; |
472 | prop_text_out.foreground->green = 0xffff; |
cfe526b1 |
473 | prop_text_out.foreground->blue = 0x0000; |
474 | } |
475 | else if(process_out->state->s == LTTV_STATE_EXIT) |
476 | { |
477 | prop_text_out.foreground->red = 0xffff; |
478 | prop_text_out.foreground->green = 0x0000; |
479 | prop_text_out.foreground->blue = 0xffff; |
480 | } |
481 | else if(process_out->state->s == LTTV_STATE_WAIT) |
482 | { |
483 | prop_text_out.foreground->red = 0xffff; |
484 | prop_text_out.foreground->green = 0x0000; |
485 | prop_text_out.foreground->blue = 0x0000; |
486 | } |
487 | else if(process_out->state->s == LTTV_STATE_RUN) |
488 | { |
489 | prop_text_out.foreground->red = 0x0000; |
490 | prop_text_out.foreground->green = 0xffff; |
491 | prop_text_out.foreground->blue = 0x0000; |
492 | } |
493 | else |
494 | { |
495 | prop_text_out.foreground->red = 0xffff; |
496 | prop_text_out.foreground->green = 0xffff; |
497 | prop_text_out.foreground->blue = 0xffff; |
498 | } |
499 | |
d52cfc84 |
500 | |
a56a1ba4 |
501 | /* Print status of the process : U, WF, WC, E, W, R */ |
502 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
cfe526b1 |
503 | prop_text_out.text = "U->"; |
a56a1ba4 |
504 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
cfe526b1 |
505 | prop_text_out.text = "WF->"; |
a56a1ba4 |
506 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
cfe526b1 |
507 | prop_text_out.text = "WC->"; |
a56a1ba4 |
508 | else if(process_out->state->s == LTTV_STATE_EXIT) |
cfe526b1 |
509 | prop_text_out.text = "E->"; |
a56a1ba4 |
510 | else if(process_out->state->s == LTTV_STATE_WAIT) |
cfe526b1 |
511 | prop_text_out.text = "W->"; |
a56a1ba4 |
512 | else if(process_out->state->s == LTTV_STATE_RUN) |
cfe526b1 |
513 | prop_text_out.text = "R->"; |
a56a1ba4 |
514 | else |
68997a22 |
515 | prop_text_out.text = "U"; |
a56a1ba4 |
516 | |
517 | draw_text((void*)&prop_text_out, (void*)draw_context_out); |
d0cd7f09 |
518 | //gdk_gc_unref(draw_context_out->gc); |
a56a1ba4 |
519 | |
51705146 |
520 | //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
521 | //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); |
522 | draw_context_out->gc = control_flow_data->drawing->gc; |
a56a1ba4 |
523 | |
524 | PropertiesLine prop_line_out; |
525 | prop_line_out.color = g_new(GdkColor,1); |
cfe526b1 |
526 | prop_line_out.line_width = 2; |
a56a1ba4 |
527 | prop_line_out.style = GDK_LINE_SOLID; |
528 | prop_line_out.position = MIDDLE; |
d52cfc84 |
529 | |
2a2fa4f0 |
530 | g_debug("out state : %s", g_quark_to_string(process_out->state->s)); |
a56a1ba4 |
531 | |
532 | /* color of line : status of the process */ |
533 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
534 | { |
cfe526b1 |
535 | prop_line_out.color->red = 0xffff; |
536 | prop_line_out.color->green = 0xffff; |
537 | prop_line_out.color->blue = 0xffff; |
a56a1ba4 |
538 | } |
539 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
540 | { |
541 | prop_line_out.color->red = 0x0fff; |
d52cfc84 |
542 | prop_line_out.color->green = 0xffff; |
543 | prop_line_out.color->blue = 0xfff0; |
a56a1ba4 |
544 | } |
545 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
546 | { |
2df6f2bd |
547 | prop_line_out.color->red = 0xffff; |
548 | prop_line_out.color->green = 0xffff; |
a56a1ba4 |
549 | prop_line_out.color->blue = 0x0000; |
550 | } |
551 | else if(process_out->state->s == LTTV_STATE_EXIT) |
552 | { |
553 | prop_line_out.color->red = 0xffff; |
554 | prop_line_out.color->green = 0x0000; |
555 | prop_line_out.color->blue = 0xffff; |
556 | } |
557 | else if(process_out->state->s == LTTV_STATE_WAIT) |
558 | { |
559 | prop_line_out.color->red = 0xffff; |
560 | prop_line_out.color->green = 0x0000; |
561 | prop_line_out.color->blue = 0x0000; |
562 | } |
563 | else if(process_out->state->s == LTTV_STATE_RUN) |
564 | { |
565 | prop_line_out.color->red = 0x0000; |
566 | prop_line_out.color->green = 0xffff; |
567 | prop_line_out.color->blue = 0x0000; |
568 | } |
569 | else |
570 | { |
cfe526b1 |
571 | prop_line_out.color->red = 0xffff; |
572 | prop_line_out.color->green = 0xffff; |
573 | prop_line_out.color->blue = 0xffff; |
a56a1ba4 |
574 | } |
575 | |
576 | draw_line((void*)&prop_line_out, (void*)draw_context_out); |
577 | g_free(prop_line_out.color); |
51705146 |
578 | //gdk_gc_unref(draw_context_out->gc); |
a56a1ba4 |
579 | /* Note : finishing line will have to be added when trace read over. */ |
580 | |
581 | /* Finally, update the drawing context of the pid_in. */ |
582 | |
14963be0 |
583 | DrawContext *draw_context_in = hashed_process_data_in->draw_context; |
68997a22 |
584 | draw_context_in->current->modify_over->x = x; |
319e9d81 |
585 | draw_context_in->current->modify_under->x = x; |
68997a22 |
586 | draw_context_in->current->modify_over->y = y_in; |
319e9d81 |
587 | draw_context_in->current->modify_under->y = y_in+(height/2)+2; |
501d5405 |
588 | draw_context_in->drawable = control_flow_data->drawing->pixmap; |
589 | draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; |
590 | widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
591 | //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
592 | //draw_context_in->gc = widget->style->black_gc; |
d0cd7f09 |
593 | //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
594 | //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); |
a56a1ba4 |
595 | |
596 | //draw_arc((void*)&prop_arc, (void*)draw_context_in); |
501d5405 |
597 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
d0cd7f09 |
598 | |
599 | /* Draw the line/bg of the in process */ |
600 | if(draw_context_in->previous->middle->x == -1) |
601 | { |
ca0f8a8e |
602 | draw_context_in->previous->over->x = |
603 | control_flow_data->drawing->damage_begin; |
604 | draw_context_in->previous->middle->x = |
605 | control_flow_data->drawing->damage_begin; |
606 | draw_context_in->previous->under->x = |
607 | control_flow_data->drawing->damage_begin; |
608 | |
609 | g_debug("in middle x_beg : %u",control_flow_data->drawing->damage_begin); |
610 | |
d0cd7f09 |
611 | } |
612 | |
613 | draw_context_in->current->middle->x = x; |
614 | draw_context_in->current->over->x = x; |
615 | draw_context_in->current->under->x = x; |
616 | draw_context_in->current->middle->y = y_in + height/2; |
617 | draw_context_in->current->over->y = y_in; |
618 | draw_context_in->current->under->y = y_in + height; |
619 | draw_context_in->previous->middle->y = y_in + height/2; |
620 | draw_context_in->previous->over->y = y_in; |
621 | draw_context_in->previous->under->y = y_in + height; |
a56a1ba4 |
622 | |
d0cd7f09 |
623 | draw_context_in->drawable = control_flow_data->drawing->pixmap; |
624 | draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; |
625 | |
626 | |
627 | if(process_in->state->s == LTTV_STATE_RUN) |
628 | { |
51705146 |
629 | //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
630 | //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); |
631 | draw_context_in->gc = control_flow_data->drawing->gc; |
d0cd7f09 |
632 | |
633 | PropertiesBG prop_bg; |
634 | prop_bg.color = g_new(GdkColor,1); |
635 | |
636 | switch(tfc->index) { |
637 | case 0: |
638 | prop_bg.color->red = 0x1515; |
639 | prop_bg.color->green = 0x1515; |
640 | prop_bg.color->blue = 0x8c8c; |
641 | break; |
642 | case 1: |
643 | prop_bg.color->red = 0x4e4e; |
644 | prop_bg.color->green = 0xa9a9; |
645 | prop_bg.color->blue = 0xa4a4; |
646 | break; |
647 | case 2: |
648 | prop_bg.color->red = 0x7a7a; |
649 | prop_bg.color->green = 0x4a4a; |
650 | prop_bg.color->blue = 0x8b8b; |
651 | break; |
652 | case 3: |
653 | prop_bg.color->red = 0x8080; |
654 | prop_bg.color->green = 0x7777; |
655 | prop_bg.color->blue = 0x4747; |
656 | break; |
657 | default: |
658 | prop_bg.color->red = 0xe7e7; |
659 | prop_bg.color->green = 0xe7e7; |
660 | prop_bg.color->blue = 0xe7e7; |
661 | } |
662 | |
663 | |
664 | draw_bg((void*)&prop_bg, (void*)draw_context_in); |
665 | g_free(prop_bg.color); |
51705146 |
666 | //gdk_gc_unref(draw_context_in->gc); |
d0cd7f09 |
667 | } |
668 | |
669 | draw_context_in->gc = widget->style->black_gc; |
670 | |
a56a1ba4 |
671 | GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 }; |
2df6f2bd |
672 | GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
673 | PropertiesText prop_text_in; |
674 | prop_text_in.foreground = &colorfg_in; |
675 | prop_text_in.background = &colorbg_in; |
cfe526b1 |
676 | prop_text_in.size = 6; |
a56a1ba4 |
677 | prop_text_in.position = OVER; |
678 | |
2a2fa4f0 |
679 | g_debug("in state : %s", g_quark_to_string(process_in->state->s)); |
cfe526b1 |
680 | /* foreground of text : status of the process */ |
681 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
682 | { |
683 | prop_text_in.foreground->red = 0xffff; |
684 | prop_text_in.foreground->green = 0xffff; |
685 | prop_text_in.foreground->blue = 0xffff; |
686 | } |
687 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
688 | { |
689 | prop_text_in.foreground->red = 0x0fff; |
d52cfc84 |
690 | prop_text_in.foreground->green = 0xffff; |
691 | prop_text_in.foreground->blue = 0xfff0; |
cfe526b1 |
692 | } |
693 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
694 | { |
2df6f2bd |
695 | prop_text_in.foreground->red = 0xffff; |
696 | prop_text_in.foreground->green = 0xffff; |
cfe526b1 |
697 | prop_text_in.foreground->blue = 0x0000; |
698 | } |
699 | else if(process_in->state->s == LTTV_STATE_EXIT) |
700 | { |
701 | prop_text_in.foreground->red = 0xffff; |
702 | prop_text_in.foreground->green = 0x0000; |
703 | prop_text_in.foreground->blue = 0xffff; |
704 | } |
705 | else if(process_in->state->s == LTTV_STATE_WAIT) |
706 | { |
707 | prop_text_in.foreground->red = 0xffff; |
708 | prop_text_in.foreground->green = 0x0000; |
709 | prop_text_in.foreground->blue = 0x0000; |
710 | } |
711 | else if(process_in->state->s == LTTV_STATE_RUN) |
712 | { |
713 | prop_text_in.foreground->red = 0x0000; |
714 | prop_text_in.foreground->green = 0xffff; |
715 | prop_text_in.foreground->blue = 0x0000; |
716 | } |
717 | else |
718 | { |
719 | prop_text_in.foreground->red = 0xffff; |
720 | prop_text_in.foreground->green = 0xffff; |
721 | prop_text_in.foreground->blue = 0xffff; |
722 | } |
723 | |
724 | |
725 | |
a56a1ba4 |
726 | /* Print status of the process : U, WF, WC, E, W, R */ |
727 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
cfe526b1 |
728 | prop_text_in.text = "U->"; |
a56a1ba4 |
729 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
cfe526b1 |
730 | prop_text_in.text = "WF->"; |
a56a1ba4 |
731 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
cfe526b1 |
732 | prop_text_in.text = "WC->"; |
a56a1ba4 |
733 | else if(process_in->state->s == LTTV_STATE_EXIT) |
cfe526b1 |
734 | prop_text_in.text = "E->"; |
a56a1ba4 |
735 | else if(process_in->state->s == LTTV_STATE_WAIT) |
cfe526b1 |
736 | prop_text_in.text = "W->"; |
a56a1ba4 |
737 | else if(process_in->state->s == LTTV_STATE_RUN) |
cfe526b1 |
738 | prop_text_in.text = "R->"; |
a56a1ba4 |
739 | else |
68997a22 |
740 | prop_text_in.text = "U"; |
a56a1ba4 |
741 | |
742 | draw_text((void*)&prop_text_in, (void*)draw_context_in); |
d0cd7f09 |
743 | //gdk_gc_unref(draw_context_in->gc); |
744 | |
51705146 |
745 | //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
746 | //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); |
747 | draw_context_in->gc = control_flow_data->drawing->gc; |
d0cd7f09 |
748 | |
a56a1ba4 |
749 | PropertiesLine prop_line_in; |
750 | prop_line_in.color = g_new(GdkColor,1); |
cfe526b1 |
751 | prop_line_in.line_width = 2; |
a56a1ba4 |
752 | prop_line_in.style = GDK_LINE_SOLID; |
753 | prop_line_in.position = MIDDLE; |
754 | |
755 | /* color of line : status of the process */ |
756 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
757 | { |
cfe526b1 |
758 | prop_line_in.color->red = 0xffff; |
759 | prop_line_in.color->green = 0xffff; |
760 | prop_line_in.color->blue = 0xffff; |
a56a1ba4 |
761 | } |
762 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
763 | { |
764 | prop_line_in.color->red = 0x0fff; |
d52cfc84 |
765 | prop_line_in.color->green = 0xffff; |
766 | prop_line_in.color->blue = 0xfff0; |
a56a1ba4 |
767 | } |
768 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
769 | { |
2df6f2bd |
770 | prop_line_in.color->red = 0xffff; |
771 | prop_line_in.color->green = 0xffff; |
a56a1ba4 |
772 | prop_line_in.color->blue = 0x0000; |
773 | } |
774 | else if(process_in->state->s == LTTV_STATE_EXIT) |
775 | { |
776 | prop_line_in.color->red = 0xffff; |
777 | prop_line_in.color->green = 0x0000; |
778 | prop_line_in.color->blue = 0xffff; |
779 | } |
780 | else if(process_in->state->s == LTTV_STATE_WAIT) |
781 | { |
782 | prop_line_in.color->red = 0xffff; |
783 | prop_line_in.color->green = 0x0000; |
784 | prop_line_in.color->blue = 0x0000; |
785 | } |
786 | else if(process_in->state->s == LTTV_STATE_RUN) |
787 | { |
788 | prop_line_in.color->red = 0x0000; |
789 | prop_line_in.color->green = 0xffff; |
790 | prop_line_in.color->blue = 0x0000; |
791 | } |
792 | else |
793 | { |
cfe526b1 |
794 | prop_line_in.color->red = 0xffff; |
795 | prop_line_in.color->green = 0xffff; |
796 | prop_line_in.color->blue = 0xffff; |
a56a1ba4 |
797 | } |
798 | |
799 | draw_line((void*)&prop_line_in, (void*)draw_context_in); |
800 | g_free(prop_line_in.color); |
51705146 |
801 | //gdk_gc_unref(draw_context_in->gc); |
a56a1ba4 |
802 | } |
803 | |
804 | return 0; |
805 | |
51705146 |
806 | /* Text dump */ |
80a52ff8 |
807 | #ifdef DONTSHOW |
a56a1ba4 |
808 | GString *string = g_string_new("");; |
809 | gboolean field_names = TRUE, state = TRUE; |
80a52ff8 |
810 | |
e9a9c513 |
811 | lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs); |
812 | g_string_append_printf(string,"\n"); |
813 | |
814 | if(state) { |
815 | g_string_append_printf(string, " %s", |
816 | g_quark_to_string(tfs->process->state->s)); |
817 | } |
818 | |
819 | g_info("%s",string->str); |
820 | |
a56a1ba4 |
821 | g_string_free(string, TRUE); |
822 | |
823 | /* End of text dump */ |
80a52ff8 |
824 | #endif //DONTSHOW |
50439712 |
825 | |
f0d936c0 |
826 | } |
827 | |
828 | |
4c69e0cc |
829 | int draw_after_hook(void *hook_data, void *call_data) |
f0d936c0 |
830 | { |
ca0f8a8e |
831 | EventsRequest *events_request = (EventsRequest*)hook_data; |
832 | ControlFlowData *control_flow_data = events_request->viewer_data; |
50439712 |
833 | |
a56a1ba4 |
834 | LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; |
50439712 |
835 | |
836 | LttvTracefileState *tfs = (LttvTracefileState *)call_data; |
1aff52a2 |
837 | LttvTraceState *ts =(LttvTraceState *)LTTV_TRACEFILE_CONTEXT(tfs)->t_context; |
50439712 |
838 | |
a56a1ba4 |
839 | |
50439712 |
840 | LttEvent *e; |
841 | e = tfc->e; |
842 | |
9444deae |
843 | LttTime evtime = ltt_event_time(e); |
ca0f8a8e |
844 | TimeWindow time_window = |
845 | lttvwindow_get_time_window(control_flow_data->tab); |
9444deae |
846 | |
ca0f8a8e |
847 | LttTime end_time = ltt_time_add(time_window.start_time, |
848 | time_window.time_width); |
9444deae |
849 | //if(time < time_beg || time > time_end) return; |
ca0f8a8e |
850 | if(ltt_time_compare(evtime, time_window.start_time) == -1 |
9444deae |
851 | || ltt_time_compare(evtime, end_time) == 1) |
852 | return; |
853 | |
854 | |
a56a1ba4 |
855 | if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0) |
856 | { |
2a2fa4f0 |
857 | g_debug("schedchange!"); |
a56a1ba4 |
858 | |
859 | /* Add process to process list (if not present) and get drawing "y" from |
860 | * process position */ |
861 | guint pid_out, pid_in; |
862 | LttvProcessState *process_out, *process_in; |
863 | LttTime birth; |
864 | guint y_in = 0, y_out = 0, height = 0, pl_height = 0; |
865 | |
866 | ProcessList *process_list = |
ca0f8a8e |
867 | guicontrolflow_get_process_list(control_flow_data); |
a56a1ba4 |
868 | |
869 | |
870 | LttField *f = ltt_event_field(e); |
871 | LttField *element; |
872 | element = ltt_field_member(f,0); |
873 | pid_out = ltt_event_get_long_unsigned(e,element); |
874 | element = ltt_field_member(f,1); |
875 | pid_in = ltt_event_get_long_unsigned(e,element); |
2a2fa4f0 |
876 | //g_debug("out : %u in : %u", pid_out, pid_in); |
a56a1ba4 |
877 | |
878 | |
879 | /* Find process pid_out in the list... */ |
2a2fa4f0 |
880 | process_out = lttv_state_find_process(tfs, pid_out); |
1aff52a2 |
881 | if(process_out == NULL) return 0; |
2a2fa4f0 |
882 | //g_debug("out : %s",g_quark_to_string(process_out->state->s)); |
a56a1ba4 |
883 | |
884 | birth = process_out->creation_time; |
885 | gchar *name = strdup(g_quark_to_string(process_out->name)); |
14963be0 |
886 | HashedProcessData *hashed_process_data_out = NULL; |
a56a1ba4 |
887 | |
888 | if(processlist_get_process_pixels(process_list, |
889 | pid_out, |
890 | &birth, |
d0cd7f09 |
891 | tfc->t_context->index, |
a56a1ba4 |
892 | &y_out, |
893 | &height, |
14963be0 |
894 | &hashed_process_data_out) == 1) |
a56a1ba4 |
895 | { |
51705146 |
896 | /* Process not present */ |
897 | processlist_add(process_list, |
898 | pid_out, |
899 | &birth, |
900 | tfc->t_context->index, |
901 | name, |
902 | &pl_height, |
903 | &hashed_process_data_out); |
904 | processlist_get_process_pixels(process_list, |
905 | pid_out, |
906 | &birth, |
907 | tfc->t_context->index, |
908 | &y_out, |
909 | &height, |
910 | &hashed_process_data_out); |
911 | drawing_insert_square( control_flow_data->drawing, y_out, height); |
a56a1ba4 |
912 | } |
913 | |
914 | g_free(name); |
915 | |
916 | /* Find process pid_in in the list... */ |
2a2fa4f0 |
917 | process_in = lttv_state_find_process(tfs, pid_in); |
1aff52a2 |
918 | if(process_in == NULL) return 0; |
2a2fa4f0 |
919 | //g_debug("in : %s",g_quark_to_string(process_in->state->s)); |
a56a1ba4 |
920 | |
921 | birth = process_in->creation_time; |
922 | name = strdup(g_quark_to_string(process_in->name)); |
14963be0 |
923 | HashedProcessData *hashed_process_data_in = NULL; |
a56a1ba4 |
924 | |
925 | if(processlist_get_process_pixels(process_list, |
926 | pid_in, |
927 | &birth, |
d0cd7f09 |
928 | tfc->t_context->index, |
a56a1ba4 |
929 | &y_in, |
930 | &height, |
14963be0 |
931 | &hashed_process_data_in) == 1) |
a56a1ba4 |
932 | { |
933 | /* Process not present */ |
934 | processlist_add(process_list, |
935 | pid_in, |
936 | &birth, |
d0cd7f09 |
937 | tfc->t_context->index, |
a56a1ba4 |
938 | name, |
939 | &pl_height, |
14963be0 |
940 | &hashed_process_data_in); |
a56a1ba4 |
941 | processlist_get_process_pixels(process_list, |
942 | pid_in, |
943 | &birth, |
d0cd7f09 |
944 | tfc->t_context->index, |
a56a1ba4 |
945 | &y_in, |
946 | &height, |
14963be0 |
947 | &hashed_process_data_in); |
a56a1ba4 |
948 | |
ca0f8a8e |
949 | drawing_insert_square( control_flow_data->drawing, y_in, height); |
a56a1ba4 |
950 | } |
951 | g_free(name); |
952 | |
953 | |
954 | /* Find pixels corresponding to time of the event. If the time does |
955 | * not fit in the window, show a warning, not supposed to happend. */ |
956 | //guint x = 0; |
501d5405 |
957 | //guint width = control_flow_data->drawing->drawing_area->allocation.width; |
a56a1ba4 |
958 | |
959 | //LttTime time = ltt_event_time(e); |
960 | |
224446ce |
961 | //LttTime window_end = ltt_time_add(time_window->time_width, |
962 | // time_window->start_time); |
a56a1ba4 |
963 | |
964 | |
965 | //convert_time_to_pixels( |
224446ce |
966 | // time_window->start_time, |
a56a1ba4 |
967 | // window_end, |
968 | // time, |
969 | // width, |
970 | // &x); |
971 | |
972 | //assert(x <= width); |
973 | |
974 | /* draw what represents the event for outgoing process. */ |
975 | |
14963be0 |
976 | DrawContext *draw_context_out = hashed_process_data_out->draw_context; |
68997a22 |
977 | //draw_context_out->current->modify_over->x = x; |
978 | draw_context_out->current->modify_over->y = y_out; |
319e9d81 |
979 | draw_context_out->current->modify_under->y = y_out+(height/2)+2; |
501d5405 |
980 | draw_context_out->drawable = control_flow_data->drawing->pixmap; |
981 | draw_context_out->pango_layout = control_flow_data->drawing->pango_layout; |
982 | GtkWidget *widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
983 | //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
d0cd7f09 |
984 | |
a56a1ba4 |
985 | //draw_arc((void*)&prop_arc, (void*)draw_context_out); |
501d5405 |
986 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
d0cd7f09 |
987 | |
988 | /*if(process_out->state->s == LTTV_STATE_RUN) |
989 | { |
990 | draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
991 | gdk_gc_copy(draw_context_out->gc, widget->style->black_gc); |
992 | PropertiesBG prop_bg; |
993 | prop_bg.color = g_new(GdkColor,1); |
994 | |
995 | prop_bg.color->red = 0xffff; |
996 | prop_bg.color->green = 0xffff; |
997 | prop_bg.color->blue = 0xffff; |
998 | |
999 | draw_bg((void*)&prop_bg, (void*)draw_context_out); |
1000 | g_free(prop_bg.color); |
1001 | gdk_gc_unref(draw_context_out->gc); |
1002 | }*/ |
1003 | |
1004 | draw_context_out->gc = widget->style->black_gc; |
1005 | |
a56a1ba4 |
1006 | GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 }; |
2df6f2bd |
1007 | GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
1008 | PropertiesText prop_text_out; |
1009 | prop_text_out.foreground = &colorfg_out; |
1010 | prop_text_out.background = &colorbg_out; |
cfe526b1 |
1011 | prop_text_out.size = 6; |
a56a1ba4 |
1012 | prop_text_out.position = OVER; |
1013 | |
cfe526b1 |
1014 | /* color of text : status of the process */ |
1015 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
1016 | { |
1017 | prop_text_out.foreground->red = 0xffff; |
1018 | prop_text_out.foreground->green = 0xffff; |
1019 | prop_text_out.foreground->blue = 0xffff; |
1020 | } |
1021 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
1022 | { |
1023 | prop_text_out.foreground->red = 0x0fff; |
d52cfc84 |
1024 | prop_text_out.foreground->green = 0xffff; |
1025 | prop_text_out.foreground->blue = 0xfff0; |
cfe526b1 |
1026 | } |
1027 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
1028 | { |
2df6f2bd |
1029 | prop_text_out.foreground->red = 0xffff; |
1030 | prop_text_out.foreground->green = 0xffff; |
cfe526b1 |
1031 | prop_text_out.foreground->blue = 0x0000; |
1032 | } |
1033 | else if(process_out->state->s == LTTV_STATE_EXIT) |
1034 | { |
1035 | prop_text_out.foreground->red = 0xffff; |
1036 | prop_text_out.foreground->green = 0x0000; |
1037 | prop_text_out.foreground->blue = 0xffff; |
1038 | } |
1039 | else if(process_out->state->s == LTTV_STATE_WAIT) |
1040 | { |
1041 | prop_text_out.foreground->red = 0xffff; |
1042 | prop_text_out.foreground->green = 0x0000; |
1043 | prop_text_out.foreground->blue = 0x0000; |
1044 | } |
1045 | else if(process_out->state->s == LTTV_STATE_RUN) |
1046 | { |
1047 | prop_text_out.foreground->red = 0x0000; |
1048 | prop_text_out.foreground->green = 0xffff; |
1049 | prop_text_out.foreground->blue = 0x0000; |
1050 | } |
1051 | else |
1052 | { |
1053 | prop_text_out.foreground->red = 0xffff; |
1054 | prop_text_out.foreground->green = 0xffff; |
1055 | prop_text_out.foreground->blue = 0xffff; |
1056 | } |
1057 | |
a56a1ba4 |
1058 | /* Print status of the process : U, WF, WC, E, W, R */ |
1059 | if(process_out->state->s == LTTV_STATE_UNNAMED) |
68997a22 |
1060 | prop_text_out.text = "U"; |
a56a1ba4 |
1061 | else if(process_out->state->s == LTTV_STATE_WAIT_FORK) |
68997a22 |
1062 | prop_text_out.text = "WF"; |
a56a1ba4 |
1063 | else if(process_out->state->s == LTTV_STATE_WAIT_CPU) |
68997a22 |
1064 | prop_text_out.text = "WC"; |
a56a1ba4 |
1065 | else if(process_out->state->s == LTTV_STATE_EXIT) |
68997a22 |
1066 | prop_text_out.text = "E"; |
a56a1ba4 |
1067 | else if(process_out->state->s == LTTV_STATE_WAIT) |
68997a22 |
1068 | prop_text_out.text = "W"; |
a56a1ba4 |
1069 | else if(process_out->state->s == LTTV_STATE_RUN) |
68997a22 |
1070 | prop_text_out.text = "R"; |
a56a1ba4 |
1071 | else |
68997a22 |
1072 | prop_text_out.text = "U"; |
a56a1ba4 |
1073 | |
1074 | draw_text((void*)&prop_text_out, (void*)draw_context_out); |
d0cd7f09 |
1075 | |
1076 | //gdk_gc_unref(draw_context_out->gc); |
319e9d81 |
1077 | |
68997a22 |
1078 | draw_context_out->current->middle->y = y_out+height/2; |
d0cd7f09 |
1079 | draw_context_out->current->over->y = y_out; |
1080 | draw_context_out->current->under->y = y_out+height; |
68997a22 |
1081 | draw_context_out->current->status = process_out->state->s; |
a56a1ba4 |
1082 | |
68997a22 |
1083 | /* for pid_out : remove previous, Prev = current, new current (default) */ |
1084 | g_free(draw_context_out->previous->modify_under); |
1085 | g_free(draw_context_out->previous->modify_middle); |
1086 | g_free(draw_context_out->previous->modify_over); |
1087 | g_free(draw_context_out->previous->under); |
1088 | g_free(draw_context_out->previous->middle); |
1089 | g_free(draw_context_out->previous->over); |
1090 | g_free(draw_context_out->previous); |
1091 | |
1092 | draw_context_out->previous = draw_context_out->current; |
a56a1ba4 |
1093 | |
68997a22 |
1094 | draw_context_out->current = g_new(DrawInfo,1); |
1095 | draw_context_out->current->over = g_new(ItemInfo,1); |
1096 | draw_context_out->current->over->x = -1; |
1097 | draw_context_out->current->over->y = -1; |
1098 | draw_context_out->current->middle = g_new(ItemInfo,1); |
1099 | draw_context_out->current->middle->x = -1; |
1100 | draw_context_out->current->middle->y = -1; |
1101 | draw_context_out->current->under = g_new(ItemInfo,1); |
1102 | draw_context_out->current->under->x = -1; |
1103 | draw_context_out->current->under->y = -1; |
1104 | draw_context_out->current->modify_over = g_new(ItemInfo,1); |
1105 | draw_context_out->current->modify_over->x = -1; |
1106 | draw_context_out->current->modify_over->y = -1; |
1107 | draw_context_out->current->modify_middle = g_new(ItemInfo,1); |
1108 | draw_context_out->current->modify_middle->x = -1; |
1109 | draw_context_out->current->modify_middle->y = -1; |
1110 | draw_context_out->current->modify_under = g_new(ItemInfo,1); |
1111 | draw_context_out->current->modify_under->x = -1; |
1112 | draw_context_out->current->modify_under->y = -1; |
1113 | draw_context_out->current->status = LTTV_STATE_UNNAMED; |
a56a1ba4 |
1114 | |
1115 | /* Finally, update the drawing context of the pid_in. */ |
1116 | |
14963be0 |
1117 | DrawContext *draw_context_in = hashed_process_data_in->draw_context; |
68997a22 |
1118 | //draw_context_in->current->modify_over->x = x; |
1119 | draw_context_in->current->modify_over->y = y_in; |
319e9d81 |
1120 | draw_context_in->current->modify_under->y = y_in+(height/2)+2; |
501d5405 |
1121 | draw_context_in->drawable = control_flow_data->drawing->pixmap; |
1122 | draw_context_in->pango_layout = control_flow_data->drawing->pango_layout; |
1123 | widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
1124 | //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
a56a1ba4 |
1125 | |
1126 | //draw_arc((void*)&prop_arc, (void*)draw_context_in); |
501d5405 |
1127 | //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap); |
d0cd7f09 |
1128 | |
1129 | /*if(process_in->state->s == LTTV_STATE_RUN) |
1130 | { |
1131 | draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
1132 | gdk_gc_copy(draw_context_in->gc, widget->style->black_gc); |
1133 | PropertiesBG prop_bg; |
1134 | prop_bg.color = g_new(GdkColor,1); |
1135 | |
1136 | prop_bg.color->red = 0xffff; |
1137 | prop_bg.color->green = 0xffff; |
1138 | prop_bg.color->blue = 0xffff; |
1139 | |
1140 | draw_bg((void*)&prop_bg, (void*)draw_context_in); |
1141 | g_free(prop_bg.color); |
1142 | gdk_gc_unref(draw_context_in->gc); |
1143 | }*/ |
1144 | |
1145 | draw_context_in->gc = widget->style->black_gc; |
1146 | |
a56a1ba4 |
1147 | GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 }; |
2df6f2bd |
1148 | GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 }; |
a56a1ba4 |
1149 | PropertiesText prop_text_in; |
1150 | prop_text_in.foreground = &colorfg_in; |
1151 | prop_text_in.background = &colorbg_in; |
cfe526b1 |
1152 | prop_text_in.size = 6; |
a56a1ba4 |
1153 | prop_text_in.position = OVER; |
1154 | |
cfe526b1 |
1155 | /* foreground of text : status of the process */ |
1156 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
1157 | { |
1158 | prop_text_in.foreground->red = 0xffff; |
1159 | prop_text_in.foreground->green = 0xffff; |
1160 | prop_text_in.foreground->blue = 0xffff; |
1161 | } |
1162 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
1163 | { |
1164 | prop_text_in.foreground->red = 0x0fff; |
d52cfc84 |
1165 | prop_text_in.foreground->green = 0xffff; |
1166 | prop_text_in.foreground->blue = 0xfff0; |
cfe526b1 |
1167 | } |
1168 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
1169 | { |
2df6f2bd |
1170 | prop_text_in.foreground->red = 0xffff; |
1171 | prop_text_in.foreground->green = 0xffff; |
cfe526b1 |
1172 | prop_text_in.foreground->blue = 0x0000; |
1173 | } |
1174 | else if(process_in->state->s == LTTV_STATE_EXIT) |
1175 | { |
1176 | prop_text_in.foreground->red = 0xffff; |
1177 | prop_text_in.foreground->green = 0x0000; |
1178 | prop_text_in.foreground->blue = 0xffff; |
1179 | } |
1180 | else if(process_in->state->s == LTTV_STATE_WAIT) |
1181 | { |
1182 | prop_text_in.foreground->red = 0xffff; |
1183 | prop_text_in.foreground->green = 0x0000; |
1184 | prop_text_in.foreground->blue = 0x0000; |
1185 | } |
1186 | else if(process_in->state->s == LTTV_STATE_RUN) |
1187 | { |
1188 | prop_text_in.foreground->red = 0x0000; |
1189 | prop_text_in.foreground->green = 0xffff; |
1190 | prop_text_in.foreground->blue = 0x0000; |
1191 | } |
1192 | else |
1193 | { |
1194 | prop_text_in.foreground->red = 0xffff; |
1195 | prop_text_in.foreground->green = 0xffff; |
1196 | prop_text_in.foreground->blue = 0xffff; |
1197 | } |
1198 | |
1199 | |
a56a1ba4 |
1200 | /* Print status of the process : U, WF, WC, E, W, R */ |
1201 | if(process_in->state->s == LTTV_STATE_UNNAMED) |
68997a22 |
1202 | prop_text_in.text = "U"; |
a56a1ba4 |
1203 | else if(process_in->state->s == LTTV_STATE_WAIT_FORK) |
68997a22 |
1204 | prop_text_in.text = "WF"; |
a56a1ba4 |
1205 | else if(process_in->state->s == LTTV_STATE_WAIT_CPU) |
68997a22 |
1206 | prop_text_in.text = "WC"; |
a56a1ba4 |
1207 | else if(process_in->state->s == LTTV_STATE_EXIT) |
68997a22 |
1208 | prop_text_in.text = "E"; |
a56a1ba4 |
1209 | else if(process_in->state->s == LTTV_STATE_WAIT) |
68997a22 |
1210 | prop_text_in.text = "W"; |
a56a1ba4 |
1211 | else if(process_in->state->s == LTTV_STATE_RUN) |
68997a22 |
1212 | prop_text_in.text = "R"; |
a56a1ba4 |
1213 | else |
68997a22 |
1214 | prop_text_in.text = "U"; |
a56a1ba4 |
1215 | |
1216 | draw_text((void*)&prop_text_in, (void*)draw_context_in); |
1217 | |
d0cd7f09 |
1218 | |
319e9d81 |
1219 | if(process_in->state->s == LTTV_STATE_RUN) |
1220 | { |
1221 | gchar tmp[255]; |
1222 | prop_text_in.foreground = &colorfg_in; |
1223 | prop_text_in.background = &colorbg_in; |
1224 | prop_text_in.foreground->red = 0xffff; |
1225 | prop_text_in.foreground->green = 0xffff; |
1226 | prop_text_in.foreground->blue = 0xffff; |
1227 | prop_text_in.size = 6; |
1228 | prop_text_in.position = UNDER; |
1229 | |
1230 | prop_text_in.text = g_new(gchar, 260); |
1231 | strcpy(prop_text_in.text, "CPU "); |
1232 | snprintf(tmp, 255, "%u", tfc->index); |
1233 | strcat(prop_text_in.text, tmp); |
1234 | |
1235 | draw_text((void*)&prop_text_in, (void*)draw_context_in); |
1236 | g_free(prop_text_in.text); |
1237 | } |
1238 | |
1239 | |
68997a22 |
1240 | draw_context_in->current->middle->y = y_in+height/2; |
d0cd7f09 |
1241 | draw_context_in->current->over->y = y_in; |
1242 | draw_context_in->current->under->y = y_in+height; |
68997a22 |
1243 | draw_context_in->current->status = process_in->state->s; |
1244 | |
1245 | /* for pid_in : remove previous, Prev = current, new current (default) */ |
1246 | g_free(draw_context_in->previous->modify_under); |
1247 | g_free(draw_context_in->previous->modify_middle); |
1248 | g_free(draw_context_in->previous->modify_over); |
1249 | g_free(draw_context_in->previous->under); |
1250 | g_free(draw_context_in->previous->middle); |
1251 | g_free(draw_context_in->previous->over); |
1252 | g_free(draw_context_in->previous); |
1253 | |
1254 | draw_context_in->previous = draw_context_in->current; |
a56a1ba4 |
1255 | |
68997a22 |
1256 | draw_context_in->current = g_new(DrawInfo,1); |
1257 | draw_context_in->current->over = g_new(ItemInfo,1); |
1258 | draw_context_in->current->over->x = -1; |
1259 | draw_context_in->current->over->y = -1; |
1260 | draw_context_in->current->middle = g_new(ItemInfo,1); |
1261 | draw_context_in->current->middle->x = -1; |
1262 | draw_context_in->current->middle->y = -1; |
1263 | draw_context_in->current->under = g_new(ItemInfo,1); |
1264 | draw_context_in->current->under->x = -1; |
1265 | draw_context_in->current->under->y = -1; |
1266 | draw_context_in->current->modify_over = g_new(ItemInfo,1); |
1267 | draw_context_in->current->modify_over->x = -1; |
1268 | draw_context_in->current->modify_over->y = -1; |
1269 | draw_context_in->current->modify_middle = g_new(ItemInfo,1); |
1270 | draw_context_in->current->modify_middle->x = -1; |
1271 | draw_context_in->current->modify_middle->y = -1; |
1272 | draw_context_in->current->modify_under = g_new(ItemInfo,1); |
1273 | draw_context_in->current->modify_under->x = -1; |
1274 | draw_context_in->current->modify_under->y = -1; |
1275 | draw_context_in->current->status = LTTV_STATE_UNNAMED; |
a56a1ba4 |
1276 | |
1277 | } |
1278 | |
1279 | return 0; |
f0d936c0 |
1280 | } |
f7afe191 |
1281 | |
1282 | |
1283 | |
1284 | |
1b238973 |
1285 | gint update_time_window_hook(void *hook_data, void *call_data) |
f7afe191 |
1286 | { |
a56a1ba4 |
1287 | ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
a43d67ba |
1288 | Drawing_t *drawing = control_flow_data->drawing; |
1289 | |
224446ce |
1290 | const TimeWindowNotifyData *time_window_nofify_data = |
1291 | ((const TimeWindowNotifyData *)call_data); |
1292 | |
14963be0 |
1293 | TimeWindow *old_time_window = |
224446ce |
1294 | time_window_nofify_data->old_time_window; |
1295 | TimeWindow *new_time_window = |
1296 | time_window_nofify_data->new_time_window; |
a56a1ba4 |
1297 | |
3cb8b205 |
1298 | /* Update the ruler */ |
1299 | drawing_update_ruler(control_flow_data->drawing, |
1300 | new_time_window); |
1301 | |
1302 | |
a56a1ba4 |
1303 | /* Two cases : zoom in/out or scrolling */ |
1304 | |
1305 | /* In order to make sure we can reuse the old drawing, the scale must |
1306 | * be the same and the new time interval being partly located in the |
1307 | * currently shown time interval. (reuse is only for scrolling) |
1308 | */ |
1309 | |
1310 | g_info("Old time window HOOK : %u, %u to %u, %u", |
14963be0 |
1311 | old_time_window->start_time.tv_sec, |
1312 | old_time_window->start_time.tv_nsec, |
1313 | old_time_window->time_width.tv_sec, |
1314 | old_time_window->time_width.tv_nsec); |
a56a1ba4 |
1315 | |
1316 | g_info("New time window HOOK : %u, %u to %u, %u", |
14963be0 |
1317 | new_time_window->start_time.tv_sec, |
1318 | new_time_window->start_time.tv_nsec, |
1319 | new_time_window->time_width.tv_sec, |
1320 | new_time_window->time_width.tv_nsec); |
a56a1ba4 |
1321 | |
14963be0 |
1322 | if( new_time_window->time_width.tv_sec == old_time_window->time_width.tv_sec |
1323 | && new_time_window->time_width.tv_nsec == old_time_window->time_width.tv_nsec) |
a56a1ba4 |
1324 | { |
1325 | /* Same scale (scrolling) */ |
1326 | g_info("scrolling"); |
14963be0 |
1327 | LttTime *ns = &new_time_window->start_time; |
1328 | LttTime *os = &old_time_window->start_time; |
1329 | LttTime old_end = ltt_time_add(old_time_window->start_time, |
1330 | old_time_window->time_width); |
1331 | LttTime new_end = ltt_time_add(new_time_window->start_time, |
1332 | new_time_window->time_width); |
a56a1ba4 |
1333 | //if(ns<os+w<ns+w) |
1334 | //if(ns<os+w && os+w<ns+w) |
1335 | //if(ns<old_end && os<ns) |
1336 | if(ltt_time_compare(*ns, old_end) == -1 |
1337 | && ltt_time_compare(*os, *ns) == -1) |
1338 | { |
1339 | g_info("scrolling near right"); |
1340 | /* Scroll right, keep right part of the screen */ |
1341 | guint x = 0; |
51705146 |
1342 | guint width = control_flow_data->drawing->width; |
a56a1ba4 |
1343 | convert_time_to_pixels( |
1344 | *os, |
1345 | old_end, |
1346 | *ns, |
1347 | width, |
1348 | &x); |
1349 | |
1350 | /* Copy old data to new location */ |
501d5405 |
1351 | gdk_draw_drawable (control_flow_data->drawing->pixmap, |
cfe526b1 |
1352 | control_flow_data->drawing->drawing_area->style->black_gc, |
501d5405 |
1353 | control_flow_data->drawing->pixmap, |
a56a1ba4 |
1354 | x, 0, |
1355 | 0, 0, |
6395d57c |
1356 | control_flow_data->drawing->width-x+SAFETY, -1); |
1357 | |
1358 | if(drawing->damage_begin == drawing->damage_end) |
1359 | drawing->damage_begin = control_flow_data->drawing->width-x; |
1360 | else |
1361 | drawing->damage_begin = 0; |
1362 | |
1363 | drawing->damage_end = control_flow_data->drawing->width; |
1364 | |
a56a1ba4 |
1365 | /* Clear the data request background, but not SAFETY */ |
501d5405 |
1366 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
6395d57c |
1367 | //control_flow_data->drawing->drawing_area->style->black_gc, |
cfe526b1 |
1368 | control_flow_data->drawing->drawing_area->style->black_gc, |
a56a1ba4 |
1369 | TRUE, |
6395d57c |
1370 | drawing->damage_begin+SAFETY, 0, |
1371 | drawing->damage_end - drawing->damage_begin, // do not overlap |
51705146 |
1372 | control_flow_data->drawing->height); |
a43d67ba |
1373 | |
51705146 |
1374 | gtk_widget_queue_draw_area (drawing->drawing_area, |
a43d67ba |
1375 | 0,0, |
6395d57c |
1376 | control_flow_data->drawing->width, |
a43d67ba |
1377 | control_flow_data->drawing->height); |
1378 | |
a56a1ba4 |
1379 | /* Get new data for the rest. */ |
501d5405 |
1380 | drawing_data_request(control_flow_data->drawing, |
1381 | &control_flow_data->drawing->pixmap, |
6395d57c |
1382 | drawing->damage_begin, 0, |
1383 | drawing->damage_end - drawing->damage_begin, |
501d5405 |
1384 | control_flow_data->drawing->height); |
a56a1ba4 |
1385 | } else { |
1386 | //if(ns<os<ns+w) |
1387 | //if(ns<os && os<ns+w) |
1388 | //if(ns<os && os<new_end) |
1389 | if(ltt_time_compare(*ns,*os) == -1 |
1390 | && ltt_time_compare(*os,new_end) == -1) |
1391 | { |
1392 | g_info("scrolling near left"); |
1393 | /* Scroll left, keep left part of the screen */ |
1394 | guint x = 0; |
51705146 |
1395 | guint width = control_flow_data->drawing->width; |
a56a1ba4 |
1396 | convert_time_to_pixels( |
1397 | *ns, |
1398 | new_end, |
1399 | *os, |
1400 | width, |
1401 | &x); |
6395d57c |
1402 | |
1403 | |
a56a1ba4 |
1404 | /* Copy old data to new location */ |
501d5405 |
1405 | gdk_draw_drawable (control_flow_data->drawing->pixmap, |
cfe526b1 |
1406 | control_flow_data->drawing->drawing_area->style->black_gc, |
501d5405 |
1407 | control_flow_data->drawing->pixmap, |
a56a1ba4 |
1408 | 0, 0, |
1409 | x, 0, |
1410 | -1, -1); |
1411 | |
6395d57c |
1412 | if(drawing->damage_begin == drawing->damage_end) |
1413 | drawing->damage_end = x; |
1414 | else |
1415 | drawing->damage_end = |
51705146 |
1416 | control_flow_data->drawing->width; |
6395d57c |
1417 | |
1418 | drawing->damage_begin = 0; |
1419 | |
501d5405 |
1420 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
cfe526b1 |
1421 | control_flow_data->drawing->drawing_area->style->black_gc, |
a56a1ba4 |
1422 | TRUE, |
6395d57c |
1423 | drawing->damage_begin, 0, |
1424 | drawing->damage_end - drawing->damage_begin, // do not overlap |
51705146 |
1425 | control_flow_data->drawing->height); |
a43d67ba |
1426 | |
6395d57c |
1427 | gtk_widget_queue_draw_area (drawing->drawing_area, |
1428 | 0,0, |
1429 | control_flow_data->drawing->width, |
a43d67ba |
1430 | control_flow_data->drawing->height); |
1431 | |
6395d57c |
1432 | |
a56a1ba4 |
1433 | /* Get new data for the rest. */ |
501d5405 |
1434 | drawing_data_request(control_flow_data->drawing, |
1435 | &control_flow_data->drawing->pixmap, |
6395d57c |
1436 | drawing->damage_begin, 0, |
1437 | drawing->damage_end - drawing->damage_begin, |
501d5405 |
1438 | control_flow_data->drawing->height); |
a56a1ba4 |
1439 | |
a56a1ba4 |
1440 | } else { |
a43d67ba |
1441 | if(ltt_time_compare(*ns,*os) == 0) |
1442 | { |
1443 | g_info("not scrolling"); |
1444 | } else { |
1445 | g_info("scrolling far"); |
1446 | /* Cannot reuse any part of the screen : far jump */ |
1447 | |
1448 | |
1449 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
1450 | control_flow_data->drawing->drawing_area->style->black_gc, |
1451 | TRUE, |
a56a1ba4 |
1452 | 0, 0, |
a43d67ba |
1453 | control_flow_data->drawing->width+SAFETY, // do not overlap |
51705146 |
1454 | control_flow_data->drawing->height); |
a43d67ba |
1455 | |
1456 | gtk_widget_queue_draw_area (drawing->drawing_area, |
1457 | 0,0, |
1458 | control_flow_data->drawing->width, |
1459 | control_flow_data->drawing->height); |
1460 | |
6395d57c |
1461 | drawing->damage_begin = 0; |
1462 | drawing->damage_end = control_flow_data->drawing->width; |
1463 | |
a43d67ba |
1464 | drawing_data_request(control_flow_data->drawing, |
1465 | &control_flow_data->drawing->pixmap, |
1466 | 0, 0, |
1467 | control_flow_data->drawing->width, |
1468 | control_flow_data->drawing->height); |
1469 | |
1470 | } |
a56a1ba4 |
1471 | } |
1472 | } |
1473 | } else { |
1474 | /* Different scale (zoom) */ |
1475 | g_info("zoom"); |
1476 | |
501d5405 |
1477 | gdk_draw_rectangle (control_flow_data->drawing->pixmap, |
cfe526b1 |
1478 | control_flow_data->drawing->drawing_area->style->black_gc, |
a56a1ba4 |
1479 | TRUE, |
1480 | 0, 0, |
501d5405 |
1481 | control_flow_data->drawing->width+SAFETY, // do not overlap |
51705146 |
1482 | control_flow_data->drawing->height); |
a56a1ba4 |
1483 | |
a43d67ba |
1484 | gtk_widget_queue_draw_area (drawing->drawing_area, |
1485 | 0,0, |
1486 | control_flow_data->drawing->width, |
1487 | control_flow_data->drawing->height); |
a56a1ba4 |
1488 | |
6395d57c |
1489 | drawing->damage_begin = 0; |
1490 | drawing->damage_end = control_flow_data->drawing->width; |
1491 | |
501d5405 |
1492 | drawing_data_request(control_flow_data->drawing, |
1493 | &control_flow_data->drawing->pixmap, |
a56a1ba4 |
1494 | 0, 0, |
501d5405 |
1495 | control_flow_data->drawing->width, |
1496 | control_flow_data->drawing->height); |
a56a1ba4 |
1497 | } |
1498 | |
3cb8b205 |
1499 | |
1500 | |
a56a1ba4 |
1501 | return 0; |
f7afe191 |
1502 | } |
1503 | |
6395d57c |
1504 | gint traceset_notify(void *hook_data, void *call_data) |
1505 | { |
1506 | ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
1507 | Drawing_t *drawing = control_flow_data->drawing; |
1508 | GtkWidget *widget = drawing->drawing_area; |
1509 | |
1510 | drawing->damage_begin = 0; |
51705146 |
1511 | drawing->damage_end = drawing->width; |
6395d57c |
1512 | |
1513 | |
1514 | // Clear the image |
1515 | gdk_draw_rectangle (drawing->pixmap, |
1516 | widget->style->black_gc, |
1517 | TRUE, |
1518 | 0, 0, |
51705146 |
1519 | drawing->width+SAFETY, |
1520 | drawing->height); |
6395d57c |
1521 | |
1522 | |
1523 | if(drawing->damage_begin < drawing->damage_end) |
1524 | { |
1525 | drawing_data_request(drawing, |
1526 | &drawing->pixmap, |
1527 | drawing->damage_begin, |
1528 | 0, |
1529 | drawing->damage_end-drawing->damage_begin, |
51705146 |
1530 | drawing->height); |
6395d57c |
1531 | } |
1532 | |
1533 | gtk_widget_queue_draw_area(drawing->drawing_area, |
1534 | 0,0, |
1535 | drawing->width, |
1536 | drawing->height); |
1537 | |
1538 | request_background_data(control_flow_data); |
1539 | |
1540 | return FALSE; |
1541 | } |
1542 | |
ca0f8a8e |
1543 | gint redraw_notify(void *hook_data, void *call_data) |
1544 | { |
1545 | ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
1546 | Drawing_t *drawing = control_flow_data->drawing; |
1547 | GtkWidget *widget = drawing->drawing_area; |
1548 | |
1549 | drawing->damage_begin = 0; |
51705146 |
1550 | drawing->damage_end = drawing->width; |
ca0f8a8e |
1551 | |
1552 | |
1553 | // Clear the image |
1554 | gdk_draw_rectangle (drawing->pixmap, |
1555 | widget->style->black_gc, |
1556 | TRUE, |
1557 | 0, 0, |
51705146 |
1558 | drawing->width+SAFETY, |
1559 | drawing->height); |
ca0f8a8e |
1560 | |
1561 | |
1562 | if(drawing->damage_begin < drawing->damage_end) |
1563 | { |
1564 | drawing_data_request(drawing, |
1565 | &drawing->pixmap, |
1566 | drawing->damage_begin, |
1567 | 0, |
1568 | drawing->damage_end-drawing->damage_begin, |
51705146 |
1569 | drawing->height); |
ca0f8a8e |
1570 | } |
1571 | |
1572 | gtk_widget_queue_draw_area(drawing->drawing_area, |
1573 | 0,0, |
1574 | drawing->width, |
1575 | drawing->height); |
1576 | |
1577 | return FALSE; |
1578 | |
1579 | } |
1580 | |
1581 | |
1582 | gint continue_notify(void *hook_data, void *call_data) |
a43d67ba |
1583 | { |
1584 | ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
ca0f8a8e |
1585 | Drawing_t *drawing = control_flow_data->drawing; |
1586 | GtkWidget *widget = drawing->drawing_area; |
a43d67ba |
1587 | |
6395d57c |
1588 | //g_assert(widget->allocation.width == drawing->damage_end); |
ca0f8a8e |
1589 | |
1590 | if(drawing->damage_begin < drawing->damage_end) |
1591 | { |
1592 | drawing_data_request(drawing, |
1593 | &drawing->pixmap, |
1594 | drawing->damage_begin, |
1595 | 0, |
1596 | drawing->damage_end-drawing->damage_begin, |
51705146 |
1597 | drawing->height); |
ca0f8a8e |
1598 | } |
1599 | |
1600 | return FALSE; |
1601 | } |
1602 | |
1603 | |
1604 | gint after_process_traceset_hook(void *hook_data, void *call_data) |
1605 | { |
1606 | //ControlFlowData *control_flow_data = (ControlFlowData*) hook_data; |
1607 | EventsRequest *events_request = (EventsRequest *)hook_data; |
1608 | |
1609 | ControlFlowData *control_flow_data = |
1610 | (ControlFlowData*)events_request->viewer_data; |
1611 | |
1612 | |
1613 | drawing_data_request_end(events_request, |
1614 | (LttvTracesetState*)call_data); |
a43d67ba |
1615 | return 0; |
1616 | } |
1617 | |
1618 | |
1619 | |
1b238973 |
1620 | gint update_current_time_hook(void *hook_data, void *call_data) |
f7afe191 |
1621 | { |
14963be0 |
1622 | ControlFlowData *control_flow_data = (ControlFlowData*)hook_data; |
a43d67ba |
1623 | Drawing_t *drawing = control_flow_data->drawing; |
a56a1ba4 |
1624 | |
224446ce |
1625 | LttTime current_time = *((LttTime*)call_data); |
a56a1ba4 |
1626 | |
ca0f8a8e |
1627 | TimeWindow time_window = |
1628 | lttvwindow_get_time_window(control_flow_data->tab); |
a56a1ba4 |
1629 | |
ca0f8a8e |
1630 | LttTime time_begin = time_window.start_time; |
1631 | LttTime width = time_window.time_width; |
a56a1ba4 |
1632 | LttTime half_width = ltt_time_div(width,2.0); |
1633 | LttTime time_end = ltt_time_add(time_begin, width); |
1634 | |
1635 | LttvTracesetContext * tsc = |
ca0f8a8e |
1636 | lttvwindow_get_traceset_context(control_flow_data->tab); |
a56a1ba4 |
1637 | |
ca0f8a8e |
1638 | LttTime trace_start = tsc->time_span.start_time; |
1639 | LttTime trace_end = tsc->time_span.end_time; |
a56a1ba4 |
1640 | |
224446ce |
1641 | g_info("New current time HOOK : %u, %u", current_time.tv_sec, |
1642 | current_time.tv_nsec); |
a56a1ba4 |
1643 | |
1644 | |
1645 | |
1646 | /* If current time is inside time interval, just move the highlight |
1647 | * bar */ |
1648 | |
1649 | /* Else, we have to change the time interval. We have to tell it |
1650 | * to the main window. */ |
1651 | /* The time interval change will take care of placing the current |
1652 | * time at the center of the visible area, or nearest possible if we are |
1653 | * at one end of the trace. */ |
1654 | |
1655 | |
224446ce |
1656 | if(ltt_time_compare(current_time, time_begin) == -1) |
a56a1ba4 |
1657 | { |
224446ce |
1658 | TimeWindow new_time_window; |
1659 | |
1660 | if(ltt_time_compare(current_time, |
a56a1ba4 |
1661 | ltt_time_add(trace_start,half_width)) == -1) |
1662 | time_begin = trace_start; |
1663 | else |
224446ce |
1664 | time_begin = ltt_time_sub(current_time,half_width); |
a56a1ba4 |
1665 | |
224446ce |
1666 | new_time_window.start_time = time_begin; |
1667 | new_time_window.time_width = width; |
a56a1ba4 |
1668 | |
ca0f8a8e |
1669 | lttvwindow_report_time_window(control_flow_data->tab, &new_time_window); |
a56a1ba4 |
1670 | } |
224446ce |
1671 | else if(ltt_time_compare(current_time, time_end) == 1) |
a56a1ba4 |
1672 | { |
224446ce |
1673 | TimeWindow new_time_window; |
1674 | |
1675 | if(ltt_time_compare(current_time, ltt_time_sub(trace_end, half_width)) == 1) |
a56a1ba4 |
1676 | time_begin = ltt_time_sub(trace_end,width); |
1677 | else |
224446ce |
1678 | time_begin = ltt_time_sub(current_time,half_width); |
a56a1ba4 |
1679 | |
224446ce |
1680 | new_time_window.start_time = time_begin; |
1681 | new_time_window.time_width = width; |
a56a1ba4 |
1682 | |
ca0f8a8e |
1683 | lttvwindow_report_time_window(control_flow_data->tab, &new_time_window); |
a56a1ba4 |
1684 | |
1685 | } |
a43d67ba |
1686 | //gtk_widget_queue_draw(control_flow_data->drawing->drawing_area); |
1687 | gtk_widget_queue_draw_area(drawing->drawing_area, |
1688 | 0,0, |
1689 | drawing->width, |
1690 | drawing->height); |
a56a1ba4 |
1691 | |
1692 | return 0; |
f7afe191 |
1693 | } |
1694 | |
8b90e648 |
1695 | typedef struct _ClosureData { |
ca0f8a8e |
1696 | EventsRequest *events_request; |
d0cd7f09 |
1697 | LttvTracesetState *tss; |
8b90e648 |
1698 | } ClosureData; |
a56a1ba4 |
1699 | |
8b90e648 |
1700 | |
1701 | void draw_closure(gpointer key, gpointer value, gpointer user_data) |
1702 | { |
a56a1ba4 |
1703 | ProcessInfo *process_info = (ProcessInfo*)key; |
1704 | HashedProcessData *hashed_process_data = (HashedProcessData*)value; |
1705 | ClosureData *closure_data = (ClosureData*)user_data; |
1706 | |
1707 | ControlFlowData *control_flow_data = |
ca0f8a8e |
1708 | closure_data->events_request->viewer_data; |
a56a1ba4 |
1709 | |
501d5405 |
1710 | GtkWidget *widget = control_flow_data->drawing->drawing_area; |
a56a1ba4 |
1711 | |
1712 | /* Get y position of process */ |
1713 | gint y=0, height=0; |
1714 | |
ba90bc77 |
1715 | processlist_get_pixels_from_data( control_flow_data->process_list, |
a56a1ba4 |
1716 | process_info, |
1717 | hashed_process_data, |
1718 | &y, |
1719 | &height); |
1720 | /* Get last state of process */ |
1721 | LttvTraceContext *tc = |
d0cd7f09 |
1722 | ((LttvTracesetContext*)closure_data->tss)->traces[process_info->trace_num]; |
ca0f8a8e |
1723 | LttvTracesetContext *tsc = (LttvTracesetContext *)closure_data->tss; |
8b90e648 |
1724 | |
d0cd7f09 |
1725 | LttvTraceState *ts = (LttvTraceState*)tc; |
a56a1ba4 |
1726 | LttvProcessState *process; |
1727 | |
2a2fa4f0 |
1728 | /* We do not provide a cpu_name argument assuming that this is not the |
1729 | idle job (pid 0) and thus its pid is unique across all cpus */ |
1730 | process = lttv_state_find_process_from_trace(ts, 0, process_info->pid); |
a56a1ba4 |
1731 | |
1732 | /* Draw the closing line */ |
1733 | DrawContext *draw_context = hashed_process_data->draw_context; |
68997a22 |
1734 | if(draw_context->previous->middle->x == -1) |
a56a1ba4 |
1735 | { |
ca0f8a8e |
1736 | draw_context->previous->over->x = |
1737 | control_flow_data->drawing->damage_begin; |
1738 | draw_context->previous->middle->x = |
1739 | control_flow_data->drawing->damage_begin; |
1740 | draw_context->previous->under->x = |
1741 | control_flow_data->drawing->damage_begin; |
1742 | |
1743 | g_debug("out middle x_beg : %u",control_flow_data->drawing->damage_begin); |
a56a1ba4 |
1744 | } |
1745 | |
ca0f8a8e |
1746 | /* Find pixels corresponding to current time . If the time does |
1747 | * not fit in the window, show a warning, not supposed to happend. */ |
1748 | guint x = 0; |
51705146 |
1749 | guint width = control_flow_data->drawing->width; |
ca0f8a8e |
1750 | |
1751 | TimeWindow time_window = |
1752 | lttvwindow_get_time_window(control_flow_data->tab); |
1753 | |
1754 | LttTime time = lttv_traceset_context_get_current_tfc(tsc)->timestamp; |
1755 | |
1756 | LttTime window_end = ltt_time_add(time_window.time_width, |
1757 | time_window.start_time); |
1758 | |
1759 | convert_time_to_pixels( |
1760 | time_window.start_time, |
1761 | window_end, |
1762 | time, |
1763 | width, |
1764 | &x); |
1765 | |
1766 | draw_context->current->middle->x = x; |
1767 | draw_context->current->over->x = x; |
1768 | draw_context->current->under->x = x; |
68997a22 |
1769 | draw_context->current->middle->y = y + height/2; |
d0cd7f09 |
1770 | draw_context->current->over->y = y ; |
1771 | draw_context->current->under->y = y + height; |
68997a22 |
1772 | draw_context->previous->middle->y = y + height/2; |
d0cd7f09 |
1773 | draw_context->previous->over->y = y ; |
1774 | draw_context->previous->under->y = y + height; |
501d5405 |
1775 | draw_context->drawable = control_flow_data->drawing->pixmap; |
1776 | draw_context->pango_layout = control_flow_data->drawing->pango_layout; |
a56a1ba4 |
1777 | //draw_context->gc = widget->style->black_gc; |
51705146 |
1778 | //draw_context->gc = gdk_gc_new(control_flow_data->drawing->pixmap); |
1779 | //gdk_gc_copy(draw_context->gc, widget->style->black_gc); |
1780 | draw_context->gc = control_flow_data->drawing->gc; |
d0cd7f09 |
1781 | |
ad2e83ba |
1782 | if(process != NULL && process->state->s == LTTV_STATE_RUN) |
d0cd7f09 |
1783 | { |
1784 | PropertiesBG prop_bg; |
1785 | prop_bg.color = g_new(GdkColor,1); |
1786 | |
1787 | /*switch(tfc->index) { |
1788 | case 0: |
1789 | prop_bg.color->red = 0x1515; |
1790 | prop_bg.color->green = 0x1515; |
1791 | prop_bg.color->blue = 0x8c8c; |
1792 | break; |
1793 | case 1: |
1794 | prop_bg.color->red = 0x4e4e; |
1795 | prop_bg.color->green = 0xa9a9; |
1796 | prop_bg.color->blue = 0xa4a4; |
1797 | break; |
1798 | case 2: |
1799 | prop_bg.color->red = 0x7a7a; |
1800 | prop_bg.color->green = 0x4a4a; |
1801 | prop_bg.color->blue = 0x8b8b; |
1802 | break; |
1803 | case 3: |
1804 | prop_bg.color->red = 0x8080; |
1805 | prop_bg.color->green = 0x7777; |
1806 | prop_bg.color->blue = 0x4747; |
1807 | break; |
1808 | default: |
1809 | prop_bg.color->red = 0xe7e7; |
1810 | prop_bg.color->green = 0xe7e7; |
1811 | prop_bg.color->blue = 0xe7e7; |
1812 | } |
1813 | */ |
1814 | |
2a2fa4f0 |
1815 | g_debug("calling from closure"); |
d0cd7f09 |
1816 | //FIXME : I need the cpu number in process's state to draw this. |
1817 | //draw_bg((void*)&prop_bg, (void*)draw_context); |
1818 | g_free(prop_bg.color); |
1819 | } |
1820 | |
a56a1ba4 |
1821 | |
1822 | PropertiesLine prop_line; |
1823 | prop_line.color = g_new(GdkColor,1); |
cfe526b1 |
1824 | prop_line.line_width = 2; |
a56a1ba4 |
1825 | prop_line.style = GDK_LINE_SOLID; |
1826 | prop_line.position = MIDDLE; |
1827 | |
1828 | /* color of line : status of the process */ |
ad2e83ba |
1829 | if(process != NULL) |
a56a1ba4 |
1830 | { |
ad2e83ba |
1831 | if(process->state->s == LTTV_STATE_UNNAMED) |
1832 | { |
1833 | prop_line.color->red = 0xffff; |
1834 | prop_line.color->green = 0xffff; |
1835 | prop_line.color->blue = 0xffff; |
1836 | } |
1837 | else if(process->state->s == LTTV_STATE_WAIT_FORK) |
1838 | { |
1839 | prop_line.color->red = 0x0fff; |
1840 | prop_line.color->green = 0xffff; |
1841 | prop_line.color->blue = 0xfff0; |
1842 | } |
1843 | else if(process->state->s == LTTV_STATE_WAIT_CPU) |
1844 | { |
1845 | prop_line.color->red = 0xffff; |
1846 | prop_line.color->green = 0xffff; |
1847 | prop_line.color->blue = 0x0000; |
1848 | } |
1849 | else if(process->state->s == LTTV_STATE_EXIT) |
1850 | { |
1851 | prop_line.color->red = 0xffff; |
1852 | prop_line.color->green = 0x0000; |
1853 | prop_line.color->blue = 0xffff; |
1854 | } |
1855 | else if(process->state->s == LTTV_STATE_WAIT) |
1856 | { |
1857 | prop_line.color->red = 0xffff; |
1858 | prop_line.color->green = 0x0000; |
1859 | prop_line.color->blue = 0x0000; |
1860 | } |
1861 | else if(process->state->s == LTTV_STATE_RUN) |
1862 | { |
1863 | prop_line.color->red = 0x0000; |
1864 | prop_line.color->green = 0xffff; |
1865 | prop_line.color->blue = 0x0000; |
1866 | } |
1867 | else |
1868 | { |
1869 | prop_line.color->red = 0xffff; |
1870 | prop_line.color->green = 0xffff; |
1871 | prop_line.color->blue = 0xffff; |
1872 | } |
1873 | |
a56a1ba4 |
1874 | } |
1875 | else |
1876 | { |
ad2e83ba |
1877 | prop_line.color->red = 0xffff; |
1878 | prop_line.color->green = 0xffff; |
1879 | prop_line.color->blue = 0xffff; |
a56a1ba4 |
1880 | } |
1881 | |
1882 | draw_line((void*)&prop_line, (void*)draw_context); |
1883 | g_free(prop_line.color); |
51705146 |
1884 | //gdk_gc_unref(draw_context->gc); |
a56a1ba4 |
1885 | |
1886 | /* Reset draw_context of the process for next request */ |
1887 | |
1888 | hashed_process_data->draw_context->drawable = NULL; |
1889 | hashed_process_data->draw_context->gc = NULL; |
1890 | hashed_process_data->draw_context->pango_layout = NULL; |
68997a22 |
1891 | hashed_process_data->draw_context->current->over->x = -1; |
1892 | hashed_process_data->draw_context->current->over->y = -1; |
1893 | hashed_process_data->draw_context->current->middle->x = -1; |
1894 | hashed_process_data->draw_context->current->middle->y = -1; |
1895 | hashed_process_data->draw_context->current->under->x = -1; |
1896 | hashed_process_data->draw_context->current->under->y = -1; |
1897 | hashed_process_data->draw_context->current->modify_over->x = -1; |
1898 | hashed_process_data->draw_context->current->modify_over->y = -1; |
1899 | hashed_process_data->draw_context->current->modify_middle->x = -1; |
1900 | hashed_process_data->draw_context->current->modify_middle->y = -1; |
1901 | hashed_process_data->draw_context->current->modify_under->x = -1; |
1902 | hashed_process_data->draw_context->current->modify_under->y = -1; |
1903 | hashed_process_data->draw_context->current->status = LTTV_STATE_UNNAMED; |
1904 | hashed_process_data->draw_context->previous->over->x = -1; |
1905 | hashed_process_data->draw_context->previous->over->y = -1; |
1906 | hashed_process_data->draw_context->previous->middle->x = -1; |
1907 | hashed_process_data->draw_context->previous->middle->y = -1; |
1908 | hashed_process_data->draw_context->previous->under->x = -1; |
1909 | hashed_process_data->draw_context->previous->under->y = -1; |
1910 | hashed_process_data->draw_context->previous->modify_over->x = -1; |
1911 | hashed_process_data->draw_context->previous->modify_over->y = -1; |
1912 | hashed_process_data->draw_context->previous->modify_middle->x = -1; |
1913 | hashed_process_data->draw_context->previous->modify_middle->y = -1; |
1914 | hashed_process_data->draw_context->previous->modify_under->x = -1; |
1915 | hashed_process_data->draw_context->previous->modify_under->y = -1; |
1916 | hashed_process_data->draw_context->previous->status = LTTV_STATE_UNNAMED; |
8b90e648 |
1917 | |
1918 | } |
1919 | |
ca0f8a8e |
1920 | int before_data_request(void *hook_data, void *call_data) |
1921 | { |
1922 | EventsRequest *events_request = (EventsRequest*)hook_data; |
1923 | LttvTracesetState *tss = LTTV_TRACESET_STATE(call_data); |
1924 | |
1925 | drawing_data_request_begin(events_request, tss); |
1926 | |
1927 | return 0; |
1928 | } |
1929 | |
1930 | |
8b90e648 |
1931 | /* |
1932 | * for each process |
a56a1ba4 |
1933 | * draw closing line |
1934 | * new default prev and current |
a43d67ba |
1935 | * then finally remove reading hooks. |
8b90e648 |
1936 | */ |
1937 | int after_data_request(void *hook_data, void *call_data) |
1938 | { |
ca0f8a8e |
1939 | EventsRequest *events_request = (EventsRequest*)hook_data; |
1940 | ControlFlowData *control_flow_data = events_request->viewer_data; |
1941 | LttvTracesetState *tss = LTTV_TRACESET_STATE(call_data); |
a56a1ba4 |
1942 | |
1943 | ProcessList *process_list = |
ca0f8a8e |
1944 | guicontrolflow_get_process_list(control_flow_data); |
a56a1ba4 |
1945 | |
1946 | ClosureData closure_data; |
ca0f8a8e |
1947 | closure_data.events_request = (EventsRequest*)hook_data; |
1948 | closure_data.tss = tss; |
a56a1ba4 |
1949 | |
14963be0 |
1950 | g_hash_table_foreach(process_list->process_hash, draw_closure, |
a56a1ba4 |
1951 | (void*)&closure_data); |
a43d67ba |
1952 | |
ca0f8a8e |
1953 | /* Request expose */ |
1954 | drawing_data_request_end(events_request, tss); |
1955 | |
1956 | return 0; |
8b90e648 |
1957 | } |
1958 | |