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_MODE_UNKNOWN
)
283 prop_line
.color
= drawing_colors
[COL_MODE_UNKNOWN
];
285 g_assert(FALSE
); /* RUNNING MODE UNKNOWN */
286 } else if(process
->state
->s
== LTTV_STATE_WAIT
) {
287 /* We don't show if we wait while in user mode, trap, irq or syscall */
288 prop_line
.color
= drawing_colors
[COL_WAIT
];
289 } else if(process
->state
->s
== LTTV_STATE_WAIT_CPU
) {
290 /* We don't show if we wait for CPU while in user mode, trap, irq
292 prop_line
.color
= drawing_colors
[COL_WAIT_CPU
];
293 } else if(process
->state
->s
== LTTV_STATE_ZOMBIE
) {
294 prop_line
.color
= drawing_colors
[COL_ZOMBIE
];
295 } else if(process
->state
->s
== LTTV_STATE_WAIT_FORK
) {
296 prop_line
.color
= drawing_colors
[COL_WAIT_FORK
];
297 } else if(process
->state
->s
== LTTV_STATE_EXIT
) {
298 prop_line
.color
= drawing_colors
[COL_EXIT
];
299 } else if(process
->state
->s
== LTTV_STATE_UNNAMED
) {
300 prop_line
.color
= drawing_colors
[COL_UNNAMED
];
302 g_assert(FALSE
); /* UNKNOWN STATE */
309 /* before_schedchange_hook
311 * This function basically draw lines and icons. Two types of lines are drawn :
312 * one small (3 pixels?) representing the state of the process and the second
313 * type is thicker (10 pixels?) representing on which CPU a process is running
314 * (and this only in running state).
316 * Extremums of the lines :
317 * x_min : time of the last event context for this process kept in memory.
318 * x_max : time of the current event.
319 * y : middle of the process in the process list. The process is found in the
320 * list, therefore is it's position in pixels.
322 * The choice of lines'color is defined by the context of the last event for this
327 int before_schedchange_hook(void *hook_data
, void *call_data
)
329 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
330 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
331 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
333 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
335 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
336 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
339 e
= ltt_tracefile_get_event(tfc
->tf
);
341 LttTime evtime
= ltt_event_time(e
);
343 /* we are in a schedchange, before the state update. We must draw the
344 * items corresponding to the state before it changes : now is the right
351 pid_out
= ltt_event_get_long_unsigned(e
, thf
->f1
);
352 pid_in
= ltt_event_get_long_unsigned(e
, thf
->f2
);
356 /* For the pid_out */
357 /* First, check if the current process is in the state computation
358 * process list. If it is there, that means we must add it right now and
359 * draw items from the beginning of the read for it. If it is not
360 * present, it's a new process and it was not present : it will
361 * be added after the state update. */
362 guint cpu
= ltt_tracefile_num(tfc
->tf
);
363 LttvProcessState
*process
= ts
->running_process
[cpu
];
364 /* unknown state, bad current pid */
365 if(process
->pid
!= pid_out
)
366 process
= lttv_state_find_process(ts
,
367 ltt_tracefile_num(tfc
->tf
), pid_out
);
369 if(process
!= NULL
) {
370 /* Well, the process_out existed : we must get it in the process hash
371 * or add it, and draw its items.
373 /* Add process to process list (if not present) */
375 HashedProcessData
*hashed_process_data
= NULL
;
376 ProcessList
*process_list
= control_flow_data
->process_list
;
377 LttTime birth
= process
->creation_time
;
379 hashed_process_data
= processlist_get_process_data(process_list
,
383 tfc
->t_context
->index
);
384 if(hashed_process_data
== NULL
)
386 g_assert(pid_out
== 0 || pid_out
!= process
->ppid
);
387 /* Process not present */
388 ProcessInfo
*process_info
;
389 Drawing_t
*drawing
= control_flow_data
->drawing
;
390 processlist_add(process_list
,
396 tfc
->t_context
->index
,
400 &hashed_process_data
);
401 gtk_widget_set_size_request(drawing
->drawing_area
,
404 gtk_widget_queue_draw(drawing
->drawing_area
);
408 /* Now, the process is in the state hash and our own process hash.
409 * We definitely can draw the items related to the ending state.
412 if(ltt_time_compare(hashed_process_data
->next_good_time
,
415 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
417 TimeWindow time_window
=
418 lttvwindow_get_time_window(control_flow_data
->tab
);
420 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
421 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
424 Drawing_t
*drawing
= control_flow_data
->drawing
;
425 guint width
= drawing
->width
;
427 convert_time_to_pixels(
433 /* Draw collision indicator */
434 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
435 gdk_draw_point(hashed_process_data
->pixmap
,
438 (hashed_process_data
->height
/2)-3);
439 hashed_process_data
->x
.middle_marked
= TRUE
;
442 TimeWindow time_window
=
443 lttvwindow_get_time_window(control_flow_data
->tab
);
445 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
446 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
449 Drawing_t
*drawing
= control_flow_data
->drawing
;
450 guint width
= drawing
->width
;
452 convert_time_to_pixels(
459 /* Jump over draw if we are at the same x position */
460 if(x
== hashed_process_data
->x
.middle
&&
461 hashed_process_data
->x
.middle_used
)
463 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
464 /* Draw collision indicator */
465 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
466 gdk_draw_point(hashed_process_data
->pixmap
,
469 (hashed_process_data
->height
/2)-3);
470 hashed_process_data
->x
.middle_marked
= TRUE
;
474 DrawContext draw_context
;
476 /* Now create the drawing context that will be used to draw
477 * items related to the last state. */
478 draw_context
.drawable
= hashed_process_data
->pixmap
;
479 draw_context
.gc
= drawing
->gc
;
480 draw_context
.pango_layout
= drawing
->pango_layout
;
481 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
482 draw_context
.drawinfo
.end
.x
= x
;
484 draw_context
.drawinfo
.y
.over
= 1;
485 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
486 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
488 draw_context
.drawinfo
.start
.offset
.over
= 0;
489 draw_context
.drawinfo
.start
.offset
.middle
= 0;
490 draw_context
.drawinfo
.start
.offset
.under
= 0;
491 draw_context
.drawinfo
.end
.offset
.over
= 0;
492 draw_context
.drawinfo
.end
.offset
.middle
= 0;
493 draw_context
.drawinfo
.end
.offset
.under
= 0;
497 PropertiesLine prop_line
= prepare_s_e_line(process
);
498 draw_line((void*)&prop_line
, (void*)&draw_context
);
501 /* become the last x position */
502 hashed_process_data
->x
.middle
= x
;
503 hashed_process_data
->x
.middle_used
= TRUE
;
504 hashed_process_data
->x
.middle_marked
= FALSE
;
506 /* Calculate the next good time */
507 convert_pixels_to_time(width
, x
+1, time_window
,
508 &hashed_process_data
->next_good_time
);
516 /* First, check if the current process is in the state computation
517 * process list. If it is there, that means we must add it right now and
518 * draw items from the beginning of the read for it. If it is not
519 * present, it's a new process and it was not present : it will
520 * be added after the state update. */
521 LttvProcessState
*process
;
522 process
= lttv_state_find_process(ts
,
523 ltt_tracefile_num(tfc
->tf
), pid_in
);
525 if(process
!= NULL
) {
526 /* Well, the process existed : we must get it in the process hash
527 * or add it, and draw its items.
529 /* Add process to process list (if not present) */
531 HashedProcessData
*hashed_process_data
= NULL
;
532 ProcessList
*process_list
= control_flow_data
->process_list
;
533 LttTime birth
= process
->creation_time
;
535 hashed_process_data
= processlist_get_process_data(process_list
,
537 ltt_tracefile_num(tfc
->tf
),
539 tfc
->t_context
->index
);
540 if(hashed_process_data
== NULL
)
542 g_assert(pid_in
== 0 || pid_in
!= process
->ppid
);
543 /* Process not present */
544 ProcessInfo
*process_info
;
545 Drawing_t
*drawing
= control_flow_data
->drawing
;
546 processlist_add(process_list
,
549 ltt_tracefile_num(tfc
->tf
),
552 tfc
->t_context
->index
,
556 &hashed_process_data
);
557 gtk_widget_set_size_request(drawing
->drawing_area
,
560 gtk_widget_queue_draw(drawing
->drawing_area
);
563 //We could set the current process and hash here, but will be done
564 //by after schedchange hook
566 /* Now, the process is in the state hash and our own process hash.
567 * We definitely can draw the items related to the ending state.
570 if(ltt_time_compare(hashed_process_data
->next_good_time
,
573 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
575 TimeWindow time_window
=
576 lttvwindow_get_time_window(control_flow_data
->tab
);
578 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
579 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
582 Drawing_t
*drawing
= control_flow_data
->drawing
;
583 guint width
= drawing
->width
;
585 convert_time_to_pixels(
591 /* Draw collision indicator */
592 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
593 gdk_draw_point(hashed_process_data
->pixmap
,
596 (hashed_process_data
->height
/2)-3);
597 hashed_process_data
->x
.middle_marked
= TRUE
;
600 TimeWindow time_window
=
601 lttvwindow_get_time_window(control_flow_data
->tab
);
603 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
604 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
607 Drawing_t
*drawing
= control_flow_data
->drawing
;
608 guint width
= drawing
->width
;
611 convert_time_to_pixels(
618 /* Jump over draw if we are at the same x position */
619 if(x
== hashed_process_data
->x
.middle
&&
620 hashed_process_data
->x
.middle_used
)
622 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
623 /* Draw collision indicator */
624 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
625 gdk_draw_point(hashed_process_data
->pixmap
,
628 (hashed_process_data
->height
/2)-3);
629 hashed_process_data
->x
.middle_marked
= TRUE
;
633 DrawContext draw_context
;
635 /* Now create the drawing context that will be used to draw
636 * items related to the last state. */
637 draw_context
.drawable
= hashed_process_data
->pixmap
;
638 draw_context
.gc
= drawing
->gc
;
639 draw_context
.pango_layout
= drawing
->pango_layout
;
640 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
641 draw_context
.drawinfo
.end
.x
= x
;
643 draw_context
.drawinfo
.y
.over
= 1;
644 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
645 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
647 draw_context
.drawinfo
.start
.offset
.over
= 0;
648 draw_context
.drawinfo
.start
.offset
.middle
= 0;
649 draw_context
.drawinfo
.start
.offset
.under
= 0;
650 draw_context
.drawinfo
.end
.offset
.over
= 0;
651 draw_context
.drawinfo
.end
.offset
.middle
= 0;
652 draw_context
.drawinfo
.end
.offset
.under
= 0;
656 PropertiesLine prop_line
= prepare_s_e_line(process
);
657 draw_line((void*)&prop_line
, (void*)&draw_context
);
661 /* become the last x position */
662 hashed_process_data
->x
.middle
= x
;
663 hashed_process_data
->x
.middle_used
= TRUE
;
664 hashed_process_data
->x
.middle_marked
= FALSE
;
666 /* Calculate the next good time */
667 convert_pixels_to_time(width
, x
+1, time_window
,
668 &hashed_process_data
->next_good_time
);
672 g_warning("Cannot find pin_in in schedchange %u", pid_in
);
681 GString
*string
= g_string_new("");;
682 gboolean field_names
= TRUE
, state
= TRUE
;
684 lttv_event_to_string(e
, tfc
->tf
, string
, TRUE
, field_names
, tfs
);
685 g_string_append_printf(string
,"\n");
688 g_string_append_printf(string
, " %s",
689 g_quark_to_string(tfs
->process
->state
->s
));
692 g_info("%s",string
->str
);
694 g_string_free(string
, TRUE
);
696 /* End of text dump */
701 /* after_schedchange_hook
703 * The draw after hook is called by the reading API to have a
704 * particular event drawn on the screen.
705 * @param hook_data ControlFlowData structure of the viewer.
706 * @param call_data Event context.
708 * This function adds items to be drawn in a queue for each process.
711 int after_schedchange_hook(void *hook_data
, void *call_data
)
713 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
714 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
715 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
717 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
719 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
721 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
724 e
= ltt_tracefile_get_event(tfc
->tf
);
726 LttTime evtime
= ltt_event_time(e
);
728 /* Add process to process list (if not present) */
729 LttvProcessState
*process_in
;
732 HashedProcessData
*hashed_process_data_in
= NULL
;
734 ProcessList
*process_list
= control_flow_data
->process_list
;
739 pid_out
= ltt_event_get_long_unsigned(e
, thf
->f1
);
740 pid_in
= ltt_event_get_long_unsigned(e
, thf
->f2
);
744 /* Find process pid_in in the list... */
745 //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
746 //process_in = tfs->process;
747 guint cpu
= ltt_tracefile_num(tfc
->tf
);
748 process_in
= ts
->running_process
[cpu
];
749 /* It should exist, because we are after the state update. */
751 g_assert(process_in
!= NULL
);
753 birth
= process_in
->creation_time
;
755 hashed_process_data_in
= processlist_get_process_data(process_list
,
759 tfc
->t_context
->index
);
760 if(hashed_process_data_in
== NULL
)
762 g_assert(pid_in
== 0 || pid_in
!= process_in
->ppid
);
763 ProcessInfo
*process_info
;
764 Drawing_t
*drawing
= control_flow_data
->drawing
;
765 /* Process not present */
766 processlist_add(process_list
,
772 tfc
->t_context
->index
,
776 &hashed_process_data_in
);
777 gtk_widget_set_size_request(drawing
->drawing_area
,
780 gtk_widget_queue_draw(drawing
->drawing_area
);
782 /* Set the current process */
783 process_list
->current_hash_data
[process_in
->cpu
] =
784 hashed_process_data_in
;
786 if(ltt_time_compare(hashed_process_data_in
->next_good_time
,
789 TimeWindow time_window
=
790 lttvwindow_get_time_window(control_flow_data
->tab
);
793 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
794 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
797 Drawing_t
*drawing
= control_flow_data
->drawing
;
798 guint width
= drawing
->width
;
801 convert_time_to_pixels(
807 if(hashed_process_data_in
->x
.middle
!= new_x
) {
808 hashed_process_data_in
->x
.middle
= new_x
;
809 hashed_process_data_in
->x
.middle_used
= FALSE
;
810 hashed_process_data_in
->x
.middle_marked
= FALSE
;
819 /* before_execmode_hook
821 * This function basically draw lines and icons. Two types of lines are drawn :
822 * one small (3 pixels?) representing the state of the process and the second
823 * type is thicker (10 pixels?) representing on which CPU a process is running
824 * (and this only in running state).
826 * Extremums of the lines :
827 * x_min : time of the last event context for this process kept in memory.
828 * x_max : time of the current event.
829 * y : middle of the process in the process list. The process is found in the
830 * list, therefore is it's position in pixels.
832 * The choice of lines'color is defined by the context of the last event for this
837 int before_execmode_hook(void *hook_data
, void *call_data
)
839 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
840 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
841 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
843 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
845 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
847 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
850 e
= ltt_tracefile_get_event(tfc
->tf
);
852 LttTime evtime
= ltt_event_time(e
);
854 /* we are in a execmode, before the state update. We must draw the
855 * items corresponding to the state before it changes : now is the right
859 //LttvProcessState *process = tfs->process;
860 guint cpu
= ltt_tracefile_num(tfc
->tf
);
861 LttvProcessState
*process
= ts
->running_process
[cpu
];
862 g_assert(process
!= NULL
);
864 guint pid
= process
->pid
;
866 /* Well, the process_out existed : we must get it in the process hash
867 * or add it, and draw its items.
869 /* Add process to process list (if not present) */
871 HashedProcessData
*hashed_process_data
= NULL
;
872 ProcessList
*process_list
= control_flow_data
->process_list
;
873 LttTime birth
= process
->creation_time
;
875 if(likely(process_list
->current_hash_data
[cpu
] != NULL
)) {
876 hashed_process_data
= process_list
->current_hash_data
[cpu
];
878 hashed_process_data
= processlist_get_process_data(process_list
,
882 tfc
->t_context
->index
);
883 if(unlikely(hashed_process_data
== NULL
))
885 g_assert(pid
== 0 || pid
!= process
->ppid
);
886 ProcessInfo
*process_info
;
887 /* Process not present */
888 Drawing_t
*drawing
= control_flow_data
->drawing
;
889 processlist_add(process_list
,
895 tfc
->t_context
->index
,
899 &hashed_process_data
);
900 gtk_widget_set_size_request(drawing
->drawing_area
,
903 gtk_widget_queue_draw(drawing
->drawing_area
);
905 /* Set the current process */
906 process_list
->current_hash_data
[process
->cpu
] =
910 /* Now, the process is in the state hash and our own process hash.
911 * We definitely can draw the items related to the ending state.
914 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
917 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
918 TimeWindow time_window
=
919 lttvwindow_get_time_window(control_flow_data
->tab
);
922 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
923 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
926 Drawing_t
*drawing
= control_flow_data
->drawing
;
927 guint width
= drawing
->width
;
929 convert_time_to_pixels(
935 /* Draw collision indicator */
936 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
937 gdk_draw_point(hashed_process_data
->pixmap
,
940 (hashed_process_data
->height
/2)-3);
941 hashed_process_data
->x
.middle_marked
= TRUE
;
944 TimeWindow time_window
=
945 lttvwindow_get_time_window(control_flow_data
->tab
);
948 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
949 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
952 Drawing_t
*drawing
= control_flow_data
->drawing
;
953 guint width
= drawing
->width
;
956 convert_time_to_pixels(
963 /* Jump over draw if we are at the same x position */
964 if(unlikely(x
== hashed_process_data
->x
.middle
&&
965 hashed_process_data
->x
.middle_used
))
967 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
968 /* Draw collision indicator */
969 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
970 gdk_draw_point(hashed_process_data
->pixmap
,
973 (hashed_process_data
->height
/2)-3);
974 hashed_process_data
->x
.middle_marked
= TRUE
;
979 DrawContext draw_context
;
980 /* Now create the drawing context that will be used to draw
981 * items related to the last state. */
982 draw_context
.drawable
= hashed_process_data
->pixmap
;
983 draw_context
.gc
= drawing
->gc
;
984 draw_context
.pango_layout
= drawing
->pango_layout
;
985 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
986 draw_context
.drawinfo
.end
.x
= x
;
988 draw_context
.drawinfo
.y
.over
= 1;
989 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
990 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
992 draw_context
.drawinfo
.start
.offset
.over
= 0;
993 draw_context
.drawinfo
.start
.offset
.middle
= 0;
994 draw_context
.drawinfo
.start
.offset
.under
= 0;
995 draw_context
.drawinfo
.end
.offset
.over
= 0;
996 draw_context
.drawinfo
.end
.offset
.middle
= 0;
997 draw_context
.drawinfo
.end
.offset
.under
= 0;
1001 PropertiesLine prop_line
= prepare_s_e_line(process
);
1002 draw_line((void*)&prop_line
, (void*)&draw_context
);
1005 /* become the last x position */
1006 hashed_process_data
->x
.middle
= x
;
1007 hashed_process_data
->x
.middle_used
= TRUE
;
1008 hashed_process_data
->x
.middle_marked
= FALSE
;
1010 /* Calculate the next good time */
1011 convert_pixels_to_time(width
, x
+1, time_window
,
1012 &hashed_process_data
->next_good_time
);
1019 /* before_process_exit_hook
1021 * Draw lines for process event.
1023 * @param hook_data ControlFlowData structure of the viewer.
1024 * @param call_data Event context.
1026 * This function adds items to be drawn in a queue for each process.
1031 int before_process_exit_hook(void *hook_data
, void *call_data
)
1033 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1034 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1036 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1038 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1040 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1042 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1045 e
= ltt_tracefile_get_event(tfc
->tf
);
1047 LttTime evtime
= ltt_event_time(e
);
1049 /* Add process to process list (if not present) */
1050 //LttvProcessState *process = tfs->process;
1051 guint cpu
= ltt_tracefile_num(tfc
->tf
);
1052 LttvProcessState
*process
= ts
->running_process
[cpu
];
1053 guint pid
= process
->pid
;
1055 guint pl_height
= 0;
1056 HashedProcessData
*hashed_process_data
= NULL
;
1058 ProcessList
*process_list
= control_flow_data
->process_list
;
1060 g_assert(process
!= NULL
);
1062 birth
= process
->creation_time
;
1064 if(likely(process_list
->current_hash_data
[cpu
] != NULL
)) {
1065 hashed_process_data
= process_list
->current_hash_data
[cpu
];
1067 hashed_process_data
= processlist_get_process_data(process_list
,
1071 tfc
->t_context
->index
);
1072 if(unlikely(hashed_process_data
== NULL
))
1074 g_assert(pid
== 0 || pid
!= process
->ppid
);
1075 /* Process not present */
1076 Drawing_t
*drawing
= control_flow_data
->drawing
;
1077 ProcessInfo
*process_info
;
1078 processlist_add(process_list
,
1084 tfc
->t_context
->index
,
1088 &hashed_process_data
);
1089 gtk_widget_set_size_request(drawing
->drawing_area
,
1092 gtk_widget_queue_draw(drawing
->drawing_area
);
1096 /* Now, the process is in the state hash and our own process hash.
1097 * We definitely can draw the items related to the ending state.
1100 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1103 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1104 TimeWindow time_window
=
1105 lttvwindow_get_time_window(control_flow_data
->tab
);
1108 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1109 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1111 #endif //EXTRA_CHECK
1112 Drawing_t
*drawing
= control_flow_data
->drawing
;
1113 guint width
= drawing
->width
;
1115 convert_time_to_pixels(
1121 /* Draw collision indicator */
1122 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1123 gdk_draw_point(hashed_process_data
->pixmap
,
1126 (hashed_process_data
->height
/2)-3);
1127 hashed_process_data
->x
.middle_marked
= TRUE
;
1130 TimeWindow time_window
=
1131 lttvwindow_get_time_window(control_flow_data
->tab
);
1134 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1135 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1137 #endif //EXTRA_CHECK
1138 Drawing_t
*drawing
= control_flow_data
->drawing
;
1139 guint width
= drawing
->width
;
1142 convert_time_to_pixels(
1149 /* Jump over draw if we are at the same x position */
1150 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1151 hashed_process_data
->x
.middle_used
))
1153 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1154 /* Draw collision indicator */
1155 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1156 gdk_draw_point(hashed_process_data
->pixmap
,
1159 (hashed_process_data
->height
/2)-3);
1160 hashed_process_data
->x
.middle_marked
= TRUE
;
1164 DrawContext draw_context
;
1166 /* Now create the drawing context that will be used to draw
1167 * items related to the last state. */
1168 draw_context
.drawable
= hashed_process_data
->pixmap
;
1169 draw_context
.gc
= drawing
->gc
;
1170 draw_context
.pango_layout
= drawing
->pango_layout
;
1171 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1172 draw_context
.drawinfo
.end
.x
= x
;
1174 draw_context
.drawinfo
.y
.over
= 1;
1175 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1176 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1178 draw_context
.drawinfo
.start
.offset
.over
= 0;
1179 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1180 draw_context
.drawinfo
.start
.offset
.under
= 0;
1181 draw_context
.drawinfo
.end
.offset
.over
= 0;
1182 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1183 draw_context
.drawinfo
.end
.offset
.under
= 0;
1187 PropertiesLine prop_line
= prepare_s_e_line(process
);
1188 draw_line((void*)&prop_line
, (void*)&draw_context
);
1191 /* become the last x position */
1192 hashed_process_data
->x
.middle
= x
;
1193 hashed_process_data
->x
.middle_used
= TRUE
;
1194 hashed_process_data
->x
.middle_marked
= FALSE
;
1196 /* Calculate the next good time */
1197 convert_pixels_to_time(width
, x
+1, time_window
,
1198 &hashed_process_data
->next_good_time
);
1208 /* before_process_release_hook
1210 * Draw lines for process event.
1212 * @param hook_data ControlFlowData structure of the viewer.
1213 * @param call_data Event context.
1215 * This function adds items to be drawn in a queue for each process.
1220 int before_process_release_hook(void *hook_data
, void *call_data
)
1222 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1223 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1225 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1227 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1229 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1231 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1234 e
= ltt_tracefile_get_event(tfc
->tf
);
1236 LttTime evtime
= ltt_event_time(e
);
1241 pid
= ltt_event_get_long_unsigned(e
, thf
->f1
);
1244 /* Add process to process list (if not present) */
1245 /* Don't care about the process if it's not in the state hash already :
1246 * that means a process that has never done anything in the trace and
1247 * unknown suddently gets destroyed : no state meaningful to show. */
1248 LttvProcessState
*process
= lttv_state_find_process(ts
, ANY_CPU
, pid
);
1250 if(process
!= NULL
) {
1252 guint pl_height
= 0;
1253 HashedProcessData
*hashed_process_data
= NULL
;
1255 ProcessList
*process_list
= control_flow_data
->process_list
;
1257 birth
= process
->creation_time
;
1259 /* Cannot use current process : this event happens on another process,
1260 * action done by the parent. */
1261 hashed_process_data
= processlist_get_process_data(process_list
,
1265 tfc
->t_context
->index
);
1266 if(unlikely(hashed_process_data
== NULL
))
1268 g_assert(pid
== 0 || pid
!= process
->ppid
);
1269 /* Process not present */
1270 Drawing_t
*drawing
= control_flow_data
->drawing
;
1271 ProcessInfo
*process_info
;
1272 processlist_add(process_list
,
1278 tfc
->t_context
->index
,
1282 &hashed_process_data
);
1283 gtk_widget_set_size_request(drawing
->drawing_area
,
1286 gtk_widget_queue_draw(drawing
->drawing_area
);
1289 /* Now, the process is in the state hash and our own process hash.
1290 * We definitely can draw the items related to the ending state.
1293 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1296 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1297 TimeWindow time_window
=
1298 lttvwindow_get_time_window(control_flow_data
->tab
);
1301 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1302 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1304 #endif //EXTRA_CHECK
1305 Drawing_t
*drawing
= control_flow_data
->drawing
;
1306 guint width
= drawing
->width
;
1308 convert_time_to_pixels(
1314 /* Draw collision indicator */
1315 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1316 gdk_draw_point(hashed_process_data
->pixmap
,
1319 (hashed_process_data
->height
/2)-3);
1320 hashed_process_data
->x
.middle_marked
= TRUE
;
1323 TimeWindow time_window
=
1324 lttvwindow_get_time_window(control_flow_data
->tab
);
1327 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1328 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1330 #endif //EXTRA_CHECK
1331 Drawing_t
*drawing
= control_flow_data
->drawing
;
1332 guint width
= drawing
->width
;
1335 convert_time_to_pixels(
1342 /* Jump over draw if we are at the same x position */
1343 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1344 hashed_process_data
->x
.middle_used
))
1346 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1347 /* Draw collision indicator */
1348 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1349 gdk_draw_point(hashed_process_data
->pixmap
,
1352 (hashed_process_data
->height
/2)-3);
1353 hashed_process_data
->x
.middle_marked
= TRUE
;
1357 DrawContext draw_context
;
1359 /* Now create the drawing context that will be used to draw
1360 * items related to the last state. */
1361 draw_context
.drawable
= hashed_process_data
->pixmap
;
1362 draw_context
.gc
= drawing
->gc
;
1363 draw_context
.pango_layout
= drawing
->pango_layout
;
1364 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1365 draw_context
.drawinfo
.end
.x
= x
;
1367 draw_context
.drawinfo
.y
.over
= 1;
1368 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1369 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1371 draw_context
.drawinfo
.start
.offset
.over
= 0;
1372 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1373 draw_context
.drawinfo
.start
.offset
.under
= 0;
1374 draw_context
.drawinfo
.end
.offset
.over
= 0;
1375 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1376 draw_context
.drawinfo
.end
.offset
.under
= 0;
1380 PropertiesLine prop_line
= prepare_s_e_line(process
);
1381 draw_line((void*)&prop_line
, (void*)&draw_context
);
1384 /* become the last x position */
1385 hashed_process_data
->x
.middle
= x
;
1386 hashed_process_data
->x
.middle_used
= TRUE
;
1387 hashed_process_data
->x
.middle_marked
= FALSE
;
1389 /* Calculate the next good time */
1390 convert_pixels_to_time(width
, x
+1, time_window
,
1391 &hashed_process_data
->next_good_time
);
1403 /* after_process_fork_hook
1405 * Create the processlist entry for the child process. Put the last
1406 * position in x at the current time value.
1408 * @param hook_data ControlFlowData structure of the viewer.
1409 * @param call_data Event context.
1411 * This function adds items to be drawn in a queue for each process.
1414 int after_process_fork_hook(void *hook_data
, void *call_data
)
1416 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1417 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1418 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1420 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1422 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1424 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1427 e
= ltt_tracefile_get_event(tfc
->tf
);
1429 LttTime evtime
= ltt_event_time(e
);
1433 child_pid
= ltt_event_get_long_unsigned(e
, thf
->f2
);
1436 /* Add process to process list (if not present) */
1437 LttvProcessState
*process_child
;
1439 guint pl_height
= 0;
1440 HashedProcessData
*hashed_process_data_child
= NULL
;
1442 ProcessList
*process_list
= control_flow_data
->process_list
;
1444 /* Find child in the list... */
1445 process_child
= lttv_state_find_process(ts
, ANY_CPU
, child_pid
);
1446 /* It should exist, because we are after the state update. */
1447 g_assert(process_child
!= NULL
);
1449 birth
= process_child
->creation_time
;
1451 /* Cannot use current process, because this action is done by the parent
1453 hashed_process_data_child
= processlist_get_process_data(process_list
,
1457 tfc
->t_context
->index
);
1458 if(likely(hashed_process_data_child
== NULL
))
1460 g_assert(child_pid
== 0 || child_pid
!= process_child
->ppid
);
1461 /* Process not present */
1462 Drawing_t
*drawing
= control_flow_data
->drawing
;
1463 ProcessInfo
*process_info
;
1464 processlist_add(process_list
,
1468 process_child
->ppid
,
1470 tfc
->t_context
->index
,
1471 process_child
->name
,
1474 &hashed_process_data_child
);
1475 gtk_widget_set_size_request(drawing
->drawing_area
,
1478 gtk_widget_queue_draw(drawing
->drawing_area
);
1482 if(likely(ltt_time_compare(hashed_process_data_child
->next_good_time
,
1485 TimeWindow time_window
=
1486 lttvwindow_get_time_window(control_flow_data
->tab
);
1489 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1490 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1492 #endif //EXTRA_CHECK
1493 Drawing_t
*drawing
= control_flow_data
->drawing
;
1494 guint width
= drawing
->width
;
1496 convert_time_to_pixels(
1502 if(likely(hashed_process_data_child
->x
.over
!= new_x
)) {
1503 hashed_process_data_child
->x
.over
= new_x
;
1504 hashed_process_data_child
->x
.over_used
= FALSE
;
1505 hashed_process_data_child
->x
.over_marked
= FALSE
;
1507 if(likely(hashed_process_data_child
->x
.middle
!= new_x
)) {
1508 hashed_process_data_child
->x
.middle
= new_x
;
1509 hashed_process_data_child
->x
.middle_used
= FALSE
;
1510 hashed_process_data_child
->x
.middle_marked
= FALSE
;
1512 if(likely(hashed_process_data_child
->x
.under
!= new_x
)) {
1513 hashed_process_data_child
->x
.under
= new_x
;
1514 hashed_process_data_child
->x
.under_used
= FALSE
;
1515 hashed_process_data_child
->x
.under_marked
= FALSE
;
1523 /* after_process_exit_hook
1525 * Create the processlist entry for the child process. Put the last
1526 * position in x at the current time value.
1528 * @param hook_data ControlFlowData structure of the viewer.
1529 * @param call_data Event context.
1531 * This function adds items to be drawn in a queue for each process.
1534 int after_process_exit_hook(void *hook_data
, void *call_data
)
1536 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1537 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1538 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1540 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1542 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1544 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1547 e
= ltt_tracefile_get_event(tfc
->tf
);
1549 LttTime evtime
= ltt_event_time(e
);
1551 /* Add process to process list (if not present) */
1552 //LttvProcessState *process = tfs->process;
1553 guint cpu
= ltt_tracefile_num(tfc
->tf
);
1554 LttvProcessState
*process
= ts
->running_process
[cpu
];
1556 /* It should exist, because we are after the state update. */
1557 g_assert(process
!= NULL
);
1559 guint pid
= process
->pid
;
1561 guint pl_height
= 0;
1562 HashedProcessData
*hashed_process_data
= NULL
;
1564 ProcessList
*process_list
= control_flow_data
->process_list
;
1566 birth
= process
->creation_time
;
1568 if(likely(process_list
->current_hash_data
[cpu
] != NULL
) ){
1569 hashed_process_data
= process_list
->current_hash_data
[cpu
];
1571 hashed_process_data
= processlist_get_process_data(process_list
,
1575 tfc
->t_context
->index
);
1576 if(unlikely(hashed_process_data
== NULL
))
1578 g_assert(pid
== 0 || pid
!= process
->ppid
);
1579 /* Process not present */
1580 Drawing_t
*drawing
= control_flow_data
->drawing
;
1581 ProcessInfo
*process_info
;
1582 processlist_add(process_list
,
1588 tfc
->t_context
->index
,
1592 &hashed_process_data
);
1593 gtk_widget_set_size_request(drawing
->drawing_area
,
1596 gtk_widget_queue_draw(drawing
->drawing_area
);
1599 /* Set the current process */
1600 process_list
->current_hash_data
[process
->cpu
] =
1601 hashed_process_data
;
1604 if(unlikely(ltt_time_compare(hashed_process_data
->next_good_time
,
1607 TimeWindow time_window
=
1608 lttvwindow_get_time_window(control_flow_data
->tab
);
1611 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1612 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1614 #endif //EXTRA_CHECK
1615 Drawing_t
*drawing
= control_flow_data
->drawing
;
1616 guint width
= drawing
->width
;
1618 convert_time_to_pixels(
1623 if(unlikely(hashed_process_data
->x
.middle
!= new_x
)) {
1624 hashed_process_data
->x
.middle
= new_x
;
1625 hashed_process_data
->x
.middle_used
= FALSE
;
1626 hashed_process_data
->x
.middle_marked
= FALSE
;
1634 /* Get the filename of the process to print */
1635 int after_fs_exec_hook(void *hook_data
, void *call_data
)
1637 LttvTraceHookByFacility
*thf
= (LttvTraceHookByFacility
*)hook_data
;
1638 EventsRequest
*events_request
= (EventsRequest
*)thf
->hook_data
;
1639 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
1641 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1643 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1645 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1647 guint cpu
= ltt_tracefile_num(tfc
->tf
);
1648 LttvProcessState
*process
= ts
->running_process
[cpu
];
1649 g_assert(process
!= NULL
);
1651 guint pid
= process
->pid
;
1653 /* Well, the process_out existed : we must get it in the process hash
1654 * or add it, and draw its items.
1656 /* Add process to process list (if not present) */
1657 guint pl_height
= 0;
1658 HashedProcessData
*hashed_process_data
= NULL
;
1659 ProcessList
*process_list
= control_flow_data
->process_list
;
1660 LttTime birth
= process
->creation_time
;
1662 if(likely(process_list
->current_hash_data
[cpu
] != NULL
)) {
1663 hashed_process_data
= process_list
->current_hash_data
[cpu
];
1665 hashed_process_data
= processlist_get_process_data(process_list
,
1669 tfc
->t_context
->index
);
1670 if(unlikely(hashed_process_data
== NULL
))
1672 g_assert(pid
== 0 || pid
!= process
->ppid
);
1673 ProcessInfo
*process_info
;
1674 /* Process not present */
1675 Drawing_t
*drawing
= control_flow_data
->drawing
;
1676 processlist_add(process_list
,
1682 tfc
->t_context
->index
,
1686 &hashed_process_data
);
1687 gtk_widget_set_size_request(drawing
->drawing_area
,
1690 gtk_widget_queue_draw(drawing
->drawing_area
);
1692 /* Set the current process */
1693 process_list
->current_hash_data
[process
->cpu
] =
1694 hashed_process_data
;
1697 processlist_set_name(process_list
, process
->name
, hashed_process_data
);
1706 gint
update_time_window_hook(void *hook_data
, void *call_data
)
1708 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1709 Drawing_t
*drawing
= control_flow_data
->drawing
;
1710 ProcessList
*process_list
= control_flow_data
->process_list
;
1712 const TimeWindowNotifyData
*time_window_nofify_data
=
1713 ((const TimeWindowNotifyData
*)call_data
);
1715 TimeWindow
*old_time_window
=
1716 time_window_nofify_data
->old_time_window
;
1717 TimeWindow
*new_time_window
=
1718 time_window_nofify_data
->new_time_window
;
1720 /* Update the ruler */
1721 drawing_update_ruler(control_flow_data
->drawing
,
1725 /* Two cases : zoom in/out or scrolling */
1727 /* In order to make sure we can reuse the old drawing, the scale must
1728 * be the same and the new time interval being partly located in the
1729 * currently shown time interval. (reuse is only for scrolling)
1732 g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
1733 old_time_window
->start_time
.tv_sec
,
1734 old_time_window
->start_time
.tv_nsec
,
1735 old_time_window
->time_width
.tv_sec
,
1736 old_time_window
->time_width
.tv_nsec
);
1738 g_info("New time window HOOK : %lu, %lu to %lu, %lu",
1739 new_time_window
->start_time
.tv_sec
,
1740 new_time_window
->start_time
.tv_nsec
,
1741 new_time_window
->time_width
.tv_sec
,
1742 new_time_window
->time_width
.tv_nsec
);
1744 if( new_time_window
->time_width
.tv_sec
== old_time_window
->time_width
.tv_sec
1745 && new_time_window
->time_width
.tv_nsec
== old_time_window
->time_width
.tv_nsec
)
1747 /* Same scale (scrolling) */
1748 g_info("scrolling");
1749 LttTime
*ns
= &new_time_window
->start_time
;
1750 LttTime
*nw
= &new_time_window
->time_width
;
1751 LttTime
*os
= &old_time_window
->start_time
;
1752 LttTime
*ow
= &old_time_window
->time_width
;
1753 LttTime old_end
= old_time_window
->end_time
;
1754 LttTime new_end
= new_time_window
->end_time
;
1756 //if(ns<os+w && os+w<ns+w)
1757 //if(ns<old_end && os<ns)
1758 if(ltt_time_compare(*ns
, old_end
) == -1
1759 && ltt_time_compare(*os
, *ns
) == -1)
1761 g_info("scrolling near right");
1762 /* Scroll right, keep right part of the screen */
1764 guint width
= control_flow_data
->drawing
->width
;
1765 convert_time_to_pixels(
1771 /* Copy old data to new location */
1772 copy_pixmap_region(process_list
,
1774 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1778 control_flow_data
->drawing
->width
-x
+SAFETY
, -1);
1780 if(drawing
->damage_begin
== drawing
->damage_end
)
1781 drawing
->damage_begin
= control_flow_data
->drawing
->width
-x
;
1783 drawing
->damage_begin
= 0;
1785 drawing
->damage_end
= control_flow_data
->drawing
->width
;
1787 /* Clear the data request background, but not SAFETY */
1788 rectangle_pixmap(process_list
,
1789 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1791 drawing
->damage_begin
+SAFETY
, 0,
1792 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1794 gtk_widget_queue_draw(drawing
->drawing_area
);
1795 //gtk_widget_queue_draw_area (drawing->drawing_area,
1797 // control_flow_data->drawing->width,
1798 // control_flow_data->drawing->height);
1800 /* Get new data for the rest. */
1801 drawing_data_request(control_flow_data
->drawing
,
1802 drawing
->damage_begin
, 0,
1803 drawing
->damage_end
- drawing
->damage_begin
,
1804 control_flow_data
->drawing
->height
);
1807 //if(ns<os && os<ns+w)
1808 //if(ns<os && os<new_end)
1809 if(ltt_time_compare(*ns
,*os
) == -1
1810 && ltt_time_compare(*os
,new_end
) == -1)
1812 g_info("scrolling near left");
1813 /* Scroll left, keep left part of the screen */
1815 guint width
= control_flow_data
->drawing
->width
;
1816 convert_time_to_pixels(
1822 /* Copy old data to new location */
1823 copy_pixmap_region (process_list
,
1825 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1831 if(drawing
->damage_begin
== drawing
->damage_end
)
1832 drawing
->damage_end
= x
;
1834 drawing
->damage_end
=
1835 control_flow_data
->drawing
->width
;
1837 drawing
->damage_begin
= 0;
1839 rectangle_pixmap (process_list
,
1840 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1842 drawing
->damage_begin
, 0,
1843 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1846 gtk_widget_queue_draw(drawing
->drawing_area
);
1847 //gtk_widget_queue_draw_area (drawing->drawing_area,
1849 // control_flow_data->drawing->width,
1850 // control_flow_data->drawing->height);
1853 /* Get new data for the rest. */
1854 drawing_data_request(control_flow_data
->drawing
,
1855 drawing
->damage_begin
, 0,
1856 drawing
->damage_end
- drawing
->damage_begin
,
1857 control_flow_data
->drawing
->height
);
1860 if(ltt_time_compare(*ns
,*os
) == 0)
1862 g_info("not scrolling");
1864 g_info("scrolling far");
1865 /* Cannot reuse any part of the screen : far jump */
1868 rectangle_pixmap (process_list
,
1869 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1872 control_flow_data
->drawing
->width
+SAFETY
, // do not overlap
1875 //gtk_widget_queue_draw_area (drawing->drawing_area,
1877 // control_flow_data->drawing->width,
1878 // control_flow_data->drawing->height);
1879 gtk_widget_queue_draw(drawing
->drawing_area
);
1881 drawing
->damage_begin
= 0;
1882 drawing
->damage_end
= control_flow_data
->drawing
->width
;
1884 drawing_data_request(control_flow_data
->drawing
,
1886 control_flow_data
->drawing
->width
,
1887 control_flow_data
->drawing
->height
);
1893 /* Different scale (zoom) */
1896 rectangle_pixmap (process_list
,
1897 control_flow_data
->drawing
->drawing_area
->style
->black_gc
,
1900 control_flow_data
->drawing
->width
+SAFETY
, // do not overlap
1903 //gtk_widget_queue_draw_area (drawing->drawing_area,
1905 // control_flow_data->drawing->width,
1906 // control_flow_data->drawing->height);
1907 gtk_widget_queue_draw(drawing
->drawing_area
);
1909 drawing
->damage_begin
= 0;
1910 drawing
->damage_end
= control_flow_data
->drawing
->width
;
1912 drawing_data_request(control_flow_data
->drawing
,
1914 control_flow_data
->drawing
->width
,
1915 control_flow_data
->drawing
->height
);
1918 /* Update directly when scrolling */
1919 gdk_window_process_updates(control_flow_data
->drawing
->drawing_area
->window
,
1925 gint
traceset_notify(void *hook_data
, void *call_data
)
1927 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1928 Drawing_t
*drawing
= control_flow_data
->drawing
;
1930 if(unlikely(drawing
->gc
== NULL
)) {
1933 if(drawing
->dotted_gc
== NULL
) {
1937 drawing_clear(control_flow_data
->drawing
);
1938 processlist_clear(control_flow_data
->process_list
);
1939 gtk_widget_set_size_request(
1940 control_flow_data
->drawing
->drawing_area
,
1941 -1, processlist_get_height(control_flow_data
->process_list
));
1942 redraw_notify(control_flow_data
, NULL
);
1944 request_background_data(control_flow_data
);
1949 gint
redraw_notify(void *hook_data
, void *call_data
)
1951 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1952 Drawing_t
*drawing
= control_flow_data
->drawing
;
1953 GtkWidget
*widget
= drawing
->drawing_area
;
1955 drawing
->damage_begin
= 0;
1956 drawing
->damage_end
= drawing
->width
;
1958 /* fun feature, to be separated someday... */
1959 drawing_clear(control_flow_data
->drawing
);
1960 processlist_clear(control_flow_data
->process_list
);
1961 gtk_widget_set_size_request(
1962 control_flow_data
->drawing
->drawing_area
,
1963 -1, processlist_get_height(control_flow_data
->process_list
));
1965 rectangle_pixmap (control_flow_data
->process_list
,
1966 widget
->style
->black_gc
,
1969 drawing
->alloc_width
,
1972 gtk_widget_queue_draw(drawing
->drawing_area
);
1974 if(drawing
->damage_begin
< drawing
->damage_end
)
1976 drawing_data_request(drawing
,
1977 drawing
->damage_begin
,
1979 drawing
->damage_end
-drawing
->damage_begin
,
1983 //gtk_widget_queue_draw_area(drawing->drawing_area,
1986 // drawing->height);
1992 gint
continue_notify(void *hook_data
, void *call_data
)
1994 ControlFlowData
*control_flow_data
= (ControlFlowData
*) hook_data
;
1995 Drawing_t
*drawing
= control_flow_data
->drawing
;
1997 //g_assert(widget->allocation.width == drawing->damage_end);
1999 if(drawing
->damage_begin
< drawing
->damage_end
)
2001 drawing_data_request(drawing
,
2002 drawing
->damage_begin
,
2004 drawing
->damage_end
-drawing
->damage_begin
,
2012 gint
update_current_time_hook(void *hook_data
, void *call_data
)
2014 ControlFlowData
*control_flow_data
= (ControlFlowData
*)hook_data
;
2015 Drawing_t
*drawing
= control_flow_data
->drawing
;
2017 LttTime current_time
= *((LttTime
*)call_data
);
2019 TimeWindow time_window
=
2020 lttvwindow_get_time_window(control_flow_data
->tab
);
2022 LttTime time_begin
= time_window
.start_time
;
2023 LttTime width
= time_window
.time_width
;
2026 guint64 time_ll
= ltt_time_to_uint64(width
);
2027 time_ll
= time_ll
>> 1; /* divide by two */
2028 half_width
= ltt_time_from_uint64(time_ll
);
2030 LttTime time_end
= ltt_time_add(time_begin
, width
);
2032 LttvTracesetContext
* tsc
=
2033 lttvwindow_get_traceset_context(control_flow_data
->tab
);
2035 LttTime trace_start
= tsc
->time_span
.start_time
;
2036 LttTime trace_end
= tsc
->time_span
.end_time
;
2038 g_info("New current time HOOK : %lu, %lu", current_time
.tv_sec
,
2039 current_time
.tv_nsec
);
2043 /* If current time is inside time interval, just move the highlight
2046 /* Else, we have to change the time interval. We have to tell it
2047 * to the main window. */
2048 /* The time interval change will take care of placing the current
2049 * time at the center of the visible area, or nearest possible if we are
2050 * at one end of the trace. */
2053 if(ltt_time_compare(current_time
, time_begin
) < 0)
2055 TimeWindow new_time_window
;
2057 if(ltt_time_compare(current_time
,
2058 ltt_time_add(trace_start
,half_width
)) < 0)
2059 time_begin
= trace_start
;
2061 time_begin
= ltt_time_sub(current_time
,half_width
);
2063 new_time_window
.start_time
= time_begin
;
2064 new_time_window
.time_width
= width
;
2065 new_time_window
.time_width_double
= ltt_time_to_double(width
);
2066 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
2068 lttvwindow_report_time_window(control_flow_data
->tab
, new_time_window
);
2070 else if(ltt_time_compare(current_time
, time_end
) > 0)
2072 TimeWindow new_time_window
;
2074 if(ltt_time_compare(current_time
, ltt_time_sub(trace_end
, half_width
)) > 0)
2075 time_begin
= ltt_time_sub(trace_end
,width
);
2077 time_begin
= ltt_time_sub(current_time
,half_width
);
2079 new_time_window
.start_time
= time_begin
;
2080 new_time_window
.time_width
= width
;
2081 new_time_window
.time_width_double
= ltt_time_to_double(width
);
2082 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
2084 lttvwindow_report_time_window(control_flow_data
->tab
, new_time_window
);
2087 gtk_widget_queue_draw(control_flow_data
->drawing
->drawing_area
);
2089 /* Update directly when scrolling */
2090 gdk_window_process_updates(control_flow_data
->drawing
->drawing_area
->window
,
2096 typedef struct _ClosureData
{
2097 EventsRequest
*events_request
;
2098 LttvTracesetState
*tss
;
2104 void draw_closure(gpointer key
, gpointer value
, gpointer user_data
)
2106 ProcessInfo
*process_info
= (ProcessInfo
*)key
;
2107 HashedProcessData
*hashed_process_data
= (HashedProcessData
*)value
;
2108 ClosureData
*closure_data
= (ClosureData
*)user_data
;
2110 EventsRequest
*events_request
= closure_data
->events_request
;
2111 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
2113 LttvTracesetState
*tss
= closure_data
->tss
;
2114 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)tss
;
2116 LttTime evtime
= closure_data
->end_time
;
2119 /* For the process */
2120 /* First, check if the current process is in the state computation
2121 * process list. If it is there, that means we must add it right now and
2122 * draw items from the beginning of the read for it. If it is not
2123 * present, it's a new process and it was not present : it will
2124 * be added after the state update. */
2126 g_assert(lttv_traceset_number(tsc
->ts
) > 0);
2127 #endif //EXTRA_CHECK
2128 LttvTraceContext
*tc
= tsc
->traces
[process_info
->trace_num
];
2129 LttvTraceState
*ts
= (LttvTraceState
*)tc
;
2132 //FIXME : optimize data structures.
2133 LttvTracefileState
*tfs
;
2134 LttvTracefileContext
*tfc
;
2136 for(i
=0;i
<tc
->tracefiles
->len
;i
++) {
2137 tfc
= g_array_index(tc
->tracefiles
, LttvTracefileContext
*, i
);
2138 if(ltt_tracefile_name(tfc
->tf
) == LTT_NAME_CPU
2139 && ltt_tracefile_num(tfc
->tf
) == process_info
->cpu
)
2143 g_assert(i
<tc
->tracefiles
->len
);
2144 tfs
= LTTV_TRACEFILE_STATE(tfc
);
2146 // LttvTracefileState *tfs =
2147 // (LttvTracefileState*)tsc->traces[process_info->trace_num]->
2148 // tracefiles[process_info->cpu];
2150 LttvProcessState
*process
;
2151 process
= lttv_state_find_process(ts
, process_info
->cpu
,
2154 if(unlikely(process
!= NULL
)) {
2156 /* Only draw for processes that are currently in the trace states */
2158 ProcessList
*process_list
= control_flow_data
->process_list
;
2160 /* Should be alike when background info is ready */
2161 if(control_flow_data
->background_info_waiting
==0)
2162 g_assert(ltt_time_compare(process
->creation_time
,
2163 process_info
->birth
) == 0);
2164 #endif //EXTRA_CHECK
2166 /* Now, the process is in the state hash and our own process hash.
2167 * We definitely can draw the items related to the ending state.
2170 if(unlikely(ltt_time_compare(hashed_process_data
->next_good_time
,
2173 TimeWindow time_window
=
2174 lttvwindow_get_time_window(control_flow_data
->tab
);
2177 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
2178 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
2180 #endif //EXTRA_CHECK
2181 Drawing_t
*drawing
= control_flow_data
->drawing
;
2182 guint width
= drawing
->width
;
2184 guint x
= closure_data
->x_end
;
2186 DrawContext draw_context
;
2188 /* Now create the drawing context that will be used to draw
2189 * items related to the last state. */
2190 draw_context
.drawable
= hashed_process_data
->pixmap
;
2191 draw_context
.gc
= drawing
->gc
;
2192 draw_context
.pango_layout
= drawing
->pango_layout
;
2193 draw_context
.drawinfo
.end
.x
= x
;
2195 draw_context
.drawinfo
.y
.over
= 1;
2196 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
2197 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
2199 draw_context
.drawinfo
.start
.offset
.over
= 0;
2200 draw_context
.drawinfo
.start
.offset
.middle
= 0;
2201 draw_context
.drawinfo
.start
.offset
.under
= 0;
2202 draw_context
.drawinfo
.end
.offset
.over
= 0;
2203 draw_context
.drawinfo
.end
.offset
.middle
= 0;
2204 draw_context
.drawinfo
.end
.offset
.under
= 0;
2206 /* Jump over draw if we are at the same x position */
2207 if(x
== hashed_process_data
->x
.over
)
2211 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.over
;
2213 PropertiesLine prop_line
= prepare_execmode_line(process
);
2214 draw_line((void*)&prop_line
, (void*)&draw_context
);
2216 hashed_process_data
->x
.over
= x
;
2220 if(unlikely(x
== hashed_process_data
->x
.middle
&&
2221 hashed_process_data
->x
.middle_used
)) {
2222 #if 0 /* do not mark closure : not missing information */
2223 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
2224 /* Draw collision indicator */
2225 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
2226 gdk_draw_point(drawing
->pixmap
,
2230 hashed_process_data
->x
.middle_marked
= TRUE
;
2235 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
2237 PropertiesLine prop_line
= prepare_s_e_line(process
);
2238 draw_line((void*)&prop_line
, (void*)&draw_context
);
2240 /* become the last x position */
2241 if(likely(x
!= hashed_process_data
->x
.middle
)) {
2242 hashed_process_data
->x
.middle
= x
;
2243 /* but don't use the pixel */
2244 hashed_process_data
->x
.middle_used
= FALSE
;
2246 /* Calculate the next good time */
2247 convert_pixels_to_time(width
, x
+1, time_window
,
2248 &hashed_process_data
->next_good_time
);
2257 int before_chunk(void *hook_data
, void *call_data
)
2259 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2260 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2261 ControlFlowData
*cfd
= (ControlFlowData
*)events_request
->viewer_data
;
2263 /* Desactivate sort */
2264 gtk_tree_sortable_set_sort_column_id(
2265 GTK_TREE_SORTABLE(cfd
->process_list
->list_store
),
2267 GTK_SORT_ASCENDING
);
2269 drawing_chunk_begin(events_request
, tss
);
2274 int before_request(void *hook_data
, void *call_data
)
2276 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2277 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2279 drawing_data_request_begin(events_request
, tss
);
2286 * after request is necessary in addition of after chunk in order to draw
2287 * lines until the end of the screen. after chunk just draws lines until
2294 int after_request(void *hook_data
, void *call_data
)
2296 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2297 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
2298 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2300 ProcessList
*process_list
= control_flow_data
->process_list
;
2301 LttTime end_time
= events_request
->end_time
;
2303 ClosureData closure_data
;
2304 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2305 closure_data
.tss
= tss
;
2306 closure_data
.end_time
= end_time
;
2308 TimeWindow time_window
=
2309 lttvwindow_get_time_window(control_flow_data
->tab
);
2310 guint width
= control_flow_data
->drawing
->width
;
2311 convert_time_to_pixels(
2315 &closure_data
.x_end
);
2318 /* Draw last items */
2319 g_hash_table_foreach(process_list
->process_hash
, draw_closure
,
2320 (void*)&closure_data
);
2323 /* Request expose */
2324 drawing_request_expose(events_request
, tss
, end_time
);
2333 int after_chunk(void *hook_data
, void *call_data
)
2335 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2336 ControlFlowData
*control_flow_data
= events_request
->viewer_data
;
2337 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2338 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)call_data
;
2339 LttvTracefileContext
*tfc
= lttv_traceset_context_get_current_tfc(tsc
);
2342 ProcessList
*process_list
= control_flow_data
->process_list
;
2344 g_free(process_list
->current_hash_data
);
2345 process_list
->current_hash_data
= NULL
;
2348 end_time
= LTT_TIME_MIN(tfc
->timestamp
, events_request
->end_time
);
2349 else /* end of traceset, or position now out of request : end */
2350 end_time
= events_request
->end_time
;
2352 ClosureData closure_data
;
2353 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2354 closure_data
.tss
= tss
;
2355 closure_data
.end_time
= end_time
;
2357 TimeWindow time_window
=
2358 lttvwindow_get_time_window(control_flow_data
->tab
);
2359 guint width
= control_flow_data
->drawing
->width
;
2360 convert_time_to_pixels(
2364 &closure_data
.x_end
);
2366 /* Draw last items */
2367 g_hash_table_foreach(process_list
->process_hash
, draw_closure
,
2368 (void*)&closure_data
);
2370 /* Reactivate sort */
2371 gtk_tree_sortable_set_sort_column_id(
2372 GTK_TREE_SORTABLE(control_flow_data
->process_list
->list_store
),
2373 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2374 GTK_SORT_ASCENDING
);
2376 update_index_to_pixmap(control_flow_data
->process_list
);
2377 /* Request a full expose : drawing scrambled */
2378 gtk_widget_queue_draw(control_flow_data
->drawing
->drawing_area
);
2380 /* Request expose (updates damages zone also) */
2381 drawing_request_expose(events_request
, tss
, end_time
);