git-svn-id: http://ltt.polymtl.ca/svn@489 04897980-b3bd-0310-b5e0-8ef037075253
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / eventhooks.c
CommitLineData
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 */
66GtkWidget *
14963be0 67h_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 100int 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 117int 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 147int 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;
1aff52a2 155 LttvTraceState *ts =(LttvTraceState *)LTTV_TRACEFILE_CONTEXT(tfs)->t_context;
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... */
87658614 196 //process_out = lttv_state_find_process_from_trace(ts, pid_out);
197 process_out = lttv_state_find_process(tfs, pid_out);
1aff52a2 198 if(process_out == NULL) return 0;
a56a1ba4 199 g_critical("out : %s",g_quark_to_string(process_out->state->s));
1aff52a2 200
a56a1ba4 201 birth = process_out->creation_time;
202 gchar *name = strdup(g_quark_to_string(process_out->name));
14963be0 203 HashedProcessData *hashed_process_data_out = NULL;
a56a1ba4 204
205 if(processlist_get_process_pixels(process_list,
206 pid_out,
207 &birth,
d0cd7f09 208 tfc->t_context->index,
a56a1ba4 209 &y_out,
210 &height,
14963be0 211 &hashed_process_data_out) == 1)
a56a1ba4 212 {
213 /* Process not present */
214 processlist_add(process_list,
215 pid_out,
216 &birth,
d0cd7f09 217 tfc->t_context->index,
a56a1ba4 218 name,
219 &pl_height,
14963be0 220 &hashed_process_data_out);
a56a1ba4 221 processlist_get_process_pixels(process_list,
222 pid_out,
223 &birth,
d0cd7f09 224 tfc->t_context->index,
a56a1ba4 225 &y_out,
226 &height,
14963be0 227 &hashed_process_data_out);
501d5405 228 drawing_insert_square( event_request->control_flow_data->drawing, y_out, height);
a56a1ba4 229 }
230
231 g_free(name);
232
233 /* Find process pid_in in the list... */
87658614 234 //process_in = lttv_state_find_process_from_trace(ts, pid_in);
235 process_in = lttv_state_find_process(tfs, pid_in);
1aff52a2 236 if(process_in == NULL) return 0;
a56a1ba4 237 g_critical("in : %s",g_quark_to_string(process_in->state->s));
238
239 birth = process_in->creation_time;
240 name = strdup(g_quark_to_string(process_in->name));
14963be0 241 HashedProcessData *hashed_process_data_in = NULL;
a56a1ba4 242
243 if(processlist_get_process_pixels(process_list,
244 pid_in,
245 &birth,
d0cd7f09 246 tfc->t_context->index,
a56a1ba4 247 &y_in,
248 &height,
14963be0 249 &hashed_process_data_in) == 1)
a56a1ba4 250 {
251 /* Process not present */
252 processlist_add(process_list,
253 pid_in,
254 &birth,
d0cd7f09 255 tfc->t_context->index,
a56a1ba4 256 name,
257 &pl_height,
14963be0 258 &hashed_process_data_in);
a56a1ba4 259 processlist_get_process_pixels(process_list,
260 pid_in,
261 &birth,
d0cd7f09 262 tfc->t_context->index,
a56a1ba4 263 &y_in,
264 &height,
14963be0 265 &hashed_process_data_in);
a56a1ba4 266
501d5405 267 drawing_insert_square( event_request->control_flow_data->drawing, y_in, height);
a56a1ba4 268 }
269 g_free(name);
270
271
272 /* Find pixels corresponding to time of the event. If the time does
273 * not fit in the window, show a warning, not supposed to happend. */
274 guint x = 0;
501d5405 275 guint width = control_flow_data->drawing->drawing_area->allocation.width;
a56a1ba4 276
277 LttTime time = ltt_event_time(e);
278
ba90bc77 279 LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
280 control_flow_data->time_window.start_time);
a56a1ba4 281
282
283 convert_time_to_pixels(
ba90bc77 284 control_flow_data->time_window.start_time,
a56a1ba4 285 window_end,
286 time,
287 width,
288 &x);
9444deae 289 //assert(x <= width);
a56a1ba4 290
291 /* draw what represents the event for outgoing process. */
292
14963be0 293 DrawContext *draw_context_out = hashed_process_data_out->draw_context;
68997a22 294 draw_context_out->current->modify_over->x = x;
319e9d81 295 draw_context_out->current->modify_under->x = x;
68997a22 296 draw_context_out->current->modify_over->y = y_out;
319e9d81 297 draw_context_out->current->modify_under->y = y_out+(height/2)+2;
501d5405 298 draw_context_out->drawable = control_flow_data->drawing->pixmap;
299 draw_context_out->pango_layout = control_flow_data->drawing->pango_layout;
300 GtkWidget *widget = control_flow_data->drawing->drawing_area;
a56a1ba4 301 //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
d0cd7f09 302 //draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
303 //gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
a56a1ba4 304 //draw_context_out->gc = widget->style->black_gc;
305
306 //draw_arc((void*)&prop_arc, (void*)draw_context_out);
501d5405 307 //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
a56a1ba4 308
d0cd7f09 309 /* Draw the line/background of the out process */
310 if(draw_context_out->previous->middle->x == -1)
311 {
312 draw_context_out->previous->over->x = event_request->x_begin;
313 draw_context_out->previous->middle->x = event_request->x_begin;
314 draw_context_out->previous->under->x = event_request->x_begin;
315
316 g_critical("out middle x_beg : %u",event_request->x_begin);
317 }
318
319 draw_context_out->current->middle->x = x;
320 draw_context_out->current->over->x = x;
321 draw_context_out->current->under->x = x;
322 draw_context_out->current->middle->y = y_out + height/2;
323 draw_context_out->current->over->y = y_out;
324 draw_context_out->current->under->y = y_out + height;
325 draw_context_out->previous->middle->y = y_out + height/2;
326 draw_context_out->previous->over->y = y_out;
327 draw_context_out->previous->under->y = y_out + height;
328
329 draw_context_out->drawable = control_flow_data->drawing->pixmap;
330 draw_context_out->pango_layout = control_flow_data->drawing->pango_layout;
331
332 if(process_out->state->s == LTTV_STATE_RUN)
333 {
334 draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
335 gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
336
337 PropertiesBG prop_bg;
338 prop_bg.color = g_new(GdkColor,1);
339
340 switch(tfc->index) {
341 case 0:
342 prop_bg.color->red = 0x1515;
343 prop_bg.color->green = 0x1515;
344 prop_bg.color->blue = 0x8c8c;
345 break;
346 case 1:
347 prop_bg.color->red = 0x4e4e;
348 prop_bg.color->green = 0xa9a9;
349 prop_bg.color->blue = 0xa4a4;
350 break;
351 case 2:
352 prop_bg.color->red = 0x7a7a;
353 prop_bg.color->green = 0x4a4a;
354 prop_bg.color->blue = 0x8b8b;
355 break;
356 case 3:
357 prop_bg.color->red = 0x8080;
358 prop_bg.color->green = 0x7777;
359 prop_bg.color->blue = 0x4747;
360 break;
361 default:
362 prop_bg.color->red = 0xe7e7;
363 prop_bg.color->green = 0xe7e7;
364 prop_bg.color->blue = 0xe7e7;
365 }
366
367 g_critical("calling from draw_event");
368 draw_bg((void*)&prop_bg, (void*)draw_context_out);
369 g_free(prop_bg.color);
370 gdk_gc_unref(draw_context_out->gc);
371 }
372
373 draw_context_out->gc = widget->style->black_gc;
374
a56a1ba4 375 GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 };
2df6f2bd 376 GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 };
a56a1ba4 377 PropertiesText prop_text_out;
378 prop_text_out.foreground = &colorfg_out;
379 prop_text_out.background = &colorbg_out;
cfe526b1 380 prop_text_out.size = 6;
a56a1ba4 381 prop_text_out.position = OVER;
382
cfe526b1 383 /* color of text : status of the process */
384 if(process_out->state->s == LTTV_STATE_UNNAMED)
385 {
386 prop_text_out.foreground->red = 0xffff;
387 prop_text_out.foreground->green = 0xffff;
388 prop_text_out.foreground->blue = 0xffff;
389 }
390 else if(process_out->state->s == LTTV_STATE_WAIT_FORK)
391 {
392 prop_text_out.foreground->red = 0x0fff;
d52cfc84 393 prop_text_out.foreground->green = 0xffff;
394 prop_text_out.foreground->blue = 0xfff0;
cfe526b1 395 }
396 else if(process_out->state->s == LTTV_STATE_WAIT_CPU)
397 {
2df6f2bd 398 prop_text_out.foreground->red = 0xffff;
399 prop_text_out.foreground->green = 0xffff;
cfe526b1 400 prop_text_out.foreground->blue = 0x0000;
401 }
402 else if(process_out->state->s == LTTV_STATE_EXIT)
403 {
404 prop_text_out.foreground->red = 0xffff;
405 prop_text_out.foreground->green = 0x0000;
406 prop_text_out.foreground->blue = 0xffff;
407 }
408 else if(process_out->state->s == LTTV_STATE_WAIT)
409 {
410 prop_text_out.foreground->red = 0xffff;
411 prop_text_out.foreground->green = 0x0000;
412 prop_text_out.foreground->blue = 0x0000;
413 }
414 else if(process_out->state->s == LTTV_STATE_RUN)
415 {
416 prop_text_out.foreground->red = 0x0000;
417 prop_text_out.foreground->green = 0xffff;
418 prop_text_out.foreground->blue = 0x0000;
419 }
420 else
421 {
422 prop_text_out.foreground->red = 0xffff;
423 prop_text_out.foreground->green = 0xffff;
424 prop_text_out.foreground->blue = 0xffff;
425 }
426
d52cfc84 427
a56a1ba4 428 /* Print status of the process : U, WF, WC, E, W, R */
429 if(process_out->state->s == LTTV_STATE_UNNAMED)
cfe526b1 430 prop_text_out.text = "U->";
a56a1ba4 431 else if(process_out->state->s == LTTV_STATE_WAIT_FORK)
cfe526b1 432 prop_text_out.text = "WF->";
a56a1ba4 433 else if(process_out->state->s == LTTV_STATE_WAIT_CPU)
cfe526b1 434 prop_text_out.text = "WC->";
a56a1ba4 435 else if(process_out->state->s == LTTV_STATE_EXIT)
cfe526b1 436 prop_text_out.text = "E->";
a56a1ba4 437 else if(process_out->state->s == LTTV_STATE_WAIT)
cfe526b1 438 prop_text_out.text = "W->";
a56a1ba4 439 else if(process_out->state->s == LTTV_STATE_RUN)
cfe526b1 440 prop_text_out.text = "R->";
a56a1ba4 441 else
68997a22 442 prop_text_out.text = "U";
a56a1ba4 443
444 draw_text((void*)&prop_text_out, (void*)draw_context_out);
d0cd7f09 445 //gdk_gc_unref(draw_context_out->gc);
a56a1ba4 446
501d5405 447 draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
a56a1ba4 448 gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
449
450 PropertiesLine prop_line_out;
451 prop_line_out.color = g_new(GdkColor,1);
cfe526b1 452 prop_line_out.line_width = 2;
a56a1ba4 453 prop_line_out.style = GDK_LINE_SOLID;
454 prop_line_out.position = MIDDLE;
d52cfc84 455
456 g_critical("out state : %s", g_quark_to_string(process_out->state->s));
a56a1ba4 457
458 /* color of line : status of the process */
459 if(process_out->state->s == LTTV_STATE_UNNAMED)
460 {
cfe526b1 461 prop_line_out.color->red = 0xffff;
462 prop_line_out.color->green = 0xffff;
463 prop_line_out.color->blue = 0xffff;
a56a1ba4 464 }
465 else if(process_out->state->s == LTTV_STATE_WAIT_FORK)
466 {
467 prop_line_out.color->red = 0x0fff;
d52cfc84 468 prop_line_out.color->green = 0xffff;
469 prop_line_out.color->blue = 0xfff0;
a56a1ba4 470 }
471 else if(process_out->state->s == LTTV_STATE_WAIT_CPU)
472 {
2df6f2bd 473 prop_line_out.color->red = 0xffff;
474 prop_line_out.color->green = 0xffff;
a56a1ba4 475 prop_line_out.color->blue = 0x0000;
476 }
477 else if(process_out->state->s == LTTV_STATE_EXIT)
478 {
479 prop_line_out.color->red = 0xffff;
480 prop_line_out.color->green = 0x0000;
481 prop_line_out.color->blue = 0xffff;
482 }
483 else if(process_out->state->s == LTTV_STATE_WAIT)
484 {
485 prop_line_out.color->red = 0xffff;
486 prop_line_out.color->green = 0x0000;
487 prop_line_out.color->blue = 0x0000;
488 }
489 else if(process_out->state->s == LTTV_STATE_RUN)
490 {
491 prop_line_out.color->red = 0x0000;
492 prop_line_out.color->green = 0xffff;
493 prop_line_out.color->blue = 0x0000;
494 }
495 else
496 {
cfe526b1 497 prop_line_out.color->red = 0xffff;
498 prop_line_out.color->green = 0xffff;
499 prop_line_out.color->blue = 0xffff;
a56a1ba4 500 }
501
502 draw_line((void*)&prop_line_out, (void*)draw_context_out);
503 g_free(prop_line_out.color);
504 gdk_gc_unref(draw_context_out->gc);
505 /* Note : finishing line will have to be added when trace read over. */
506
507 /* Finally, update the drawing context of the pid_in. */
508
14963be0 509 DrawContext *draw_context_in = hashed_process_data_in->draw_context;
68997a22 510 draw_context_in->current->modify_over->x = x;
319e9d81 511 draw_context_in->current->modify_under->x = x;
68997a22 512 draw_context_in->current->modify_over->y = y_in;
319e9d81 513 draw_context_in->current->modify_under->y = y_in+(height/2)+2;
501d5405 514 draw_context_in->drawable = control_flow_data->drawing->pixmap;
515 draw_context_in->pango_layout = control_flow_data->drawing->pango_layout;
516 widget = control_flow_data->drawing->drawing_area;
a56a1ba4 517 //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
518 //draw_context_in->gc = widget->style->black_gc;
d0cd7f09 519 //draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
520 //gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
a56a1ba4 521
522 //draw_arc((void*)&prop_arc, (void*)draw_context_in);
501d5405 523 //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
d0cd7f09 524
525 /* Draw the line/bg of the in process */
526 if(draw_context_in->previous->middle->x == -1)
527 {
528 draw_context_in->previous->middle->x = event_request->x_begin;
529 draw_context_in->previous->over->x = event_request->x_begin;
530 draw_context_in->previous->under->x = event_request->x_begin;
531 g_critical("in middle x_beg : %u",event_request->x_begin);
532 }
533
534 draw_context_in->current->middle->x = x;
535 draw_context_in->current->over->x = x;
536 draw_context_in->current->under->x = x;
537 draw_context_in->current->middle->y = y_in + height/2;
538 draw_context_in->current->over->y = y_in;
539 draw_context_in->current->under->y = y_in + height;
540 draw_context_in->previous->middle->y = y_in + height/2;
541 draw_context_in->previous->over->y = y_in;
542 draw_context_in->previous->under->y = y_in + height;
a56a1ba4 543
d0cd7f09 544 draw_context_in->drawable = control_flow_data->drawing->pixmap;
545 draw_context_in->pango_layout = control_flow_data->drawing->pango_layout;
546
547
548 if(process_in->state->s == LTTV_STATE_RUN)
549 {
550 draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
551 gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
552
553 PropertiesBG prop_bg;
554 prop_bg.color = g_new(GdkColor,1);
555
556 switch(tfc->index) {
557 case 0:
558 prop_bg.color->red = 0x1515;
559 prop_bg.color->green = 0x1515;
560 prop_bg.color->blue = 0x8c8c;
561 break;
562 case 1:
563 prop_bg.color->red = 0x4e4e;
564 prop_bg.color->green = 0xa9a9;
565 prop_bg.color->blue = 0xa4a4;
566 break;
567 case 2:
568 prop_bg.color->red = 0x7a7a;
569 prop_bg.color->green = 0x4a4a;
570 prop_bg.color->blue = 0x8b8b;
571 break;
572 case 3:
573 prop_bg.color->red = 0x8080;
574 prop_bg.color->green = 0x7777;
575 prop_bg.color->blue = 0x4747;
576 break;
577 default:
578 prop_bg.color->red = 0xe7e7;
579 prop_bg.color->green = 0xe7e7;
580 prop_bg.color->blue = 0xe7e7;
581 }
582
583
584 draw_bg((void*)&prop_bg, (void*)draw_context_in);
585 g_free(prop_bg.color);
586 gdk_gc_unref(draw_context_in->gc);
587 }
588
589 draw_context_in->gc = widget->style->black_gc;
590
a56a1ba4 591 GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 };
2df6f2bd 592 GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 };
a56a1ba4 593 PropertiesText prop_text_in;
594 prop_text_in.foreground = &colorfg_in;
595 prop_text_in.background = &colorbg_in;
cfe526b1 596 prop_text_in.size = 6;
a56a1ba4 597 prop_text_in.position = OVER;
598
d52cfc84 599 g_critical("in state : %s", g_quark_to_string(process_in->state->s));
cfe526b1 600 /* foreground of text : status of the process */
601 if(process_in->state->s == LTTV_STATE_UNNAMED)
602 {
603 prop_text_in.foreground->red = 0xffff;
604 prop_text_in.foreground->green = 0xffff;
605 prop_text_in.foreground->blue = 0xffff;
606 }
607 else if(process_in->state->s == LTTV_STATE_WAIT_FORK)
608 {
609 prop_text_in.foreground->red = 0x0fff;
d52cfc84 610 prop_text_in.foreground->green = 0xffff;
611 prop_text_in.foreground->blue = 0xfff0;
cfe526b1 612 }
613 else if(process_in->state->s == LTTV_STATE_WAIT_CPU)
614 {
2df6f2bd 615 prop_text_in.foreground->red = 0xffff;
616 prop_text_in.foreground->green = 0xffff;
cfe526b1 617 prop_text_in.foreground->blue = 0x0000;
618 }
619 else if(process_in->state->s == LTTV_STATE_EXIT)
620 {
621 prop_text_in.foreground->red = 0xffff;
622 prop_text_in.foreground->green = 0x0000;
623 prop_text_in.foreground->blue = 0xffff;
624 }
625 else if(process_in->state->s == LTTV_STATE_WAIT)
626 {
627 prop_text_in.foreground->red = 0xffff;
628 prop_text_in.foreground->green = 0x0000;
629 prop_text_in.foreground->blue = 0x0000;
630 }
631 else if(process_in->state->s == LTTV_STATE_RUN)
632 {
633 prop_text_in.foreground->red = 0x0000;
634 prop_text_in.foreground->green = 0xffff;
635 prop_text_in.foreground->blue = 0x0000;
636 }
637 else
638 {
639 prop_text_in.foreground->red = 0xffff;
640 prop_text_in.foreground->green = 0xffff;
641 prop_text_in.foreground->blue = 0xffff;
642 }
643
644
645
a56a1ba4 646 /* Print status of the process : U, WF, WC, E, W, R */
647 if(process_in->state->s == LTTV_STATE_UNNAMED)
cfe526b1 648 prop_text_in.text = "U->";
a56a1ba4 649 else if(process_in->state->s == LTTV_STATE_WAIT_FORK)
cfe526b1 650 prop_text_in.text = "WF->";
a56a1ba4 651 else if(process_in->state->s == LTTV_STATE_WAIT_CPU)
cfe526b1 652 prop_text_in.text = "WC->";
a56a1ba4 653 else if(process_in->state->s == LTTV_STATE_EXIT)
cfe526b1 654 prop_text_in.text = "E->";
a56a1ba4 655 else if(process_in->state->s == LTTV_STATE_WAIT)
cfe526b1 656 prop_text_in.text = "W->";
a56a1ba4 657 else if(process_in->state->s == LTTV_STATE_RUN)
cfe526b1 658 prop_text_in.text = "R->";
a56a1ba4 659 else
68997a22 660 prop_text_in.text = "U";
a56a1ba4 661
662 draw_text((void*)&prop_text_in, (void*)draw_context_in);
d0cd7f09 663 //gdk_gc_unref(draw_context_in->gc);
664
501d5405 665 draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
a56a1ba4 666 gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
d0cd7f09 667
a56a1ba4 668 PropertiesLine prop_line_in;
669 prop_line_in.color = g_new(GdkColor,1);
cfe526b1 670 prop_line_in.line_width = 2;
a56a1ba4 671 prop_line_in.style = GDK_LINE_SOLID;
672 prop_line_in.position = MIDDLE;
673
674 /* color of line : status of the process */
675 if(process_in->state->s == LTTV_STATE_UNNAMED)
676 {
cfe526b1 677 prop_line_in.color->red = 0xffff;
678 prop_line_in.color->green = 0xffff;
679 prop_line_in.color->blue = 0xffff;
a56a1ba4 680 }
681 else if(process_in->state->s == LTTV_STATE_WAIT_FORK)
682 {
683 prop_line_in.color->red = 0x0fff;
d52cfc84 684 prop_line_in.color->green = 0xffff;
685 prop_line_in.color->blue = 0xfff0;
a56a1ba4 686 }
687 else if(process_in->state->s == LTTV_STATE_WAIT_CPU)
688 {
2df6f2bd 689 prop_line_in.color->red = 0xffff;
690 prop_line_in.color->green = 0xffff;
a56a1ba4 691 prop_line_in.color->blue = 0x0000;
692 }
693 else if(process_in->state->s == LTTV_STATE_EXIT)
694 {
695 prop_line_in.color->red = 0xffff;
696 prop_line_in.color->green = 0x0000;
697 prop_line_in.color->blue = 0xffff;
698 }
699 else if(process_in->state->s == LTTV_STATE_WAIT)
700 {
701 prop_line_in.color->red = 0xffff;
702 prop_line_in.color->green = 0x0000;
703 prop_line_in.color->blue = 0x0000;
704 }
705 else if(process_in->state->s == LTTV_STATE_RUN)
706 {
707 prop_line_in.color->red = 0x0000;
708 prop_line_in.color->green = 0xffff;
709 prop_line_in.color->blue = 0x0000;
710 }
711 else
712 {
cfe526b1 713 prop_line_in.color->red = 0xffff;
714 prop_line_in.color->green = 0xffff;
715 prop_line_in.color->blue = 0xffff;
a56a1ba4 716 }
717
718 draw_line((void*)&prop_line_in, (void*)draw_context_in);
719 g_free(prop_line_in.color);
720 gdk_gc_unref(draw_context_in->gc);
721 }
722
723 return 0;
724
725 /* Temp dump */
80a52ff8 726#ifdef DONTSHOW
a56a1ba4 727 GString *string = g_string_new("");;
728 gboolean field_names = TRUE, state = TRUE;
80a52ff8 729
e9a9c513 730 lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs);
731 g_string_append_printf(string,"\n");
732
733 if(state) {
734 g_string_append_printf(string, " %s",
735 g_quark_to_string(tfs->process->state->s));
736 }
737
738 g_info("%s",string->str);
739
a56a1ba4 740 g_string_free(string, TRUE);
741
742 /* End of text dump */
80a52ff8 743#endif //DONTSHOW
50439712 744
f0d936c0 745}
746
747
4c69e0cc 748int draw_after_hook(void *hook_data, void *call_data)
f0d936c0 749{
14963be0 750 EventRequest *event_request = (EventRequest*)hook_data;
751 ControlFlowData *control_flow_data = event_request->control_flow_data;
50439712 752
a56a1ba4 753 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
50439712 754
755 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
1aff52a2 756 LttvTraceState *ts =(LttvTraceState *)LTTV_TRACEFILE_CONTEXT(tfs)->t_context;
50439712 757
a56a1ba4 758
50439712 759 LttEvent *e;
760 e = tfc->e;
761
9444deae 762 LttTime evtime = ltt_event_time(e);
763 TimeWindow *time_window =
764 guicontrolflow_get_time_window(control_flow_data);
765
766 LttTime end_time = ltt_time_add(time_window->start_time,
767 time_window->time_width);
768 //if(time < time_beg || time > time_end) return;
769 if(ltt_time_compare(evtime, time_window->start_time) == -1
770 || ltt_time_compare(evtime, end_time) == 1)
771 return;
772
773
a56a1ba4 774 if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0)
775 {
776 g_critical("schedchange!");
777
778 /* Add process to process list (if not present) and get drawing "y" from
779 * process position */
780 guint pid_out, pid_in;
781 LttvProcessState *process_out, *process_in;
782 LttTime birth;
783 guint y_in = 0, y_out = 0, height = 0, pl_height = 0;
784
785 ProcessList *process_list =
14963be0 786 guicontrolflow_get_process_list(event_request->control_flow_data);
a56a1ba4 787
788
789 LttField *f = ltt_event_field(e);
790 LttField *element;
791 element = ltt_field_member(f,0);
792 pid_out = ltt_event_get_long_unsigned(e,element);
793 element = ltt_field_member(f,1);
794 pid_in = ltt_event_get_long_unsigned(e,element);
cfe526b1 795 //g_critical("out : %u in : %u", pid_out, pid_in);
a56a1ba4 796
797
798 /* Find process pid_out in the list... */
1aff52a2 799 process_out = lttv_state_find_process_from_trace(ts, pid_out);
800 if(process_out == NULL) return 0;
cfe526b1 801 //g_critical("out : %s",g_quark_to_string(process_out->state->s));
a56a1ba4 802
803 birth = process_out->creation_time;
804 gchar *name = strdup(g_quark_to_string(process_out->name));
14963be0 805 HashedProcessData *hashed_process_data_out = NULL;
a56a1ba4 806
807 if(processlist_get_process_pixels(process_list,
808 pid_out,
809 &birth,
d0cd7f09 810 tfc->t_context->index,
a56a1ba4 811 &y_out,
812 &height,
14963be0 813 &hashed_process_data_out) == 1)
a56a1ba4 814 {
815 /* Process not present */
816 processlist_add(process_list,
817 pid_out,
818 &birth,
d0cd7f09 819 tfc->t_context->index,
a56a1ba4 820 name,
821 &pl_height,
14963be0 822 &hashed_process_data_out);
a56a1ba4 823 processlist_get_process_pixels(process_list,
824 pid_out,
825 &birth,
d0cd7f09 826 tfc->t_context->index,
a56a1ba4 827 &y_out,
828 &height,
14963be0 829 &hashed_process_data_out);
501d5405 830 drawing_insert_square( event_request->control_flow_data->drawing, y_out, height);
a56a1ba4 831 }
832
833 g_free(name);
834
835 /* Find process pid_in in the list... */
1aff52a2 836 process_in = lttv_state_find_process_from_trace(ts, pid_in);
837 if(process_in == NULL) return 0;
cfe526b1 838 //g_critical("in : %s",g_quark_to_string(process_in->state->s));
a56a1ba4 839
840 birth = process_in->creation_time;
841 name = strdup(g_quark_to_string(process_in->name));
14963be0 842 HashedProcessData *hashed_process_data_in = NULL;
a56a1ba4 843
844 if(processlist_get_process_pixels(process_list,
845 pid_in,
846 &birth,
d0cd7f09 847 tfc->t_context->index,
a56a1ba4 848 &y_in,
849 &height,
14963be0 850 &hashed_process_data_in) == 1)
a56a1ba4 851 {
852 /* Process not present */
853 processlist_add(process_list,
854 pid_in,
855 &birth,
d0cd7f09 856 tfc->t_context->index,
a56a1ba4 857 name,
858 &pl_height,
14963be0 859 &hashed_process_data_in);
a56a1ba4 860 processlist_get_process_pixels(process_list,
861 pid_in,
862 &birth,
d0cd7f09 863 tfc->t_context->index,
a56a1ba4 864 &y_in,
865 &height,
14963be0 866 &hashed_process_data_in);
a56a1ba4 867
501d5405 868 drawing_insert_square( event_request->control_flow_data->drawing, y_in, height);
a56a1ba4 869 }
870 g_free(name);
871
872
873 /* Find pixels corresponding to time of the event. If the time does
874 * not fit in the window, show a warning, not supposed to happend. */
875 //guint x = 0;
501d5405 876 //guint width = control_flow_data->drawing->drawing_area->allocation.width;
a56a1ba4 877
878 //LttTime time = ltt_event_time(e);
879
ba90bc77 880 //LttTime window_end = ltt_time_add(control_flow_data->time_window.time_width,
881 // control_flow_data->time_window.start_time);
a56a1ba4 882
883
884 //convert_time_to_pixels(
ba90bc77 885 // control_flow_data->time_window.start_time,
a56a1ba4 886 // window_end,
887 // time,
888 // width,
889 // &x);
890
891 //assert(x <= width);
892
893 /* draw what represents the event for outgoing process. */
894
14963be0 895 DrawContext *draw_context_out = hashed_process_data_out->draw_context;
68997a22 896 //draw_context_out->current->modify_over->x = x;
897 draw_context_out->current->modify_over->y = y_out;
319e9d81 898 draw_context_out->current->modify_under->y = y_out+(height/2)+2;
501d5405 899 draw_context_out->drawable = control_flow_data->drawing->pixmap;
900 draw_context_out->pango_layout = control_flow_data->drawing->pango_layout;
901 GtkWidget *widget = control_flow_data->drawing->drawing_area;
a56a1ba4 902 //draw_context_out->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
d0cd7f09 903
a56a1ba4 904 //draw_arc((void*)&prop_arc, (void*)draw_context_out);
501d5405 905 //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
d0cd7f09 906
907 /*if(process_out->state->s == LTTV_STATE_RUN)
908 {
909 draw_context_out->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
910 gdk_gc_copy(draw_context_out->gc, widget->style->black_gc);
911 PropertiesBG prop_bg;
912 prop_bg.color = g_new(GdkColor,1);
913
914 prop_bg.color->red = 0xffff;
915 prop_bg.color->green = 0xffff;
916 prop_bg.color->blue = 0xffff;
917
918 draw_bg((void*)&prop_bg, (void*)draw_context_out);
919 g_free(prop_bg.color);
920 gdk_gc_unref(draw_context_out->gc);
921 }*/
922
923 draw_context_out->gc = widget->style->black_gc;
924
a56a1ba4 925 GdkColor colorfg_out = { 0, 0xffff, 0x0000, 0x0000 };
2df6f2bd 926 GdkColor colorbg_out = { 0, 0x0000, 0x0000, 0x0000 };
a56a1ba4 927 PropertiesText prop_text_out;
928 prop_text_out.foreground = &colorfg_out;
929 prop_text_out.background = &colorbg_out;
cfe526b1 930 prop_text_out.size = 6;
a56a1ba4 931 prop_text_out.position = OVER;
932
cfe526b1 933 /* color of text : status of the process */
934 if(process_out->state->s == LTTV_STATE_UNNAMED)
935 {
936 prop_text_out.foreground->red = 0xffff;
937 prop_text_out.foreground->green = 0xffff;
938 prop_text_out.foreground->blue = 0xffff;
939 }
940 else if(process_out->state->s == LTTV_STATE_WAIT_FORK)
941 {
942 prop_text_out.foreground->red = 0x0fff;
d52cfc84 943 prop_text_out.foreground->green = 0xffff;
944 prop_text_out.foreground->blue = 0xfff0;
cfe526b1 945 }
946 else if(process_out->state->s == LTTV_STATE_WAIT_CPU)
947 {
2df6f2bd 948 prop_text_out.foreground->red = 0xffff;
949 prop_text_out.foreground->green = 0xffff;
cfe526b1 950 prop_text_out.foreground->blue = 0x0000;
951 }
952 else if(process_out->state->s == LTTV_STATE_EXIT)
953 {
954 prop_text_out.foreground->red = 0xffff;
955 prop_text_out.foreground->green = 0x0000;
956 prop_text_out.foreground->blue = 0xffff;
957 }
958 else if(process_out->state->s == LTTV_STATE_WAIT)
959 {
960 prop_text_out.foreground->red = 0xffff;
961 prop_text_out.foreground->green = 0x0000;
962 prop_text_out.foreground->blue = 0x0000;
963 }
964 else if(process_out->state->s == LTTV_STATE_RUN)
965 {
966 prop_text_out.foreground->red = 0x0000;
967 prop_text_out.foreground->green = 0xffff;
968 prop_text_out.foreground->blue = 0x0000;
969 }
970 else
971 {
972 prop_text_out.foreground->red = 0xffff;
973 prop_text_out.foreground->green = 0xffff;
974 prop_text_out.foreground->blue = 0xffff;
975 }
976
a56a1ba4 977 /* Print status of the process : U, WF, WC, E, W, R */
978 if(process_out->state->s == LTTV_STATE_UNNAMED)
68997a22 979 prop_text_out.text = "U";
a56a1ba4 980 else if(process_out->state->s == LTTV_STATE_WAIT_FORK)
68997a22 981 prop_text_out.text = "WF";
a56a1ba4 982 else if(process_out->state->s == LTTV_STATE_WAIT_CPU)
68997a22 983 prop_text_out.text = "WC";
a56a1ba4 984 else if(process_out->state->s == LTTV_STATE_EXIT)
68997a22 985 prop_text_out.text = "E";
a56a1ba4 986 else if(process_out->state->s == LTTV_STATE_WAIT)
68997a22 987 prop_text_out.text = "W";
a56a1ba4 988 else if(process_out->state->s == LTTV_STATE_RUN)
68997a22 989 prop_text_out.text = "R";
a56a1ba4 990 else
68997a22 991 prop_text_out.text = "U";
a56a1ba4 992
993 draw_text((void*)&prop_text_out, (void*)draw_context_out);
d0cd7f09 994
995 //gdk_gc_unref(draw_context_out->gc);
319e9d81 996
68997a22 997 draw_context_out->current->middle->y = y_out+height/2;
d0cd7f09 998 draw_context_out->current->over->y = y_out;
999 draw_context_out->current->under->y = y_out+height;
68997a22 1000 draw_context_out->current->status = process_out->state->s;
a56a1ba4 1001
68997a22 1002 /* for pid_out : remove previous, Prev = current, new current (default) */
1003 g_free(draw_context_out->previous->modify_under);
1004 g_free(draw_context_out->previous->modify_middle);
1005 g_free(draw_context_out->previous->modify_over);
1006 g_free(draw_context_out->previous->under);
1007 g_free(draw_context_out->previous->middle);
1008 g_free(draw_context_out->previous->over);
1009 g_free(draw_context_out->previous);
1010
1011 draw_context_out->previous = draw_context_out->current;
a56a1ba4 1012
68997a22 1013 draw_context_out->current = g_new(DrawInfo,1);
1014 draw_context_out->current->over = g_new(ItemInfo,1);
1015 draw_context_out->current->over->x = -1;
1016 draw_context_out->current->over->y = -1;
1017 draw_context_out->current->middle = g_new(ItemInfo,1);
1018 draw_context_out->current->middle->x = -1;
1019 draw_context_out->current->middle->y = -1;
1020 draw_context_out->current->under = g_new(ItemInfo,1);
1021 draw_context_out->current->under->x = -1;
1022 draw_context_out->current->under->y = -1;
1023 draw_context_out->current->modify_over = g_new(ItemInfo,1);
1024 draw_context_out->current->modify_over->x = -1;
1025 draw_context_out->current->modify_over->y = -1;
1026 draw_context_out->current->modify_middle = g_new(ItemInfo,1);
1027 draw_context_out->current->modify_middle->x = -1;
1028 draw_context_out->current->modify_middle->y = -1;
1029 draw_context_out->current->modify_under = g_new(ItemInfo,1);
1030 draw_context_out->current->modify_under->x = -1;
1031 draw_context_out->current->modify_under->y = -1;
1032 draw_context_out->current->status = LTTV_STATE_UNNAMED;
a56a1ba4 1033
1034 /* Finally, update the drawing context of the pid_in. */
1035
14963be0 1036 DrawContext *draw_context_in = hashed_process_data_in->draw_context;
68997a22 1037 //draw_context_in->current->modify_over->x = x;
1038 draw_context_in->current->modify_over->y = y_in;
319e9d81 1039 draw_context_in->current->modify_under->y = y_in+(height/2)+2;
501d5405 1040 draw_context_in->drawable = control_flow_data->drawing->pixmap;
1041 draw_context_in->pango_layout = control_flow_data->drawing->pango_layout;
1042 widget = control_flow_data->drawing->drawing_area;
a56a1ba4 1043 //draw_context_in->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
a56a1ba4 1044
1045 //draw_arc((void*)&prop_arc, (void*)draw_context_in);
501d5405 1046 //test_draw_item(control_flow_data->drawing, control_flow_data->drawing->pixmap);
d0cd7f09 1047
1048 /*if(process_in->state->s == LTTV_STATE_RUN)
1049 {
1050 draw_context_in->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
1051 gdk_gc_copy(draw_context_in->gc, widget->style->black_gc);
1052 PropertiesBG prop_bg;
1053 prop_bg.color = g_new(GdkColor,1);
1054
1055 prop_bg.color->red = 0xffff;
1056 prop_bg.color->green = 0xffff;
1057 prop_bg.color->blue = 0xffff;
1058
1059 draw_bg((void*)&prop_bg, (void*)draw_context_in);
1060 g_free(prop_bg.color);
1061 gdk_gc_unref(draw_context_in->gc);
1062 }*/
1063
1064 draw_context_in->gc = widget->style->black_gc;
1065
a56a1ba4 1066 GdkColor colorfg_in = { 0, 0x0000, 0xffff, 0x0000 };
2df6f2bd 1067 GdkColor colorbg_in = { 0, 0x0000, 0x0000, 0x0000 };
a56a1ba4 1068 PropertiesText prop_text_in;
1069 prop_text_in.foreground = &colorfg_in;
1070 prop_text_in.background = &colorbg_in;
cfe526b1 1071 prop_text_in.size = 6;
a56a1ba4 1072 prop_text_in.position = OVER;
1073
cfe526b1 1074 /* foreground of text : status of the process */
1075 if(process_in->state->s == LTTV_STATE_UNNAMED)
1076 {
1077 prop_text_in.foreground->red = 0xffff;
1078 prop_text_in.foreground->green = 0xffff;
1079 prop_text_in.foreground->blue = 0xffff;
1080 }
1081 else if(process_in->state->s == LTTV_STATE_WAIT_FORK)
1082 {
1083 prop_text_in.foreground->red = 0x0fff;
d52cfc84 1084 prop_text_in.foreground->green = 0xffff;
1085 prop_text_in.foreground->blue = 0xfff0;
cfe526b1 1086 }
1087 else if(process_in->state->s == LTTV_STATE_WAIT_CPU)
1088 {
2df6f2bd 1089 prop_text_in.foreground->red = 0xffff;
1090 prop_text_in.foreground->green = 0xffff;
cfe526b1 1091 prop_text_in.foreground->blue = 0x0000;
1092 }
1093 else if(process_in->state->s == LTTV_STATE_EXIT)
1094 {
1095 prop_text_in.foreground->red = 0xffff;
1096 prop_text_in.foreground->green = 0x0000;
1097 prop_text_in.foreground->blue = 0xffff;
1098 }
1099 else if(process_in->state->s == LTTV_STATE_WAIT)
1100 {
1101 prop_text_in.foreground->red = 0xffff;
1102 prop_text_in.foreground->green = 0x0000;
1103 prop_text_in.foreground->blue = 0x0000;
1104 }
1105 else if(process_in->state->s == LTTV_STATE_RUN)
1106 {
1107 prop_text_in.foreground->red = 0x0000;
1108 prop_text_in.foreground->green = 0xffff;
1109 prop_text_in.foreground->blue = 0x0000;
1110 }
1111 else
1112 {
1113 prop_text_in.foreground->red = 0xffff;
1114 prop_text_in.foreground->green = 0xffff;
1115 prop_text_in.foreground->blue = 0xffff;
1116 }
1117
1118
a56a1ba4 1119 /* Print status of the process : U, WF, WC, E, W, R */
1120 if(process_in->state->s == LTTV_STATE_UNNAMED)
68997a22 1121 prop_text_in.text = "U";
a56a1ba4 1122 else if(process_in->state->s == LTTV_STATE_WAIT_FORK)
68997a22 1123 prop_text_in.text = "WF";
a56a1ba4 1124 else if(process_in->state->s == LTTV_STATE_WAIT_CPU)
68997a22 1125 prop_text_in.text = "WC";
a56a1ba4 1126 else if(process_in->state->s == LTTV_STATE_EXIT)
68997a22 1127 prop_text_in.text = "E";
a56a1ba4 1128 else if(process_in->state->s == LTTV_STATE_WAIT)
68997a22 1129 prop_text_in.text = "W";
a56a1ba4 1130 else if(process_in->state->s == LTTV_STATE_RUN)
68997a22 1131 prop_text_in.text = "R";
a56a1ba4 1132 else
68997a22 1133 prop_text_in.text = "U";
a56a1ba4 1134
1135 draw_text((void*)&prop_text_in, (void*)draw_context_in);
1136
d0cd7f09 1137
319e9d81 1138 if(process_in->state->s == LTTV_STATE_RUN)
1139 {
1140 gchar tmp[255];
1141 prop_text_in.foreground = &colorfg_in;
1142 prop_text_in.background = &colorbg_in;
1143 prop_text_in.foreground->red = 0xffff;
1144 prop_text_in.foreground->green = 0xffff;
1145 prop_text_in.foreground->blue = 0xffff;
1146 prop_text_in.size = 6;
1147 prop_text_in.position = UNDER;
1148
1149 prop_text_in.text = g_new(gchar, 260);
1150 strcpy(prop_text_in.text, "CPU ");
1151 snprintf(tmp, 255, "%u", tfc->index);
1152 strcat(prop_text_in.text, tmp);
1153
1154 draw_text((void*)&prop_text_in, (void*)draw_context_in);
1155 g_free(prop_text_in.text);
1156 }
1157
1158
68997a22 1159 draw_context_in->current->middle->y = y_in+height/2;
d0cd7f09 1160 draw_context_in->current->over->y = y_in;
1161 draw_context_in->current->under->y = y_in+height;
68997a22 1162 draw_context_in->current->status = process_in->state->s;
1163
1164 /* for pid_in : remove previous, Prev = current, new current (default) */
1165 g_free(draw_context_in->previous->modify_under);
1166 g_free(draw_context_in->previous->modify_middle);
1167 g_free(draw_context_in->previous->modify_over);
1168 g_free(draw_context_in->previous->under);
1169 g_free(draw_context_in->previous->middle);
1170 g_free(draw_context_in->previous->over);
1171 g_free(draw_context_in->previous);
1172
1173 draw_context_in->previous = draw_context_in->current;
a56a1ba4 1174
68997a22 1175 draw_context_in->current = g_new(DrawInfo,1);
1176 draw_context_in->current->over = g_new(ItemInfo,1);
1177 draw_context_in->current->over->x = -1;
1178 draw_context_in->current->over->y = -1;
1179 draw_context_in->current->middle = g_new(ItemInfo,1);
1180 draw_context_in->current->middle->x = -1;
1181 draw_context_in->current->middle->y = -1;
1182 draw_context_in->current->under = g_new(ItemInfo,1);
1183 draw_context_in->current->under->x = -1;
1184 draw_context_in->current->under->y = -1;
1185 draw_context_in->current->modify_over = g_new(ItemInfo,1);
1186 draw_context_in->current->modify_over->x = -1;
1187 draw_context_in->current->modify_over->y = -1;
1188 draw_context_in->current->modify_middle = g_new(ItemInfo,1);
1189 draw_context_in->current->modify_middle->x = -1;
1190 draw_context_in->current->modify_middle->y = -1;
1191 draw_context_in->current->modify_under = g_new(ItemInfo,1);
1192 draw_context_in->current->modify_under->x = -1;
1193 draw_context_in->current->modify_under->y = -1;
1194 draw_context_in->current->status = LTTV_STATE_UNNAMED;
a56a1ba4 1195
1196 }
1197
1198 return 0;
f0d936c0 1199}
f7afe191 1200
1201
1202
1203
1b238973 1204gint update_time_window_hook(void *hook_data, void *call_data)
f7afe191 1205{
a56a1ba4 1206 ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
14963be0 1207 TimeWindow *old_time_window =
a56a1ba4 1208 guicontrolflow_get_time_window(control_flow_data);
14963be0 1209 TimeWindow *new_time_window = ((TimeWindow*)call_data);
a56a1ba4 1210
3cb8b205 1211 /* Update the ruler */
1212 drawing_update_ruler(control_flow_data->drawing,
1213 new_time_window);
1214
1215
a56a1ba4 1216 /* Two cases : zoom in/out or scrolling */
1217
1218 /* In order to make sure we can reuse the old drawing, the scale must
1219 * be the same and the new time interval being partly located in the
1220 * currently shown time interval. (reuse is only for scrolling)
1221 */
1222
1223 g_info("Old time window HOOK : %u, %u to %u, %u",
14963be0 1224 old_time_window->start_time.tv_sec,
1225 old_time_window->start_time.tv_nsec,
1226 old_time_window->time_width.tv_sec,
1227 old_time_window->time_width.tv_nsec);
a56a1ba4 1228
1229 g_info("New time window HOOK : %u, %u to %u, %u",
14963be0 1230 new_time_window->start_time.tv_sec,
1231 new_time_window->start_time.tv_nsec,
1232 new_time_window->time_width.tv_sec,
1233 new_time_window->time_width.tv_nsec);
a56a1ba4 1234
14963be0 1235 if( new_time_window->time_width.tv_sec == old_time_window->time_width.tv_sec
1236 && new_time_window->time_width.tv_nsec == old_time_window->time_width.tv_nsec)
a56a1ba4 1237 {
1238 /* Same scale (scrolling) */
1239 g_info("scrolling");
14963be0 1240 LttTime *ns = &new_time_window->start_time;
1241 LttTime *os = &old_time_window->start_time;
1242 LttTime old_end = ltt_time_add(old_time_window->start_time,
1243 old_time_window->time_width);
1244 LttTime new_end = ltt_time_add(new_time_window->start_time,
1245 new_time_window->time_width);
a56a1ba4 1246 //if(ns<os+w<ns+w)
1247 //if(ns<os+w && os+w<ns+w)
1248 //if(ns<old_end && os<ns)
1249 if(ltt_time_compare(*ns, old_end) == -1
1250 && ltt_time_compare(*os, *ns) == -1)
1251 {
1252 g_info("scrolling near right");
1253 /* Scroll right, keep right part of the screen */
1254 guint x = 0;
501d5405 1255 guint width = control_flow_data->drawing->drawing_area->allocation.width;
a56a1ba4 1256 convert_time_to_pixels(
1257 *os,
1258 old_end,
1259 *ns,
1260 width,
1261 &x);
1262
1263 /* Copy old data to new location */
501d5405 1264 gdk_draw_drawable (control_flow_data->drawing->pixmap,
cfe526b1 1265 control_flow_data->drawing->drawing_area->style->black_gc,
501d5405 1266 control_flow_data->drawing->pixmap,
a56a1ba4 1267 x, 0,
1268 0, 0,
1269 -1, -1);
1270
1271 convert_time_to_pixels(
1272 *ns,
1273 new_end,
1274 old_end,
1275 width,
1276 &x);
1277
14963be0 1278 *old_time_window = *new_time_window;
a56a1ba4 1279 /* Clear the data request background, but not SAFETY */
501d5405 1280 gdk_draw_rectangle (control_flow_data->drawing->pixmap,
cfe526b1 1281 control_flow_data->drawing->drawing_area->style->black_gc,
a56a1ba4 1282 TRUE,
1283 x+SAFETY, 0,
501d5405 1284 control_flow_data->drawing->width - x, // do not overlap
1285 control_flow_data->drawing->height+SAFETY);
a56a1ba4 1286 /* Get new data for the rest. */
501d5405 1287 drawing_data_request(control_flow_data->drawing,
1288 &control_flow_data->drawing->pixmap,
a56a1ba4 1289 x, 0,
501d5405 1290 control_flow_data->drawing->width - x,
1291 control_flow_data->drawing->height);
a56a1ba4 1292
501d5405 1293 drawing_refresh(control_flow_data->drawing,
a56a1ba4 1294 0, 0,
501d5405 1295 control_flow_data->drawing->width,
1296 control_flow_data->drawing->height);
a56a1ba4 1297
1298
1299 } else {
1300 //if(ns<os<ns+w)
1301 //if(ns<os && os<ns+w)
1302 //if(ns<os && os<new_end)
1303 if(ltt_time_compare(*ns,*os) == -1
1304 && ltt_time_compare(*os,new_end) == -1)
1305 {
1306 g_info("scrolling near left");
1307 /* Scroll left, keep left part of the screen */
1308 guint x = 0;
501d5405 1309 guint width = control_flow_data->drawing->drawing_area->allocation.width;
a56a1ba4 1310 convert_time_to_pixels(
1311 *ns,
1312 new_end,
1313 *os,
1314 width,
1315 &x);
1316
1317 /* Copy old data to new location */
501d5405 1318 gdk_draw_drawable (control_flow_data->drawing->pixmap,
cfe526b1 1319 control_flow_data->drawing->drawing_area->style->black_gc,
501d5405 1320 control_flow_data->drawing->pixmap,
a56a1ba4 1321 0, 0,
1322 x, 0,
1323 -1, -1);
1324
14963be0 1325 *old_time_window = *new_time_window;
a56a1ba4 1326
1327 /* Clean the data request background */
501d5405 1328 gdk_draw_rectangle (control_flow_data->drawing->pixmap,
cfe526b1 1329 control_flow_data->drawing->drawing_area->style->black_gc,
a56a1ba4 1330 TRUE,
1331 0, 0,
1332 x, // do not overlap
501d5405 1333 control_flow_data->drawing->height+SAFETY);
a56a1ba4 1334 /* Get new data for the rest. */
501d5405 1335 drawing_data_request(control_flow_data->drawing,
1336 &control_flow_data->drawing->pixmap,
a56a1ba4 1337 0, 0,
1338 x,
501d5405 1339 control_flow_data->drawing->height);
a56a1ba4 1340
501d5405 1341 drawing_refresh(control_flow_data->drawing,
a56a1ba4 1342 0, 0,
501d5405 1343 control_flow_data->drawing->width,
1344 control_flow_data->drawing->height);
a56a1ba4 1345
1346 } else {
1347 g_info("scrolling far");
1348 /* Cannot reuse any part of the screen : far jump */
14963be0 1349 *old_time_window = *new_time_window;
a56a1ba4 1350
1351
501d5405 1352 gdk_draw_rectangle (control_flow_data->drawing->pixmap,
cfe526b1 1353 control_flow_data->drawing->drawing_area->style->black_gc,
a56a1ba4 1354 TRUE,
1355 0, 0,
501d5405 1356 control_flow_data->drawing->width+SAFETY, // do not overlap
1357 control_flow_data->drawing->height+SAFETY);
a56a1ba4 1358
501d5405 1359 drawing_data_request(control_flow_data->drawing,
1360 &control_flow_data->drawing->pixmap,
a56a1ba4 1361 0, 0,
501d5405 1362 control_flow_data->drawing->width,
1363 control_flow_data->drawing->height);
a56a1ba4 1364
501d5405 1365 drawing_refresh(control_flow_data->drawing,
a56a1ba4 1366 0, 0,
501d5405 1367 control_flow_data->drawing->width,
1368 control_flow_data->drawing->height);
a56a1ba4 1369 }
1370 }
1371 } else {
1372 /* Different scale (zoom) */
1373 g_info("zoom");
1374
14963be0 1375 *old_time_window = *new_time_window;
a56a1ba4 1376
501d5405 1377 gdk_draw_rectangle (control_flow_data->drawing->pixmap,
cfe526b1 1378 control_flow_data->drawing->drawing_area->style->black_gc,
a56a1ba4 1379 TRUE,
1380 0, 0,
501d5405 1381 control_flow_data->drawing->width+SAFETY, // do not overlap
1382 control_flow_data->drawing->height+SAFETY);
a56a1ba4 1383
1384
501d5405 1385 drawing_data_request(control_flow_data->drawing,
1386 &control_flow_data->drawing->pixmap,
a56a1ba4 1387 0, 0,
501d5405 1388 control_flow_data->drawing->width,
1389 control_flow_data->drawing->height);
a56a1ba4 1390
501d5405 1391 drawing_refresh(control_flow_data->drawing,
a56a1ba4 1392 0, 0,
501d5405 1393 control_flow_data->drawing->width,
1394 control_flow_data->drawing->height);
a56a1ba4 1395 }
1396
3cb8b205 1397
1398
a56a1ba4 1399 return 0;
f7afe191 1400}
1401
1b238973 1402gint update_current_time_hook(void *hook_data, void *call_data)
f7afe191 1403{
14963be0 1404 ControlFlowData *control_flow_data = (ControlFlowData*)hook_data;
a56a1ba4 1405
1406 LttTime* current_time =
1407 guicontrolflow_get_current_time(control_flow_data);
1408 *current_time = *((LttTime*)call_data);
1409
1410 TimeWindow time_window;
1411
ba90bc77 1412 LttTime time_begin = control_flow_data->time_window.start_time;
1413 LttTime width = control_flow_data->time_window.time_width;
a56a1ba4 1414 LttTime half_width = ltt_time_div(width,2.0);
1415 LttTime time_end = ltt_time_add(time_begin, width);
1416
1417 LttvTracesetContext * tsc =
ba90bc77 1418 get_traceset_context(control_flow_data->mw);
a56a1ba4 1419
1420 LttTime trace_start = tsc->Time_Span->startTime;
1421 LttTime trace_end = tsc->Time_Span->endTime;
1422
68997a22 1423 g_info("New current time HOOK : %u, %u", current_time->tv_sec,
a56a1ba4 1424 current_time->tv_nsec);
1425
1426
1427
1428 /* If current time is inside time interval, just move the highlight
1429 * bar */
1430
1431 /* Else, we have to change the time interval. We have to tell it
1432 * to the main window. */
1433 /* The time interval change will take care of placing the current
1434 * time at the center of the visible area, or nearest possible if we are
1435 * at one end of the trace. */
1436
1437
1438 if(ltt_time_compare(*current_time, time_begin) == -1)
1439 {
1440 if(ltt_time_compare(*current_time,
1441 ltt_time_add(trace_start,half_width)) == -1)
1442 time_begin = trace_start;
1443 else
1444 time_begin = ltt_time_sub(*current_time,half_width);
1445
1446 time_window.start_time = time_begin;
1447 time_window.time_width = width;
1448
ba90bc77 1449 set_time_window(control_flow_data->mw, &time_window);
a56a1ba4 1450 }
1451 else if(ltt_time_compare(*current_time, time_end) == 1)
1452 {
1453 if(ltt_time_compare(*current_time, ltt_time_sub(trace_end, half_width)) == 1)
1454 time_begin = ltt_time_sub(trace_end,width);
1455 else
1456 time_begin = ltt_time_sub(*current_time,half_width);
1457
1458 time_window.start_time = time_begin;
1459 time_window.time_width = width;
1460
ba90bc77 1461 set_time_window(control_flow_data->mw, &time_window);
a56a1ba4 1462
1463 }
501d5405 1464 gtk_widget_queue_draw(control_flow_data->drawing->drawing_area);
a56a1ba4 1465
1466 return 0;
f7afe191 1467}
1468
8b90e648 1469typedef struct _ClosureData {
a56a1ba4 1470 EventRequest *event_request;
d0cd7f09 1471 LttvTracesetState *tss;
8b90e648 1472} ClosureData;
a56a1ba4 1473
8b90e648 1474
1475void draw_closure(gpointer key, gpointer value, gpointer user_data)
1476{
a56a1ba4 1477 ProcessInfo *process_info = (ProcessInfo*)key;
1478 HashedProcessData *hashed_process_data = (HashedProcessData*)value;
1479 ClosureData *closure_data = (ClosureData*)user_data;
1480
1481 ControlFlowData *control_flow_data =
68997a22 1482 closure_data->event_request->control_flow_data;
a56a1ba4 1483
501d5405 1484 GtkWidget *widget = control_flow_data->drawing->drawing_area;
a56a1ba4 1485
1486 /* Get y position of process */
1487 gint y=0, height=0;
1488
ba90bc77 1489 processlist_get_pixels_from_data( control_flow_data->process_list,
a56a1ba4 1490 process_info,
1491 hashed_process_data,
1492 &y,
1493 &height);
1494 /* Get last state of process */
1495 LttvTraceContext *tc =
d0cd7f09 1496 ((LttvTracesetContext*)closure_data->tss)->traces[process_info->trace_num];
1497 //LttvTracefileContext *tfc = (LttvTracefileContext *)closure_data->ts;
8b90e648 1498
d0cd7f09 1499 LttvTraceState *ts = (LttvTraceState*)tc;
a56a1ba4 1500 LttvProcessState *process;
1501
d0cd7f09 1502 process = lttv_state_find_process_from_trace(ts, process_info->pid);
a56a1ba4 1503
1504 /* Draw the closing line */
1505 DrawContext *draw_context = hashed_process_data->draw_context;
68997a22 1506 if(draw_context->previous->middle->x == -1)
a56a1ba4 1507 {
68997a22 1508 draw_context->previous->middle->x = closure_data->event_request->x_begin;
d0cd7f09 1509 draw_context->previous->over->x = closure_data->event_request->x_begin;
1510 draw_context->previous->under->x = closure_data->event_request->x_begin;
a56a1ba4 1511 g_critical("out middle x_beg : %u",closure_data->event_request->x_begin);
1512 }
1513
68997a22 1514 draw_context->current->middle->x = closure_data->event_request->x_end;
d0cd7f09 1515 draw_context->current->over->x = closure_data->event_request->x_end;
1516 draw_context->current->under->x = closure_data->event_request->x_end;
68997a22 1517 draw_context->current->middle->y = y + height/2;
d0cd7f09 1518 draw_context->current->over->y = y ;
1519 draw_context->current->under->y = y + height;
68997a22 1520 draw_context->previous->middle->y = y + height/2;
d0cd7f09 1521 draw_context->previous->over->y = y ;
1522 draw_context->previous->under->y = y + height;
501d5405 1523 draw_context->drawable = control_flow_data->drawing->pixmap;
1524 draw_context->pango_layout = control_flow_data->drawing->pango_layout;
a56a1ba4 1525 //draw_context->gc = widget->style->black_gc;
501d5405 1526 draw_context->gc = gdk_gc_new(control_flow_data->drawing->pixmap);
a56a1ba4 1527 gdk_gc_copy(draw_context->gc, widget->style->black_gc);
d0cd7f09 1528
ad2e83ba 1529 if(process != NULL && process->state->s == LTTV_STATE_RUN)
d0cd7f09 1530 {
1531 PropertiesBG prop_bg;
1532 prop_bg.color = g_new(GdkColor,1);
1533
1534 /*switch(tfc->index) {
1535 case 0:
1536 prop_bg.color->red = 0x1515;
1537 prop_bg.color->green = 0x1515;
1538 prop_bg.color->blue = 0x8c8c;
1539 break;
1540 case 1:
1541 prop_bg.color->red = 0x4e4e;
1542 prop_bg.color->green = 0xa9a9;
1543 prop_bg.color->blue = 0xa4a4;
1544 break;
1545 case 2:
1546 prop_bg.color->red = 0x7a7a;
1547 prop_bg.color->green = 0x4a4a;
1548 prop_bg.color->blue = 0x8b8b;
1549 break;
1550 case 3:
1551 prop_bg.color->red = 0x8080;
1552 prop_bg.color->green = 0x7777;
1553 prop_bg.color->blue = 0x4747;
1554 break;
1555 default:
1556 prop_bg.color->red = 0xe7e7;
1557 prop_bg.color->green = 0xe7e7;
1558 prop_bg.color->blue = 0xe7e7;
1559 }
1560 */
1561
1562 g_critical("calling from closure");
1563 //FIXME : I need the cpu number in process's state to draw this.
1564 //draw_bg((void*)&prop_bg, (void*)draw_context);
1565 g_free(prop_bg.color);
1566 }
1567
a56a1ba4 1568
1569 PropertiesLine prop_line;
1570 prop_line.color = g_new(GdkColor,1);
cfe526b1 1571 prop_line.line_width = 2;
a56a1ba4 1572 prop_line.style = GDK_LINE_SOLID;
1573 prop_line.position = MIDDLE;
1574
1575 /* color of line : status of the process */
ad2e83ba 1576 if(process != NULL)
a56a1ba4 1577 {
ad2e83ba 1578 if(process->state->s == LTTV_STATE_UNNAMED)
1579 {
1580 prop_line.color->red = 0xffff;
1581 prop_line.color->green = 0xffff;
1582 prop_line.color->blue = 0xffff;
1583 }
1584 else if(process->state->s == LTTV_STATE_WAIT_FORK)
1585 {
1586 prop_line.color->red = 0x0fff;
1587 prop_line.color->green = 0xffff;
1588 prop_line.color->blue = 0xfff0;
1589 }
1590 else if(process->state->s == LTTV_STATE_WAIT_CPU)
1591 {
1592 prop_line.color->red = 0xffff;
1593 prop_line.color->green = 0xffff;
1594 prop_line.color->blue = 0x0000;
1595 }
1596 else if(process->state->s == LTTV_STATE_EXIT)
1597 {
1598 prop_line.color->red = 0xffff;
1599 prop_line.color->green = 0x0000;
1600 prop_line.color->blue = 0xffff;
1601 }
1602 else if(process->state->s == LTTV_STATE_WAIT)
1603 {
1604 prop_line.color->red = 0xffff;
1605 prop_line.color->green = 0x0000;
1606 prop_line.color->blue = 0x0000;
1607 }
1608 else if(process->state->s == LTTV_STATE_RUN)
1609 {
1610 prop_line.color->red = 0x0000;
1611 prop_line.color->green = 0xffff;
1612 prop_line.color->blue = 0x0000;
1613 }
1614 else
1615 {
1616 prop_line.color->red = 0xffff;
1617 prop_line.color->green = 0xffff;
1618 prop_line.color->blue = 0xffff;
1619 }
1620
a56a1ba4 1621 }
1622 else
1623 {
ad2e83ba 1624 prop_line.color->red = 0xffff;
1625 prop_line.color->green = 0xffff;
1626 prop_line.color->blue = 0xffff;
a56a1ba4 1627 }
1628
1629 draw_line((void*)&prop_line, (void*)draw_context);
1630 g_free(prop_line.color);
1631 gdk_gc_unref(draw_context->gc);
1632
1633 /* Reset draw_context of the process for next request */
1634
1635 hashed_process_data->draw_context->drawable = NULL;
1636 hashed_process_data->draw_context->gc = NULL;
1637 hashed_process_data->draw_context->pango_layout = NULL;
68997a22 1638 hashed_process_data->draw_context->current->over->x = -1;
1639 hashed_process_data->draw_context->current->over->y = -1;
1640 hashed_process_data->draw_context->current->middle->x = -1;
1641 hashed_process_data->draw_context->current->middle->y = -1;
1642 hashed_process_data->draw_context->current->under->x = -1;
1643 hashed_process_data->draw_context->current->under->y = -1;
1644 hashed_process_data->draw_context->current->modify_over->x = -1;
1645 hashed_process_data->draw_context->current->modify_over->y = -1;
1646 hashed_process_data->draw_context->current->modify_middle->x = -1;
1647 hashed_process_data->draw_context->current->modify_middle->y = -1;
1648 hashed_process_data->draw_context->current->modify_under->x = -1;
1649 hashed_process_data->draw_context->current->modify_under->y = -1;
1650 hashed_process_data->draw_context->current->status = LTTV_STATE_UNNAMED;
1651 hashed_process_data->draw_context->previous->over->x = -1;
1652 hashed_process_data->draw_context->previous->over->y = -1;
1653 hashed_process_data->draw_context->previous->middle->x = -1;
1654 hashed_process_data->draw_context->previous->middle->y = -1;
1655 hashed_process_data->draw_context->previous->under->x = -1;
1656 hashed_process_data->draw_context->previous->under->y = -1;
1657 hashed_process_data->draw_context->previous->modify_over->x = -1;
1658 hashed_process_data->draw_context->previous->modify_over->y = -1;
1659 hashed_process_data->draw_context->previous->modify_middle->x = -1;
1660 hashed_process_data->draw_context->previous->modify_middle->y = -1;
1661 hashed_process_data->draw_context->previous->modify_under->x = -1;
1662 hashed_process_data->draw_context->previous->modify_under->y = -1;
1663 hashed_process_data->draw_context->previous->status = LTTV_STATE_UNNAMED;
a56a1ba4 1664
8b90e648 1665
1666}
1667
1668/*
1669 * for each process
a56a1ba4 1670 * draw closing line
1671 * new default prev and current
8b90e648 1672 */
1673int after_data_request(void *hook_data, void *call_data)
1674{
14963be0 1675 EventRequest *event_request = (EventRequest*)hook_data;
1676 ControlFlowData *control_flow_data = event_request->control_flow_data;
a56a1ba4 1677
1678 ProcessList *process_list =
14963be0 1679 guicontrolflow_get_process_list(event_request->control_flow_data);
a56a1ba4 1680
1681 ClosureData closure_data;
1682 closure_data.event_request = (EventRequest*)hook_data;
d0cd7f09 1683 closure_data.tss = (LttvTracesetState*)call_data;
a56a1ba4 1684
14963be0 1685 g_hash_table_foreach(process_list->process_hash, draw_closure,
a56a1ba4 1686 (void*)&closure_data);
1687
8b90e648 1688}
1689
This page took 0.107867 seconds and 4 git commands to generate.