1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
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;
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.
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,
20 /*****************************************************************************
21 * Hooks to be called by the main window *
22 *****************************************************************************/
25 /* Event hooks are the drawing hooks called during traceset read. They draw the
26 * icons, text, lines and background color corresponding to the events read.
28 * Two hooks are used for drawing : before_schedchange and after_schedchange hooks. The
29 * before_schedchange is called before the state update that occurs with an event and
30 * the after_schedchange hook is called after this state update.
32 * The before_schedchange hooks fulfill the task of drawing the visible objects that
33 * corresponds to the data accumulated by the after_schedchange hook.
35 * The after_schedchange hook accumulates the data that need to be shown on the screen
36 * (items) into a queue. Then, the next before_schedchange hook will draw what that
37 * queue contains. That's the Right Way (TM) of drawing items on the screen,
38 * because we need to draw the background first (and then add icons, text, ...
39 * over it), but we only know the length of a background region once the state
40 * corresponding to it is over, which happens to be at the next before_schedchange
43 * We also have a hook called at the end of a chunk to draw the information left
44 * undrawn in each process queue. We use the current time as end of
52 //#define PANGO_ENABLE_BACKEND
60 //#include <pango/pango.h>
62 #include <ltt/event.h>
65 #include <ltt/trace.h>
67 #include <lttv/lttv.h>
68 #include <lttv/hook.h>
69 #include <lttv/state.h>
70 #include <lttvwindow/lttvwindow.h>
71 #include <lttvwindow/lttvwindowtraces.h>
72 #include <lttvwindow/support.h>
75 #include "eventhooks.h"
77 #include "processlist.h"
81 #define MAX_PATH_LEN 256
83 extern GSList
*g_legend_list
;
86 /* Action to do when background computation completed.
88 * Wait for all the awaited computations to be over.
91 static gint
background_ready(void *hook_data
, void *call_data
)
93 ControlFlowData
*control_flow_data
= (ControlFlowData
*)hook_data
;
94 LttvTrace
*trace
= (LttvTrace
*)call_data
;
96 control_flow_data
->background_info_waiting
--;
98 if(control_flow_data
->background_info_waiting
== 0) {
99 g_message("control flow viewer : background computation data ready.");
101 drawing_clear(control_flow_data
->drawing
);
102 processlist_clear(control_flow_data
->process_list
);
103 gtk_widget_set_size_request(
104 control_flow_data
->drawing
->drawing_area
,
105 -1, processlist_get_height(control_flow_data
->process_list
));
106 redraw_notify(control_flow_data
, NULL
);
113 /* Request background computation. Verify if it is in progress or ready first.
114 * Only for each trace in the tab's traceset.
116 static void request_background_data(ControlFlowData
*control_flow_data
)
118 LttvTracesetContext
* tsc
=
119 lttvwindow_get_traceset_context(control_flow_data
->tab
);
120 gint num_traces
= lttv_traceset_number(tsc
->ts
);
124 LttvHooks
*background_ready_hook
=
126 lttv_hooks_add(background_ready_hook
, background_ready
, control_flow_data
,
128 control_flow_data
->background_info_waiting
= 0;
130 for(i
=0;i
<num_traces
;i
++) {
131 trace
= lttv_traceset_get(tsc
->ts
, i
);
133 if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace
)==FALSE
) {
135 if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"),
137 /* We first remove requests that could have been done for the same
138 * information. Happens when two viewers ask for it before servicing
141 if(!lttvwindowtraces_background_request_find(trace
, "state"))
142 lttvwindowtraces_background_request_queue(
143 main_window_get_widget(control_flow_data
->tab
), trace
, "state");
144 lttvwindowtraces_background_notify_queue(control_flow_data
,
148 background_ready_hook
);
149 control_flow_data
->background_info_waiting
++;
150 } else { /* in progress */
152 lttvwindowtraces_background_notify_current(control_flow_data
,
156 background_ready_hook
);
157 control_flow_data
->background_info_waiting
++;
160 /* Data ready. Be its nature, this viewer doesn't need to have
161 * its data ready hook called there, because a background
162 * request is always linked with a redraw.
168 lttv_hooks_destroy(background_ready_hook
);
175 * Event Viewer's constructor hook
177 * This constructor is given as a parameter to the menuitem and toolbar button
178 * registration. It creates the list.
179 * @param tab A pointer to the parent tab.
180 * @return The widget created.
183 h_guicontrolflow(Tab
*tab
)
185 g_info("h_guicontrolflow, %p", tab
);
186 ControlFlowData
*control_flow_data
= guicontrolflow(tab
) ;
188 control_flow_data
->tab
= tab
;
190 // Unreg done in the GuiControlFlow_Destructor
191 lttvwindow_register_traceset_notify(tab
,
195 lttvwindow_register_time_window_notify(tab
,
196 update_time_window_hook
,
198 lttvwindow_register_current_time_notify(tab
,
199 update_current_time_hook
,
201 lttvwindow_register_redraw_notify(tab
,
204 lttvwindow_register_continue_notify(tab
,
207 request_background_data(control_flow_data
);
210 return guicontrolflow_get_widget(control_flow_data
) ;
214 void legend_destructor(GtkWindow
*legend
)
216 g_legend_list
= g_slist_remove(g_legend_list
, legend
);
219 /* Create a popup legend */
223 g_info("h_legend, %p", tab
);
225 GtkWindow
*legend
= GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL
));
227 g_legend_list
= g_slist_append(
231 g_object_set_data_full(
235 (GDestroyNotify
)legend_destructor
);
237 gtk_window_set_title(legend
, "Control Flow View Legend");
239 GtkWidget
*pixmap
= create_pixmap(GTK_WIDGET(legend
), "lttv-color-list.png");
241 // GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixmap(
242 // GDK_PIXMAP(pixmap), NULL));
244 gtk_container_add(GTK_CONTAINER(legend
), GTK_WIDGET(pixmap
));
246 gtk_widget_show(GTK_WIDGET(pixmap
));
247 gtk_widget_show(GTK_WIDGET(legend
));
250 return NULL
; /* This is a popup window */
254 int event_selected_hook(void *hook_data
, void *call_data
)
256 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
257 guint
*event_number
= (guint
*) call_data
;
259 g_debug("DEBUG : event selected by main window : %u", *event_number
);
264 /* Function that selects the color of status&exemode line */
265 static inline PropertiesLine
prepare_s_e_line(LttvProcessState
*process
)
267 PropertiesLine prop_line
;
268 prop_line
.line_width
= 2;
269 prop_line
.style
= GDK_LINE_SOLID
;
270 prop_line
.y
= MIDDLE
;
271 //GdkColormap *colormap = gdk_colormap_get_system();
273 if(process
->state
->s
== LTTV_STATE_RUN
) {
274 if(process
->state
->t
== LTTV_STATE_USER_MODE
)
275 prop_line
.color
= drawing_colors
[COL_RUN_USER_MODE
];
276 else if(process
->state
->t
== LTTV_STATE_SYSCALL
)
277 prop_line
.color
= drawing_colors
[COL_RUN_SYSCALL
];
278 else if(process
->state
->t
== LTTV_STATE_TRAP
)
279 prop_line
.color
= drawing_colors
[COL_RUN_TRAP
];
280 else if(process
->state
->t
== LTTV_STATE_IRQ
)
281 prop_line
.color
= drawing_colors
[COL_RUN_IRQ
];
282 else if(process
->state
->t
== LTTV_STATE_SOFT_IRQ
)
283 prop_line
.color
= drawing_colors
[COL_RUN_SOFT_IRQ
];
284 else if(process
->state
->t
== LTTV_STATE_MODE_UNKNOWN
)
285 prop_line
.color
= drawing_colors
[COL_MODE_UNKNOWN
];
287 g_assert(FALSE
); /* RUNNING MODE UNKNOWN */
288 } else if(process
->state
->s
== LTTV_STATE_WAIT
) {
289 /* We don't show if we wait while in user mode, trap, irq or syscall */
290 prop_line
.color
= drawing_colors
[COL_WAIT
];
291 } else if(process
->state
->s
== LTTV_STATE_WAIT_CPU
) {
292 /* We don't show if we wait for CPU while in user mode, trap, irq
294 prop_line
.color
= drawing_colors
[COL_WAIT_CPU
];
295 } else if(process
->state
->s
== LTTV_STATE_ZOMBIE
) {
296 prop_line
.color
= drawing_colors
[COL_ZOMBIE
];
297 } else if(process
->state
->s
== LTTV_STATE_WAIT_FORK
) {
298 prop_line
.color
= drawing_colors
[COL_WAIT_FORK
];
299 } else if(process
->state
->s
== LTTV_STATE_EXIT
) {
300 prop_line
.color
= drawing_colors
[COL_EXIT
];
301 } else if(process
->state
->s
== LTTV_STATE_UNNAMED
) {
302 prop_line
.color
= drawing_colors
[COL_UNNAMED
];
304 g_assert(FALSE
); /* UNKNOWN STATE */
311 /* before_schedchange_hook
313 * This function basically draw lines and icons. Two types of lines are drawn :
314 * one small (3 pixels?) representing the state of the process and the second
315 * type is thicker (10 pixels?) representing on which CPU a process is running
316 * (and this only in running state).
318 * Extremums of the lines :
319 * x_min : time of the last event context for this process kept in memory.
320 * x_max : time of the current event.
321 * y : middle of the process in the process list. The process is found in the
322 * list, therefore is it's position in pixels.
324 * The choice of lines'color is defined by the context of the last event for this
329 int before_schedchange_hook(void *hook_data
, void *call_data
)
331 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
332 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
333 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
335 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
337 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
338 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
341 e
= ltt_tracefile_get_event(tfc
->tf
);
343 LttTime evtime
= ltt_event_time(e
);
345 /* we are in a schedchange, before the state update. We must draw the
346 * items corresponding to the state before it changes : now is the right
353 pid_out
= ltt_event_get_long_unsigned(e
, thf
->f1
);
354 pid_in
= ltt_event_get_long_unsigned(e
, thf
->f2
);
358 /* For the pid_out */
359 /* First, check if the current process is in the state computation
360 * process list. If it is there, that means we must add it right now and
361 * draw items from the beginning of the read for it. If it is not
362 * present, it's a new process and it was not present : it will
363 * be added after the state update. */
364 guint cpu
= ltt_tracefile_num(tfc
->tf
);
365 LttvProcessState
*process
= ts
->running_process
[cpu
];
366 /* unknown state, bad current pid */
367 if(process
->pid
!= pid_out
)
368 process
= lttv_state_find_process(ts
,
369 ltt_tracefile_num(tfc
->tf
), pid_out
);
371 if(process
!= NULL
) {
372 /* Well, the process_out existed : we must get it in the process hash
373 * or add it, and draw its items.
375 /* Add process to process list (if not present) */
377 HashedProcessData
*hashed_process_data
= NULL
;
378 ProcessList
*process_list
= control_flow_data
->process_list
;
379 LttTime birth
= process
->creation_time
;
381 hashed_process_data
= processlist_get_process_data(process_list
,
385 tfc
->t_context
->index
);
386 if(hashed_process_data
== NULL
)
388 g_assert(pid_out
== 0 || pid_out
!= process
->ppid
);
389 /* Process not present */
390 ProcessInfo
*process_info
;
391 Drawing_t
*drawing
= control_flow_data
->drawing
;
392 processlist_add(process_list
,
398 tfc
->t_context
->index
,
402 &hashed_process_data
);
403 gtk_widget_set_size_request(drawing
->drawing_area
,
406 gtk_widget_queue_draw(drawing
->drawing_area
);
410 /* Now, the process is in the state hash and our own process hash.
411 * We definitely can draw the items related to the ending state.
414 if(ltt_time_compare(hashed_process_data
->next_good_time
,
417 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
419 TimeWindow time_window
=
420 lttvwindow_get_time_window(control_flow_data
->tab
);
422 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
423 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
426 Drawing_t
*drawing
= control_flow_data
->drawing
;
427 guint width
= drawing
->width
;
429 convert_time_to_pixels(
435 /* Draw collision indicator */
436 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
437 gdk_draw_point(hashed_process_data
->pixmap
,
440 (hashed_process_data
->height
/2)-3);
441 hashed_process_data
->x
.middle_marked
= TRUE
;
444 TimeWindow time_window
=
445 lttvwindow_get_time_window(control_flow_data
->tab
);
447 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
448 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
451 Drawing_t
*drawing
= control_flow_data
->drawing
;
452 guint width
= drawing
->width
;
454 convert_time_to_pixels(
461 /* Jump over draw if we are at the same x position */
462 if(x
== hashed_process_data
->x
.middle
&&
463 hashed_process_data
->x
.middle_used
)
465 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
466 /* Draw collision indicator */
467 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
468 gdk_draw_point(hashed_process_data
->pixmap
,
471 (hashed_process_data
->height
/2)-3);
472 hashed_process_data
->x
.middle_marked
= TRUE
;
476 DrawContext draw_context
;
478 /* Now create the drawing context that will be used to draw
479 * items related to the last state. */
480 draw_context
.drawable
= hashed_process_data
->pixmap
;
481 draw_context
.gc
= drawing
->gc
;
482 draw_context
.pango_layout
= drawing
->pango_layout
;
483 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
484 draw_context
.drawinfo
.end
.x
= x
;
486 draw_context
.drawinfo
.y
.over
= 1;
487 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
488 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
490 draw_context
.drawinfo
.start
.offset
.over
= 0;
491 draw_context
.drawinfo
.start
.offset
.middle
= 0;
492 draw_context
.drawinfo
.start
.offset
.under
= 0;
493 draw_context
.drawinfo
.end
.offset
.over
= 0;
494 draw_context
.drawinfo
.end
.offset
.middle
= 0;
495 draw_context
.drawinfo
.end
.offset
.under
= 0;
499 PropertiesLine prop_line
= prepare_s_e_line(process
);
500 draw_line((void*)&prop_line
, (void*)&draw_context
);
503 /* become the last x position */
504 hashed_process_data
->x
.middle
= x
;
505 hashed_process_data
->x
.middle_used
= TRUE
;
506 hashed_process_data
->x
.middle_marked
= FALSE
;
508 /* Calculate the next good time */
509 convert_pixels_to_time(width
, x
+1, time_window
,
510 &hashed_process_data
->next_good_time
);
518 /* First, check if the current process is in the state computation
519 * process list. If it is there, that means we must add it right now and
520 * draw items from the beginning of the read for it. If it is not
521 * present, it's a new process and it was not present : it will
522 * be added after the state update. */
523 LttvProcessState
*process
;
524 process
= lttv_state_find_process(ts
,
525 ltt_tracefile_num(tfc
->tf
), pid_in
);
527 if(process
!= NULL
) {
528 /* Well, the process existed : we must get it in the process hash
529 * or add it, and draw its items.
531 /* Add process to process list (if not present) */
533 HashedProcessData
*hashed_process_data
= NULL
;
534 ProcessList
*process_list
= control_flow_data
->process_list
;
535 LttTime birth
= process
->creation_time
;
537 hashed_process_data
= processlist_get_process_data(process_list
,
539 ltt_tracefile_num(tfc
->tf
),
541 tfc
->t_context
->index
);
542 if(hashed_process_data
== NULL
)
544 g_assert(pid_in
== 0 || pid_in
!= process
->ppid
);
545 /* Process not present */
546 ProcessInfo
*process_info
;
547 Drawing_t
*drawing
= control_flow_data
->drawing
;
548 processlist_add(process_list
,
551 ltt_tracefile_num(tfc
->tf
),
554 tfc
->t_context
->index
,
558 &hashed_process_data
);
559 gtk_widget_set_size_request(drawing
->drawing_area
,
562 gtk_widget_queue_draw(drawing
->drawing_area
);
565 //We could set the current process and hash here, but will be done
566 //by after schedchange hook
568 /* Now, the process is in the state hash and our own process hash.
569 * We definitely can draw the items related to the ending state.
572 if(ltt_time_compare(hashed_process_data
->next_good_time
,
575 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
577 TimeWindow time_window
=
578 lttvwindow_get_time_window(control_flow_data
->tab
);
580 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
581 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
584 Drawing_t
*drawing
= control_flow_data
->drawing
;
585 guint width
= drawing
->width
;
587 convert_time_to_pixels(
593 /* Draw collision indicator */
594 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
595 gdk_draw_point(hashed_process_data
->pixmap
,
598 (hashed_process_data
->height
/2)-3);
599 hashed_process_data
->x
.middle_marked
= TRUE
;
602 TimeWindow time_window
=
603 lttvwindow_get_time_window(control_flow_data
->tab
);
605 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
606 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
609 Drawing_t
*drawing
= control_flow_data
->drawing
;
610 guint width
= drawing
->width
;
613 convert_time_to_pixels(
620 /* Jump over draw if we are at the same x position */
621 if(x
== hashed_process_data
->x
.middle
&&
622 hashed_process_data
->x
.middle_used
)
624 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
625 /* Draw collision indicator */
626 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
627 gdk_draw_point(hashed_process_data
->pixmap
,
630 (hashed_process_data
->height
/2)-3);
631 hashed_process_data
->x
.middle_marked
= TRUE
;
635 DrawContext draw_context
;
637 /* Now create the drawing context that will be used to draw
638 * items related to the last state. */
639 draw_context
.drawable
= hashed_process_data
->pixmap
;
640 draw_context
.gc
= drawing
->gc
;
641 draw_context
.pango_layout
= drawing
->pango_layout
;
642 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
643 draw_context
.drawinfo
.end
.x
= x
;
645 draw_context
.drawinfo
.y
.over
= 1;
646 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
647 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
649 draw_context
.drawinfo
.start
.offset
.over
= 0;
650 draw_context
.drawinfo
.start
.offset
.middle
= 0;
651 draw_context
.drawinfo
.start
.offset
.under
= 0;
652 draw_context
.drawinfo
.end
.offset
.over
= 0;
653 draw_context
.drawinfo
.end
.offset
.middle
= 0;
654 draw_context
.drawinfo
.end
.offset
.under
= 0;
658 PropertiesLine prop_line
= prepare_s_e_line(process
);
659 draw_line((void*)&prop_line
, (void*)&draw_context
);
663 /* become the last x position */
664 hashed_process_data
->x
.middle
= x
;
665 hashed_process_data
->x
.middle_used
= TRUE
;
666 hashed_process_data
->x
.middle_marked
= FALSE
;
668 /* Calculate the next good time */
669 convert_pixels_to_time(width
, x
+1, time_window
,
670 &hashed_process_data
->next_good_time
);
674 g_warning("Cannot find pin_in in schedchange %u", pid_in
);
683 GString
*string
= g_string_new("");;
684 gboolean field_names
= TRUE
, state
= TRUE
;
686 lttv_event_to_string(e
, tfc
->tf
, string
, TRUE
, field_names
, tfs
);
687 g_string_append_printf(string
,"\n");
690 g_string_append_printf(string
, " %s",
691 g_quark_to_string(tfs
->process
->state
->s
));
694 g_info("%s",string
->str
);
696 g_string_free(string
, TRUE
);
698 /* End of text dump */
703 /* after_schedchange_hook
705 * The draw after hook is called by the reading API to have a
706 * particular event drawn on the screen.
707 * @param hook_data ControlFlowData structure of the viewer.
708 * @param call_data Event context.
710 * This function adds items to be drawn in a queue for each process.
713 int after_schedchange_hook(void *hook_data
, void *call_data
)
715 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
716 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
717 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
719 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
721 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
723 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
726 e
= ltt_tracefile_get_event(tfc
->tf
);
728 LttTime evtime
= ltt_event_time(e
);
730 /* Add process to process list (if not present) */
731 LttvProcessState
*process_in
;
734 HashedProcessData
*hashed_process_data_in
= NULL
;
736 ProcessList
*process_list
= control_flow_data
->process_list
;
741 pid_out
= ltt_event_get_long_unsigned(e
, thf
->f1
);
742 pid_in
= ltt_event_get_long_unsigned(e
, thf
->f2
);
746 /* Find process pid_in in the list... */
747 //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
748 //process_in = tfs->process;
749 guint cpu
= ltt_tracefile_num(tfc
->tf
);
750 process_in
= ts
->running_process
[cpu
];
751 /* It should exist, because we are after the state update. */
753 g_assert(process_in
!= NULL
);
755 birth
= process_in
->creation_time
;
757 hashed_process_data_in
= processlist_get_process_data(process_list
,
761 tfc
->t_context
->index
);
762 if(hashed_process_data_in
== NULL
)
764 g_assert(pid_in
== 0 || pid_in
!= process_in
->ppid
);
765 ProcessInfo
*process_info
;
766 Drawing_t
*drawing
= control_flow_data
->drawing
;
767 /* Process not present */
768 processlist_add(process_list
,
774 tfc
->t_context
->index
,
778 &hashed_process_data_in
);
779 gtk_widget_set_size_request(drawing
->drawing_area
,
782 gtk_widget_queue_draw(drawing
->drawing_area
);
784 /* Set the current process */
785 process_list
->current_hash_data
[process_in
->cpu
] =
786 hashed_process_data_in
;
788 if(ltt_time_compare(hashed_process_data_in
->next_good_time
,
791 TimeWindow time_window
=
792 lttvwindow_get_time_window(control_flow_data
->tab
);
795 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
796 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
799 Drawing_t
*drawing
= control_flow_data
->drawing
;
800 guint width
= drawing
->width
;
803 convert_time_to_pixels(
809 if(hashed_process_data_in
->x
.middle
!= new_x
) {
810 hashed_process_data_in
->x
.middle
= new_x
;
811 hashed_process_data_in
->x
.middle_used
= FALSE
;
812 hashed_process_data_in
->x
.middle_marked
= FALSE
;
821 /* before_execmode_hook
823 * This function basically draw lines and icons. Two types of lines are drawn :
824 * one small (3 pixels?) representing the state of the process and the second
825 * type is thicker (10 pixels?) representing on which CPU a process is running
826 * (and this only in running state).
828 * Extremums of the lines :
829 * x_min : time of the last event context for this process kept in memory.
830 * x_max : time of the current event.
831 * y : middle of the process in the process list. The process is found in the
832 * list, therefore is it's position in pixels.
834 * The choice of lines'color is defined by the context of the last event for this
839 int before_execmode_hook(void *hook_data
, void *call_data
)
841 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
842 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
843 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
845 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
847 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
849 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
852 e
= ltt_tracefile_get_event(tfc
->tf
);
854 LttTime evtime
= ltt_event_time(e
);
856 /* we are in a execmode, before the state update. We must draw the
857 * items corresponding to the state before it changes : now is the right
861 //LttvProcessState *process = tfs->process;
862 guint cpu
= ltt_tracefile_num(tfc
->tf
);
863 LttvProcessState
*process
= ts
->running_process
[cpu
];
864 g_assert(process
!= NULL
);
866 guint pid
= process
->pid
;
868 /* Well, the process_out existed : we must get it in the process hash
869 * or add it, and draw its items.
871 /* Add process to process list (if not present) */
873 HashedProcessData
*hashed_process_data
= NULL
;
874 ProcessList
*process_list
= control_flow_data
->process_list
;
875 LttTime birth
= process
->creation_time
;
877 if(likely(process_list
->current_hash_data
[cpu
] != NULL
)) {
878 hashed_process_data
= process_list
->current_hash_data
[cpu
];
880 hashed_process_data
= processlist_get_process_data(process_list
,
884 tfc
->t_context
->index
);
885 if(unlikely(hashed_process_data
== NULL
))
887 g_assert(pid
== 0 || pid
!= process
->ppid
);
888 ProcessInfo
*process_info
;
889 /* Process not present */
890 Drawing_t
*drawing
= control_flow_data
->drawing
;
891 processlist_add(process_list
,
897 tfc
->t_context
->index
,
901 &hashed_process_data
);
902 gtk_widget_set_size_request(drawing
->drawing_area
,
905 gtk_widget_queue_draw(drawing
->drawing_area
);
907 /* Set the current process */
908 process_list
->current_hash_data
[process
->cpu
] =
912 /* Now, the process is in the state hash and our own process hash.
913 * We definitely can draw the items related to the ending state.
916 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
919 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
920 TimeWindow time_window
=
921 lttvwindow_get_time_window(control_flow_data
->tab
);
924 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
925 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
928 Drawing_t
*drawing
= control_flow_data
->drawing
;
929 guint width
= drawing
->width
;
931 convert_time_to_pixels(
937 /* Draw collision indicator */
938 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
939 gdk_draw_point(hashed_process_data
->pixmap
,
942 (hashed_process_data
->height
/2)-3);
943 hashed_process_data
->x
.middle_marked
= TRUE
;
946 TimeWindow time_window
=
947 lttvwindow_get_time_window(control_flow_data
->tab
);
950 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
951 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
954 Drawing_t
*drawing
= control_flow_data
->drawing
;
955 guint width
= drawing
->width
;
958 convert_time_to_pixels(
965 /* Jump over draw if we are at the same x position */
966 if(unlikely(x
== hashed_process_data
->x
.middle
&&
967 hashed_process_data
->x
.middle_used
))
969 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
970 /* Draw collision indicator */
971 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
972 gdk_draw_point(hashed_process_data
->pixmap
,
975 (hashed_process_data
->height
/2)-3);
976 hashed_process_data
->x
.middle_marked
= TRUE
;
981 DrawContext draw_context
;
982 /* Now create the drawing context that will be used to draw
983 * items related to the last state. */
984 draw_context
.drawable
= hashed_process_data
->pixmap
;
985 draw_context
.gc
= drawing
->gc
;
986 draw_context
.pango_layout
= drawing
->pango_layout
;
987 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
988 draw_context
.drawinfo
.end
.x
= x
;
990 draw_context
.drawinfo
.y
.over
= 1;
991 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
992 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
994 draw_context
.drawinfo
.start
.offset
.over
= 0;
995 draw_context
.drawinfo
.start
.offset
.middle
= 0;
996 draw_context
.drawinfo
.start
.offset
.under
= 0;
997 draw_context
.drawinfo
.end
.offset
.over
= 0;
998 draw_context
.drawinfo
.end
.offset
.middle
= 0;
999 draw_context
.drawinfo
.end
.offset
.under
= 0;
1003 PropertiesLine prop_line
= prepare_s_e_line(process
);
1004 draw_line((void*)&prop_line
, (void*)&draw_context
);
1007 /* become the last x position */
1008 hashed_process_data
->x
.middle
= x
;
1009 hashed_process_data
->x
.middle_used
= TRUE
;
1010 hashed_process_data
->x
.middle_marked
= FALSE
;
1012 /* Calculate the next good time */
1013 convert_pixels_to_time(width
, x
+1, time_window
,
1014 &hashed_process_data
->next_good_time
);
1021 /* before_process_exit_hook
1023 * Draw lines for process event.
1025 * @param hook_data ControlFlowData structure of the viewer.
1026 * @param call_data Event context.
1028 * This function adds items to be drawn in a queue for each process.
1033 int before_process_exit_hook(void *hook_data
, void *call_data
)
1035 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1036 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1038 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1040 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1042 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1044 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1047 e
= ltt_tracefile_get_event(tfc
->tf
);
1049 LttTime evtime
= ltt_event_time(e
);
1051 /* Add process to process list (if not present) */
1052 //LttvProcessState *process = tfs->process;
1053 guint cpu
= ltt_tracefile_num(tfc
->tf
);
1054 LttvProcessState
*process
= ts
->running_process
[cpu
];
1055 guint pid
= process
->pid
;
1057 guint pl_height
= 0;
1058 HashedProcessData
*hashed_process_data
= NULL
;
1060 ProcessList
*process_list
= control_flow_data
->process_list
;
1062 g_assert(process
!= NULL
);
1064 birth
= process
->creation_time
;
1066 if(likely(process_list
->current_hash_data
[cpu
] != NULL
)) {
1067 hashed_process_data
= process_list
->current_hash_data
[cpu
];
1069 hashed_process_data
= processlist_get_process_data(process_list
,
1073 tfc
->t_context
->index
);
1074 if(unlikely(hashed_process_data
== NULL
))
1076 g_assert(pid
== 0 || pid
!= process
->ppid
);
1077 /* Process not present */
1078 Drawing_t
*drawing
= control_flow_data
->drawing
;
1079 ProcessInfo
*process_info
;
1080 processlist_add(process_list
,
1086 tfc
->t_context
->index
,
1090 &hashed_process_data
);
1091 gtk_widget_set_size_request(drawing
->drawing_area
,
1094 gtk_widget_queue_draw(drawing
->drawing_area
);
1098 /* Now, the process is in the state hash and our own process hash.
1099 * We definitely can draw the items related to the ending state.
1102 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1105 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1106 TimeWindow time_window
=
1107 lttvwindow_get_time_window(control_flow_data
->tab
);
1110 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1111 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1113 #endif //EXTRA_CHECK
1114 Drawing_t
*drawing
= control_flow_data
->drawing
;
1115 guint width
= drawing
->width
;
1117 convert_time_to_pixels(
1123 /* Draw collision indicator */
1124 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1125 gdk_draw_point(hashed_process_data
->pixmap
,
1128 (hashed_process_data
->height
/2)-3);
1129 hashed_process_data
->x
.middle_marked
= TRUE
;
1132 TimeWindow time_window
=
1133 lttvwindow_get_time_window(control_flow_data
->tab
);
1136 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1137 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1139 #endif //EXTRA_CHECK
1140 Drawing_t
*drawing
= control_flow_data
->drawing
;
1141 guint width
= drawing
->width
;
1144 convert_time_to_pixels(
1151 /* Jump over draw if we are at the same x position */
1152 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1153 hashed_process_data
->x
.middle_used
))
1155 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1156 /* Draw collision indicator */
1157 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1158 gdk_draw_point(hashed_process_data
->pixmap
,
1161 (hashed_process_data
->height
/2)-3);
1162 hashed_process_data
->x
.middle_marked
= TRUE
;
1166 DrawContext draw_context
;
1168 /* Now create the drawing context that will be used to draw
1169 * items related to the last state. */
1170 draw_context
.drawable
= hashed_process_data
->pixmap
;
1171 draw_context
.gc
= drawing
->gc
;
1172 draw_context
.pango_layout
= drawing
->pango_layout
;
1173 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1174 draw_context
.drawinfo
.end
.x
= x
;
1176 draw_context
.drawinfo
.y
.over
= 1;
1177 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1178 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1180 draw_context
.drawinfo
.start
.offset
.over
= 0;
1181 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1182 draw_context
.drawinfo
.start
.offset
.under
= 0;
1183 draw_context
.drawinfo
.end
.offset
.over
= 0;
1184 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1185 draw_context
.drawinfo
.end
.offset
.under
= 0;
1189 PropertiesLine prop_line
= prepare_s_e_line(process
);
1190 draw_line((void*)&prop_line
, (void*)&draw_context
);
1193 /* become the last x position */
1194 hashed_process_data
->x
.middle
= x
;
1195 hashed_process_data
->x
.middle_used
= TRUE
;
1196 hashed_process_data
->x
.middle_marked
= FALSE
;
1198 /* Calculate the next good time */
1199 convert_pixels_to_time(width
, x
+1, time_window
,
1200 &hashed_process_data
->next_good_time
);
1210 /* before_process_release_hook
1212 * Draw lines for process event.
1214 * @param hook_data ControlFlowData structure of the viewer.
1215 * @param call_data Event context.
1217 * This function adds items to be drawn in a queue for each process.
1222 int before_process_release_hook(void *hook_data
, void *call_data
)
1224 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1225 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1227 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1229 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1231 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1233 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1236 e
= ltt_tracefile_get_event(tfc
->tf
);
1238 LttTime evtime
= ltt_event_time(e
);
1243 pid
= ltt_event_get_long_unsigned(e
, thf
->f1
);
1246 /* Add process to process list (if not present) */
1247 /* Don't care about the process if it's not in the state hash already :
1248 * that means a process that has never done anything in the trace and
1249 * unknown suddently gets destroyed : no state meaningful to show. */
1250 LttvProcessState
*process
= lttv_state_find_process(ts
, ANY_CPU
, pid
);
1252 if(process
!= NULL
) {
1254 guint pl_height
= 0;
1255 HashedProcessData
*hashed_process_data
= NULL
;
1257 ProcessList
*process_list
= control_flow_data
->process_list
;
1259 birth
= process
->creation_time
;
1261 /* Cannot use current process : this event happens on another process,
1262 * action done by the parent. */
1263 hashed_process_data
= processlist_get_process_data(process_list
,
1267 tfc
->t_context
->index
);
1268 if(unlikely(hashed_process_data
== NULL
))
1270 g_assert(pid
== 0 || pid
!= process
->ppid
);
1271 /* Process not present */
1272 Drawing_t
*drawing
= control_flow_data
->drawing
;
1273 ProcessInfo
*process_info
;
1274 processlist_add(process_list
,
1280 tfc
->t_context
->index
,
1284 &hashed_process_data
);
1285 gtk_widget_set_size_request(drawing
->drawing_area
,
1288 gtk_widget_queue_draw(drawing
->drawing_area
);
1291 /* Now, the process is in the state hash and our own process hash.
1292 * We definitely can draw the items related to the ending state.
1295 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1298 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1299 TimeWindow time_window
=
1300 lttvwindow_get_time_window(control_flow_data
->tab
);
1303 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1304 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1306 #endif //EXTRA_CHECK
1307 Drawing_t
*drawing
= control_flow_data
->drawing
;
1308 guint width
= drawing
->width
;
1310 convert_time_to_pixels(
1316 /* Draw collision indicator */
1317 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1318 gdk_draw_point(hashed_process_data
->pixmap
,
1321 (hashed_process_data
->height
/2)-3);
1322 hashed_process_data
->x
.middle_marked
= TRUE
;
1325 TimeWindow time_window
=
1326 lttvwindow_get_time_window(control_flow_data
->tab
);
1329 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1330 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1332 #endif //EXTRA_CHECK
1333 Drawing_t
*drawing
= control_flow_data
->drawing
;
1334 guint width
= drawing
->width
;
1337 convert_time_to_pixels(
1344 /* Jump over draw if we are at the same x position */
1345 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1346 hashed_process_data
->x
.middle_used
))
1348 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1349 /* Draw collision indicator */
1350 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1351 gdk_draw_point(hashed_process_data
->pixmap
,
1354 (hashed_process_data
->height
/2)-3);
1355 hashed_process_data
->x
.middle_marked
= TRUE
;
1359 DrawContext draw_context
;
1361 /* Now create the drawing context that will be used to draw
1362 * items related to the last state. */
1363 draw_context
.drawable
= hashed_process_data
->pixmap
;
1364 draw_context
.gc
= drawing
->gc
;
1365 draw_context
.pango_layout
= drawing
->pango_layout
;
1366 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1367 draw_context
.drawinfo
.end
.x
= x
;
1369 draw_context
.drawinfo
.y
.over
= 1;
1370 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1371 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1373 draw_context
.drawinfo
.start
.offset
.over
= 0;
1374 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1375 draw_context
.drawinfo
.start
.offset
.under
= 0;
1376 draw_context
.drawinfo
.end
.offset
.over
= 0;
1377 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1378 draw_context
.drawinfo
.end
.offset
.under
= 0;
1382 PropertiesLine prop_line
= prepare_s_e_line(process
);
1383 draw_line((void*)&prop_line
, (void*)&draw_context
);
1386 /* become the last x position */
1387 hashed_process_data
->x
.middle
= x
;
1388 hashed_process_data
->x
.middle_used
= TRUE
;
1389 hashed_process_data
->x
.middle_marked
= FALSE
;
1391 /* Calculate the next good time */
1392 convert_pixels_to_time(width
, x
+1, time_window
,
1393 &hashed_process_data
->next_good_time
);
1405 /* after_process_fork_hook
1407 * Create the processlist entry for the child process. Put the last
1408 * position in x at the current time value.
1410 * @param hook_data ControlFlowData structure of the viewer.
1411 * @param call_data Event context.
1413 * This function adds items to be drawn in a queue for each process.
1416 int after_process_fork_hook(void *hook_data
, void *call_data
)
1418 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1419 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1420 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1422 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1424 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1426 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1429 e
= ltt_tracefile_get_event(tfc
->tf
);
1431 LttTime evtime
= ltt_event_time(e
);
1435 child_pid
= ltt_event_get_long_unsigned(e
, thf
->f2
);
1438 /* Add process to process list (if not present) */
1439 LttvProcessState
*process_child
;
1441 guint pl_height
= 0;
1442 HashedProcessData
*hashed_process_data_child
= NULL
;
1444 ProcessList
*process_list
= control_flow_data
->process_list
;
1446 /* Find child in the list... */
1447 process_child
= lttv_state_find_process(ts
, ANY_CPU
, child_pid
);
1448 /* It should exist, because we are after the state update. */
1449 g_assert(process_child
!= NULL
);
1451 birth
= process_child
->creation_time
;
1453 /* Cannot use current process, because this action is done by the parent
1455 hashed_process_data_child
= processlist_get_process_data(process_list
,
1459 tfc
->t_context
->index
);
1460 if(likely(hashed_process_data_child
== NULL
))
1462 g_assert(child_pid
== 0 || child_pid
!= process_child
->ppid
);
1463 /* Process not present */
1464 Drawing_t
*drawing
= control_flow_data
->drawing
;
1465 ProcessInfo
*process_info
;
1466 processlist_add(process_list
,
1470 process_child
->ppid
,
1472 tfc
->t_context
->index
,
1473 process_child
->name
,
1476 &hashed_process_data_child
);
1477 gtk_widget_set_size_request(drawing
->drawing_area
,
1480 gtk_widget_queue_draw(drawing
->drawing_area
);
1484 if(likely(ltt_time_compare(hashed_process_data_child
->next_good_time
,
1487 TimeWindow time_window
=
1488 lttvwindow_get_time_window(control_flow_data
->tab
);
1491 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1492 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1494 #endif //EXTRA_CHECK
1495 Drawing_t
*drawing
= control_flow_data
->drawing
;
1496 guint width
= drawing
->width
;
1498 convert_time_to_pixels(
1504 if(likely(hashed_process_data_child
->x
.over
!= new_x
)) {
1505 hashed_process_data_child
->x
.over
= new_x
;
1506 hashed_process_data_child
->x
.over_used
= FALSE
;
1507 hashed_process_data_child
->x
.over_marked
= FALSE
;
1509 if(likely(hashed_process_data_child
->x
.middle
!= new_x
)) {
1510 hashed_process_data_child
->x
.middle
= new_x
;
1511 hashed_process_data_child
->x
.middle_used
= FALSE
;
1512 hashed_process_data_child
->x
.middle_marked
= FALSE
;
1514 if(likely(hashed_process_data_child
->x
.under
!= new_x
)) {
1515 hashed_process_data_child
->x
.under
= new_x
;
1516 hashed_process_data_child
->x
.under_used
= FALSE
;
1517 hashed_process_data_child
->x
.under_marked
= FALSE
;
1525 /* after_process_exit_hook
1527 * Create the processlist entry for the child process. Put the last
1528 * position in x at the current time value.
1530 * @param hook_data ControlFlowData structure of the viewer.
1531 * @param call_data Event context.
1533 * This function adds items to be drawn in a queue for each process.
1536 int after_process_exit_hook(void *hook_data
, void *call_data
)
1538 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1539 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1540 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1542 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1544 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1546 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1549 e
= ltt_tracefile_get_event(tfc
->tf
);
1551 LttTime evtime
= ltt_event_time(e
);
1553 /* Add process to process list (if not present) */
1554 //LttvProcessState *process = tfs->process;
1555 guint cpu
= ltt_tracefile_num(tfc
->tf
);
1556 LttvProcessState
*process
= ts
->running_process
[cpu
];
1558 /* It should exist, because we are after the state update. */
1559 g_assert(process
!= NULL
);
1561 guint pid
= process
->pid
;
1563 guint pl_height
= 0;
1564 HashedProcessData
*hashed_process_data
= NULL
;
1566 ProcessList
*process_list
= control_flow_data
->process_list
;
1568 birth
= process
->creation_time
;
1570 if(likely(process_list
->current_hash_data
[cpu
] != NULL
) ){
1571 hashed_process_data
= process_list
->current_hash_data
[cpu
];
1573 hashed_process_data
= processlist_get_process_data(process_list
,
1577 tfc
->t_context
->index
);
1578 if(unlikely(hashed_process_data
== NULL
))
1580 g_assert(pid
== 0 || pid
!= process
->ppid
);
1581 /* Process not present */
1582 Drawing_t
*drawing
= control_flow_data
->drawing
;
1583 ProcessInfo
*process_info
;
1584 processlist_add(process_list
,
1590 tfc
->t_context
->index
,
1594 &hashed_process_data
);
1595 gtk_widget_set_size_request(drawing
->drawing_area
,
1598 gtk_widget_queue_draw(drawing
->drawing_area
);
1601 /* Set the current process */
1602 process_list
->current_hash_data
[process
->cpu
] =
1603 hashed_process_data
;
1606 if(unlikely(ltt_time_compare(hashed_process_data
->next_good_time
,
1609 TimeWindow time_window
=
1610 lttvwindow_get_time_window(control_flow_data
->tab
);
1613 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1614 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1616 #endif //EXTRA_CHECK
1617 Drawing_t
*drawing
= control_flow_data
->drawing
;
1618 guint width
= drawing
->width
;
1620 convert_time_to_pixels(
1625 if(unlikely(hashed_process_data
->x
.middle
!= new_x
)) {
1626 hashed_process_data
->x
.middle
= new_x
;
1627 hashed_process_data
->x
.middle_used
= FALSE
;
1628 hashed_process_data
->x
.middle_marked
= FALSE
;
1636 /* Get the filename of the process to print */
1637 int after_fs_exec_hook(void *hook_data
, void *call_data
)
1639 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1640 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1641 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1643 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1645 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1647 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1649 guint cpu
= ltt_tracefile_num(tfc
->tf
);
1650 LttvProcessState
*process
= ts
->running_process
[cpu
];
1651 g_assert(process
!= NULL
);
1653 guint pid
= process
->pid
;
1655 /* Well, the process_out existed : we must get it in the process hash
1656 * or add it, and draw its items.
1658 /* Add process to process list (if not present) */
1659 guint pl_height
= 0;
1660 HashedProcessData
*hashed_process_data
= NULL
;
1661 ProcessList
*process_list
= control_flow_data
->process_list
;
1662 LttTime birth
= process
->creation_time
;
1664 if(likely(process_list
->current_hash_data
[cpu
] != NULL
)) {
1665 hashed_process_data
= process_list
->current_hash_data
[cpu
];
1667 hashed_process_data
= processlist_get_process_data(process_list
,
1671 tfc
->t_context
->index
);
1672 if(unlikely(hashed_process_data
== NULL
))
1674 g_assert(pid
== 0 || pid
!= process
->ppid
);
1675 ProcessInfo
*process_info
;
1676 /* Process not present */
1677 Drawing_t
*drawing
= control_flow_data
->drawing
;
1678 processlist_add(process_list
,
1684 tfc
->t_context
->index
,
1688 &hashed_process_data
);
1689 gtk_widget_set_size_request(drawing
->drawing_area
,
1692 gtk_widget_queue_draw(drawing
->drawing_area
);
1694 /* Set the current process */
1695 process_list
->current_hash_data
[process
->cpu
] =
1696 hashed_process_data
;
1699 processlist_set_name(process_list
, process
->name
, hashed_process_data
);
1708 gint
update_time_window_hook(void *hook_data
, void *call_data
)
1710 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1711 Drawing_t
*drawing
= control_flow_data
->drawing
;
1712 ProcessList
*process_list
= control_flow_data
->process_list
;
1714 const TimeWindowNotifyData
*time_window_nofify_data
=
1715 ((const TimeWindowNotifyData
*)call_data
);
1717 TimeWindow
*old_time_window
=
1718 time_window_nofify_data
->old_time_window
;
1719 TimeWindow
*new_time_window
=
1720 time_window_nofify_data
->new_time_window
;
1722 /* Update the ruler */
1723 drawing_update_ruler(control_flow_data
->drawing
,
1727 /* Two cases : zoom in/out or scrolling */
1729 /* In order to make sure we can reuse the old drawing, the scale must
1730 * be the same and the new time interval being partly located in the
1731 * currently shown time interval. (reuse is only for scrolling)
1734 g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
1735 old_time_window
->start_time
.tv_sec
,
1736 old_time_window
->start_time
.tv_nsec
,
1737 old_time_window
->time_width
.tv_sec
,
1738 old_time_window
->time_width
.tv_nsec
);
1740 g_info("New time window HOOK : %lu, %lu to %lu, %lu",
1741 new_time_window
->start_time
.tv_sec
,
1742 new_time_window
->start_time
.tv_nsec
,
1743 new_time_window
->time_width
.tv_sec
,
1744 new_time_window
->time_width
.tv_nsec
);
1746 if( new_time_window
->time_width
.tv_sec
== old_time_window
->time_width
.tv_sec
1747 && new_time_window
->time_width
.tv_nsec
== old_time_window
->time_width
.tv_nsec
)
1749 /* Same scale (scrolling) */
1750 g_info("scrolling");
1751 LttTime
*ns
= &new_time_window
->start_time
;
1752 LttTime
*nw
= &new_time_window
->time_width
;
1753 LttTime
*os
= &old_time_window
->start_time
;
1754 LttTime
*ow
= &old_time_window
->time_width
;
1755 LttTime old_end
= old_time_window
->end_time
;
1756 LttTime new_end
= new_time_window
->end_time
;
1758 //if(ns<os+w && os+w<ns+w)
1759 //if(ns<old_end && os<ns)
1760 if(ltt_time_compare(*ns
, old_end
) == -1
1761 && ltt_time_compare(*os
, *ns
) == -1)
1763 g_info("scrolling near right");
1764 /* Scroll right, keep right part of the screen */
1766 guint width
= control_flow_data
->drawing
->width
;
1767 convert_time_to_pixels(
1773 /* Copy old data to new location */
1774 copy_pixmap_region(process_list
,
1776 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1780 control_flow_data
->drawing
->width
-x
+SAFETY
, -1);
1782 if(drawing
->damage_begin
== drawing
->damage_end
)
1783 drawing
->damage_begin
= control_flow_data
->drawing
->width
-x
;
1785 drawing
->damage_begin
= 0;
1787 drawing
->damage_end
= control_flow_data
->drawing
->width
;
1789 /* Clear the data request background, but not SAFETY */
1790 rectangle_pixmap(process_list
,
1791 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1793 drawing
->damage_begin
+SAFETY
, 0,
1794 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1796 gtk_widget_queue_draw(drawing
->drawing_area
);
1797 //gtk_widget_queue_draw_area (drawing->drawing_area,
1799 // control_flow_data->drawing->width,
1800 // control_flow_data->drawing->height);
1802 /* Get new data for the rest. */
1803 drawing_data_request(control_flow_data
->drawing
,
1804 drawing
->damage_begin
, 0,
1805 drawing
->damage_end
- drawing
->damage_begin
,
1806 control_flow_data
->drawing
->height
);
1809 //if(ns<os && os<ns+w)
1810 //if(ns<os && os<new_end)
1811 if(ltt_time_compare(*ns
,*os
) == -1
1812 && ltt_time_compare(*os
,new_end
) == -1)
1814 g_info("scrolling near left");
1815 /* Scroll left, keep left part of the screen */
1817 guint width
= control_flow_data
->drawing
->width
;
1818 convert_time_to_pixels(
1824 /* Copy old data to new location */
1825 copy_pixmap_region (process_list
,
1827 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1833 if(drawing
->damage_begin
== drawing
->damage_end
)
1834 drawing
->damage_end
= x
;
1836 drawing
->damage_end
=
1837 control_flow_data
->drawing
->width
;
1839 drawing
->damage_begin
= 0;
1841 rectangle_pixmap (process_list
,
1842 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1844 drawing
->damage_begin
, 0,
1845 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1848 gtk_widget_queue_draw(drawing
->drawing_area
);
1849 //gtk_widget_queue_draw_area (drawing->drawing_area,
1851 // control_flow_data->drawing->width,
1852 // control_flow_data->drawing->height);
1855 /* Get new data for the rest. */
1856 drawing_data_request(control_flow_data
->drawing
,
1857 drawing
->damage_begin
, 0,
1858 drawing
->damage_end
- drawing
->damage_begin
,
1859 control_flow_data
->drawing
->height
);
1862 if(ltt_time_compare(*ns
,*os
) == 0)
1864 g_info("not scrolling");
1866 g_info("scrolling far");
1867 /* Cannot reuse any part of the screen : far jump */
1870 rectangle_pixmap (process_list
,
1871 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1874 control_flow_data
->drawing
->width
+SAFETY
, // do not overlap
1877 //gtk_widget_queue_draw_area (drawing->drawing_area,
1879 // control_flow_data->drawing->width,
1880 // control_flow_data->drawing->height);
1881 gtk_widget_queue_draw(drawing
->drawing_area
);
1883 drawing
->damage_begin
= 0;
1884 drawing
->damage_end
= control_flow_data
->drawing
->width
;
1886 drawing_data_request(control_flow_data
->drawing
,
1888 control_flow_data
->drawing
->width
,
1889 control_flow_data
->drawing
->height
);
1895 /* Different scale (zoom) */
1898 rectangle_pixmap (process_list
,
1899 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1902 control_flow_data
->drawing
->width
+SAFETY
, // do not overlap
1905 //gtk_widget_queue_draw_area (drawing->drawing_area,
1907 // control_flow_data->drawing->width,
1908 // control_flow_data->drawing->height);
1909 gtk_widget_queue_draw(drawing
->drawing_area
);
1911 drawing
->damage_begin
= 0;
1912 drawing
->damage_end
= control_flow_data
->drawing
->width
;
1914 drawing_data_request(control_flow_data
->drawing
,
1916 control_flow_data
->drawing
->width
,
1917 control_flow_data
->drawing
->height
);
1920 /* Update directly when scrolling */
1921 gdk_window_process_updates(control_flow_data
->drawing
->drawing_area
->window
,
1927 gint
traceset_notify(void *hook_data
, void *call_data
)
1929 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1930 Drawing_t
*drawing
= control_flow_data
->drawing
;
1932 if(unlikely(drawing
->gc
== NULL
)) {
1935 if(drawing
->dotted_gc
== NULL
) {
1939 drawing_clear(control_flow_data
->drawing
);
1940 processlist_clear(control_flow_data
->process_list
);
1941 gtk_widget_set_size_request(
1942 control_flow_data
->drawing
->drawing_area
,
1943 -1, processlist_get_height(control_flow_data
->process_list
));
1944 redraw_notify(control_flow_data
, NULL
);
1946 request_background_data(control_flow_data
);
1951 gint
redraw_notify(void *hook_data
, void *call_data
)
1953 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1954 Drawing_t
*drawing
= control_flow_data
->drawing
;
1955 GtkWidget
*widget
= drawing
->drawing_area
;
1957 drawing
->damage_begin
= 0;
1958 drawing
->damage_end
= drawing
->width
;
1960 /* fun feature, to be separated someday... */
1961 drawing_clear(control_flow_data
->drawing
);
1962 processlist_clear(control_flow_data
->process_list
);
1963 gtk_widget_set_size_request(
1964 control_flow_data
->drawing
->drawing_area
,
1965 -1, processlist_get_height(control_flow_data
->process_list
));
1967 rectangle_pixmap (control_flow_data
->process_list
,
1968 widget
->style
->black_gc
,
1971 drawing
->alloc_width
,
1974 gtk_widget_queue_draw(drawing
->drawing_area
);
1976 if(drawing
->damage_begin
< drawing
->damage_end
)
1978 drawing_data_request(drawing
,
1979 drawing
->damage_begin
,
1981 drawing
->damage_end
-drawing
->damage_begin
,
1985 //gtk_widget_queue_draw_area(drawing->drawing_area,
1988 // drawing->height);
1994 gint
continue_notify(void *hook_data
, void *call_data
)
1996 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1997 Drawing_t
*drawing
= control_flow_data
->drawing
;
1999 //g_assert(widget->allocation.width == drawing->damage_end);
2001 if(drawing
->damage_begin
< drawing
->damage_end
)
2003 drawing_data_request(drawing
,
2004 drawing
->damage_begin
,
2006 drawing
->damage_end
-drawing
->damage_begin
,
2014 gint
update_current_time_hook(void *hook_data
, void *call_data
)
2016 ControlFlowData
*control_flow_data
= (ControlFlowData
*)hook_data
;
2017 Drawing_t
*drawing
= control_flow_data
->drawing
;
2019 LttTime current_time
= *((LttTime
*)call_data
);
2021 TimeWindow time_window
=
2022 lttvwindow_get_time_window(control_flow_data
->tab
);
2024 LttTime time_begin
= time_window
.start_time
;
2025 LttTime width
= time_window
.time_width
;
2028 guint64 time_ll
= ltt_time_to_uint64(width
);
2029 time_ll
= time_ll
>> 1; /* divide by two */
2030 half_width
= ltt_time_from_uint64(time_ll
);
2032 LttTime time_end
= ltt_time_add(time_begin
, width
);
2034 LttvTracesetContext
* tsc
=
2035 lttvwindow_get_traceset_context(control_flow_data
->tab
);
2037 LttTime trace_start
= tsc
->time_span
.start_time
;
2038 LttTime trace_end
= tsc
->time_span
.end_time
;
2040 g_info("New current time HOOK : %lu, %lu", current_time
.tv_sec
,
2041 current_time
.tv_nsec
);
2045 /* If current time is inside time interval, just move the highlight
2048 /* Else, we have to change the time interval. We have to tell it
2049 * to the main window. */
2050 /* The time interval change will take care of placing the current
2051 * time at the center of the visible area, or nearest possible if we are
2052 * at one end of the trace. */
2055 if(ltt_time_compare(current_time
, time_begin
) < 0)
2057 TimeWindow new_time_window
;
2059 if(ltt_time_compare(current_time
,
2060 ltt_time_add(trace_start
,half_width
)) < 0)
2061 time_begin
= trace_start
;
2063 time_begin
= ltt_time_sub(current_time
,half_width
);
2065 new_time_window
.start_time
= time_begin
;
2066 new_time_window
.time_width
= width
;
2067 new_time_window
.time_width_double
= ltt_time_to_double(width
);
2068 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
2070 lttvwindow_report_time_window(control_flow_data
->tab
, new_time_window
);
2072 else if(ltt_time_compare(current_time
, time_end
) > 0)
2074 TimeWindow new_time_window
;
2076 if(ltt_time_compare(current_time
, ltt_time_sub(trace_end
, half_width
)) > 0)
2077 time_begin
= ltt_time_sub(trace_end
,width
);
2079 time_begin
= ltt_time_sub(current_time
,half_width
);
2081 new_time_window
.start_time
= time_begin
;
2082 new_time_window
.time_width
= width
;
2083 new_time_window
.time_width_double
= ltt_time_to_double(width
);
2084 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
2086 lttvwindow_report_time_window(control_flow_data
->tab
, new_time_window
);
2089 gtk_widget_queue_draw(control_flow_data
->drawing
->drawing_area
);
2091 /* Update directly when scrolling */
2092 gdk_window_process_updates(control_flow_data
->drawing
->drawing_area
->window
,
2098 typedef struct _ClosureData
{
2099 EventsRequest
*events_request
;
2100 LttvTracesetState
*tss
;
2106 void draw_closure(gpointer key
, gpointer value
, gpointer user_data
)
2108 ProcessInfo
*process_info
= (ProcessInfo
*)key
;
2109 HashedProcessData
*hashed_process_data
= (HashedProcessData
*)value
;
2110 ClosureData
*closure_data
= (ClosureData
*)user_data
;
2112 EventsRequest
*events_request
= closure_data
->events_request
;
2113 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
2115 LttvTracesetState
*tss
= closure_data
->tss
;
2116 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)tss
;
2118 LttTime evtime
= closure_data
->end_time
;
2121 /* For the process */
2122 /* First, check if the current process is in the state computation
2123 * process list. If it is there, that means we must add it right now and
2124 * draw items from the beginning of the read for it. If it is not
2125 * present, it's a new process and it was not present : it will
2126 * be added after the state update. */
2128 g_assert(lttv_traceset_number(tsc
->ts
) > 0);
2129 #endif //EXTRA_CHECK
2130 LttvTraceContext
*tc
= tsc
->traces
[process_info
->trace_num
];
2131 LttvTraceState
*ts
= (LttvTraceState
*)tc
;
2134 //FIXME : optimize data structures.
2135 LttvTracefileState
*tfs
;
2136 LttvTracefileContext
*tfc
;
2138 for(i
=0;i
<tc
->tracefiles
->len
;i
++) {
2139 tfc
= g_array_index(tc
->tracefiles
, LttvTracefileContext
*, i
);
2140 if(ltt_tracefile_name(tfc
->tf
) == LTT_NAME_CPU
2141 && ltt_tracefile_num(tfc
->tf
) == process_info
->cpu
)
2145 g_assert(i
<tc
->tracefiles
->len
);
2146 tfs
= LTTV_TRACEFILE_STATE(tfc
);
2148 // LttvTracefileState *tfs =
2149 // (LttvTracefileState*)tsc->traces[process_info->trace_num]->
2150 // tracefiles[process_info->cpu];
2152 LttvProcessState
*process
;
2153 process
= lttv_state_find_process(ts
, process_info
->cpu
,
2156 if(unlikely(process
!= NULL
)) {
2158 /* Only draw for processes that are currently in the trace states */
2160 ProcessList
*process_list
= control_flow_data
->process_list
;
2162 /* Should be alike when background info is ready */
2163 if(control_flow_data
->background_info_waiting
==0)
2164 g_assert(ltt_time_compare(process
->creation_time
,
2165 process_info
->birth
) == 0);
2166 #endif //EXTRA_CHECK
2168 /* Now, the process is in the state hash and our own process hash.
2169 * We definitely can draw the items related to the ending state.
2172 if(unlikely(ltt_time_compare(hashed_process_data
->next_good_time
,
2175 TimeWindow time_window
=
2176 lttvwindow_get_time_window(control_flow_data
->tab
);
2179 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
2180 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
2182 #endif //EXTRA_CHECK
2183 Drawing_t
*drawing
= control_flow_data
->drawing
;
2184 guint width
= drawing
->width
;
2186 guint x
= closure_data
->x_end
;
2188 DrawContext draw_context
;
2190 /* Now create the drawing context that will be used to draw
2191 * items related to the last state. */
2192 draw_context
.drawable
= hashed_process_data
->pixmap
;
2193 draw_context
.gc
= drawing
->gc
;
2194 draw_context
.pango_layout
= drawing
->pango_layout
;
2195 draw_context
.drawinfo
.end
.x
= x
;
2197 draw_context
.drawinfo
.y
.over
= 1;
2198 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
2199 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
2201 draw_context
.drawinfo
.start
.offset
.over
= 0;
2202 draw_context
.drawinfo
.start
.offset
.middle
= 0;
2203 draw_context
.drawinfo
.start
.offset
.under
= 0;
2204 draw_context
.drawinfo
.end
.offset
.over
= 0;
2205 draw_context
.drawinfo
.end
.offset
.middle
= 0;
2206 draw_context
.drawinfo
.end
.offset
.under
= 0;
2208 /* Jump over draw if we are at the same x position */
2209 if(x
== hashed_process_data
->x
.over
)
2213 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.over
;
2215 PropertiesLine prop_line
= prepare_execmode_line(process
);
2216 draw_line((void*)&prop_line
, (void*)&draw_context
);
2218 hashed_process_data
->x
.over
= x
;
2222 if(unlikely(x
== hashed_process_data
->x
.middle
&&
2223 hashed_process_data
->x
.middle_used
)) {
2224 #if 0 /* do not mark closure : not missing information */
2225 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
2226 /* Draw collision indicator */
2227 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
2228 gdk_draw_point(drawing
->pixmap
,
2232 hashed_process_data
->x
.middle_marked
= TRUE
;
2237 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
2239 PropertiesLine prop_line
= prepare_s_e_line(process
);
2240 draw_line((void*)&prop_line
, (void*)&draw_context
);
2242 /* become the last x position */
2243 if(likely(x
!= hashed_process_data
->x
.middle
)) {
2244 hashed_process_data
->x
.middle
= x
;
2245 /* but don't use the pixel */
2246 hashed_process_data
->x
.middle_used
= FALSE
;
2248 /* Calculate the next good time */
2249 convert_pixels_to_time(width
, x
+1, time_window
,
2250 &hashed_process_data
->next_good_time
);
2259 int before_chunk(void *hook_data
, void *call_data
)
2261 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2262 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2263 ControlFlowData
*cfd
= (ControlFlowData
*)events_request
->viewer_data
;
2265 /* Desactivate sort */
2266 gtk_tree_sortable_set_sort_column_id(
2267 GTK_TREE_SORTABLE(cfd
->process_list
->list_store
),
2269 GTK_SORT_ASCENDING
);
2271 drawing_chunk_begin(events_request
, tss
);
2276 int before_request(void *hook_data
, void *call_data
)
2278 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2279 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2281 drawing_data_request_begin(events_request
, tss
);
2288 * after request is necessary in addition of after chunk in order to draw
2289 * lines until the end of the screen. after chunk just draws lines until
2296 int after_request(void *hook_data
, void *call_data
)
2298 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2299 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
2300 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2302 ProcessList
*process_list
= control_flow_data
->process_list
;
2303 LttTime end_time
= events_request
->end_time
;
2305 ClosureData closure_data
;
2306 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2307 closure_data
.tss
= tss
;
2308 closure_data
.end_time
= end_time
;
2310 TimeWindow time_window
=
2311 lttvwindow_get_time_window(control_flow_data
->tab
);
2312 guint width
= control_flow_data
->drawing
->width
;
2313 convert_time_to_pixels(
2317 &closure_data
.x_end
);
2320 /* Draw last items */
2321 g_hash_table_foreach(process_list
->process_hash
, draw_closure
,
2322 (void*)&closure_data
);
2325 /* Request expose */
2326 drawing_request_expose(events_request
, tss
, end_time
);
2335 int after_chunk(void *hook_data
, void *call_data
)
2337 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2338 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
2339 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2340 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)call_data
;
2341 LttvTracefileContext
*tfc
= lttv_traceset_context_get_current_tfc(tsc
);
2344 ProcessList
*process_list
= control_flow_data
->process_list
;
2346 g_free(process_list
->current_hash_data
);
2347 process_list
->current_hash_data
= NULL
;
2350 end_time
= LTT_TIME_MIN(tfc
->timestamp
, events_request
->end_time
);
2351 else /* end of traceset, or position now out of request : end */
2352 end_time
= events_request
->end_time
;
2354 ClosureData closure_data
;
2355 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2356 closure_data
.tss
= tss
;
2357 closure_data
.end_time
= end_time
;
2359 TimeWindow time_window
=
2360 lttvwindow_get_time_window(control_flow_data
->tab
);
2361 guint width
= control_flow_data
->drawing
->width
;
2362 convert_time_to_pixels(
2366 &closure_data
.x_end
);
2368 /* Draw last items */
2369 g_hash_table_foreach(process_list
->process_hash
, draw_closure
,
2370 (void*)&closure_data
);
2372 /* Reactivate sort */
2373 gtk_tree_sortable_set_sort_column_id(
2374 GTK_TREE_SORTABLE(control_flow_data
->process_list
->list_store
),
2375 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2376 GTK_SORT_ASCENDING
);
2378 update_index_to_pixmap(control_flow_data
->process_list
);
2379 /* Request a full expose : drawing scrambled */
2380 gtk_widget_queue_draw(control_flow_data
->drawing
->drawing_area
);
2382 /* Request expose (updates damages zone also) */
2383 drawing_request_expose(events_request
, tss
, end_time
);