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
61 //#include <pango/pango.h>
63 #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
82 #define STATE_LINE_WIDTH 6
83 #define COLLISION_POSITION(height) (((height - STATE_LINE_WIDTH)/2) -3)
85 extern GSList
*g_legend_list
;
88 /* Action to do when background computation completed.
90 * Wait for all the awaited computations to be over.
93 static gint
background_ready(void *hook_data
, void *call_data
)
95 ControlFlowData
*resourceview_data
= (ControlFlowData
*)hook_data
;
97 resourceview_data
->background_info_waiting
--;
99 if(resourceview_data
->background_info_waiting
== 0) {
100 g_message("control flow viewer : background computation data ready.");
102 drawing_clear(resourceview_data
->drawing
);
103 processlist_clear(resourceview_data
->process_list
);
104 gtk_widget_set_size_request(
105 resourceview_data
->drawing
->drawing_area
,
106 -1, processlist_get_height(resourceview_data
->process_list
));
107 redraw_notify(resourceview_data
, NULL
);
114 /* Request background computation. Verify if it is in progress or ready first.
115 * Only for each trace in the tab's traceset.
117 static void request_background_data(ControlFlowData
*resourceview_data
)
119 LttvTracesetContext
* tsc
=
120 lttvwindow_get_traceset_context(resourceview_data
->tab
);
121 gint num_traces
= lttv_traceset_number(tsc
->ts
);
124 LttvTraceState
*tstate
;
126 LttvHooks
*background_ready_hook
=
128 lttv_hooks_add(background_ready_hook
, background_ready
, resourceview_data
,
130 resourceview_data
->background_info_waiting
= 0;
132 for(i
=0;i
<num_traces
;i
++) {
133 trace
= lttv_traceset_get(tsc
->ts
, i
);
134 tstate
= LTTV_TRACE_STATE(tsc
->traces
[i
]);
136 if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace
)==FALSE
137 && !tstate
->has_precomputed_states
) {
139 if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"),
141 /* We first remove requests that could have been done for the same
142 * information. Happens when two viewers ask for it before servicing
145 if(!lttvwindowtraces_background_request_find(trace
, "state"))
146 lttvwindowtraces_background_request_queue(
147 main_window_get_widget(resourceview_data
->tab
), trace
, "state");
148 lttvwindowtraces_background_notify_queue(resourceview_data
,
152 background_ready_hook
);
153 resourceview_data
->background_info_waiting
++;
154 } else { /* in progress */
156 lttvwindowtraces_background_notify_current(resourceview_data
,
160 background_ready_hook
);
161 resourceview_data
->background_info_waiting
++;
164 /* Data ready. By its nature, this viewer doesn't need to have
165 * its data ready hook called there, because a background
166 * request is always linked with a redraw.
171 lttv_hooks_destroy(background_ready_hook
);
176 * Event Viewer's constructor hook
178 * This constructor is given as a parameter to the menuitem and toolbar button
179 * registration. It creates the list.
180 * @param tab A pointer to the parent tab.
181 * @return The widget created.
184 h_resourceview(LttvPlugin
*plugin
)
186 LttvPluginTab
*ptab
= LTTV_PLUGIN_TAB(plugin
);
187 Tab
*tab
= ptab
->tab
;
188 g_info("h_guicontrolflow, %p", tab
);
189 ControlFlowData
*resourceview_data
= resourceview(ptab
);
191 resourceview_data
->tab
= tab
;
193 // Unreg done in the GuiControlFlow_Destructor
194 lttvwindow_register_traceset_notify(tab
,
198 lttvwindow_register_time_window_notify(tab
,
199 update_time_window_hook
,
201 lttvwindow_register_current_time_notify(tab
,
202 update_current_time_hook
,
204 lttvwindow_register_redraw_notify(tab
,
207 lttvwindow_register_continue_notify(tab
,
210 request_background_data(resourceview_data
);
213 return guicontrolflow_get_widget(resourceview_data
) ;
217 void legend_destructor(GtkWindow
*legend
)
219 g_legend_list
= g_slist_remove(g_legend_list
, legend
);
222 /* Create a popup legend */
224 h_legend(LttvPlugin
*plugin
)
226 LttvPluginTab
*ptab
= LTTV_PLUGIN_TAB(plugin
);
227 Tab
*tab
= ptab
->tab
;
228 g_info("h_legend, %p", tab
);
230 GtkWindow
*legend
= GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL
));
232 g_legend_list
= g_slist_append(
236 g_object_set_data_full(
240 (GDestroyNotify
)legend_destructor
);
242 gtk_window_set_title(legend
, "Control Flow View Legend");
244 GtkWidget
*pixmap
= create_pixmap(GTK_WIDGET(legend
), "lttv-color-list.png");
246 gtk_container_add(GTK_CONTAINER(legend
), GTK_WIDGET(pixmap
));
248 gtk_widget_show(GTK_WIDGET(pixmap
));
249 gtk_widget_show(GTK_WIDGET(legend
));
252 return NULL
; /* This is a popup window */
256 int event_selected_hook(void *hook_data
, void *call_data
)
258 guint
*event_number
= (guint
*) call_data
;
260 g_debug("DEBUG : event selected by main window : %u", *event_number
);
265 static void cpu_set_line_color(PropertiesLine
*prop_line
, LttvCPUState
*s
)
267 GQuark present_state
;
269 if(s
->mode_stack
->len
== 0)
270 present_state
= LTTV_CPU_UNKNOWN
;
272 present_state
= ((GQuark
*)s
->mode_stack
->data
)[s
->mode_stack
->len
-1];
274 if(present_state
== LTTV_CPU_IDLE
) {
275 prop_line
->color
= drawing_colors_cpu
[COL_CPU_IDLE
];
277 else if(present_state
== LTTV_CPU_BUSY
) {
278 prop_line
->color
= drawing_colors_cpu
[COL_CPU_BUSY
];
280 else if(present_state
== LTTV_CPU_IRQ
) {
281 prop_line
->color
= drawing_colors_cpu
[COL_CPU_IRQ
];
283 else if(present_state
== LTTV_CPU_SOFT_IRQ
) {
284 prop_line
->color
= drawing_colors_cpu
[COL_CPU_SOFT_IRQ
];
286 else if(present_state
== LTTV_CPU_TRAP
) {
287 prop_line
->color
= drawing_colors_cpu
[COL_CPU_TRAP
];
289 prop_line
->color
= drawing_colors_cpu
[COL_CPU_UNKNOWN
];
293 static void irq_set_line_color(PropertiesLine
*prop_line
, LttvIRQState
*s
)
295 GQuark present_state
;
296 if(s
->mode_stack
->len
== 0)
297 present_state
= LTTV_IRQ_UNKNOWN
;
299 present_state
= ((GQuark
*)s
->mode_stack
->data
)[s
->mode_stack
->len
-1];
301 if(present_state
== LTTV_IRQ_IDLE
) {
302 prop_line
->color
= drawing_colors_irq
[COL_IRQ_IDLE
];
304 else if(present_state
== LTTV_IRQ_BUSY
) {
305 prop_line
->color
= drawing_colors_irq
[COL_IRQ_BUSY
];
308 prop_line
->color
= drawing_colors_irq
[COL_IRQ_UNKNOWN
];
312 static void soft_irq_set_line_color(PropertiesLine
*prop_line
, LttvSoftIRQState
*s
)
315 prop_line
->color
= drawing_colors_soft_irq
[COL_SOFT_IRQ_BUSY
];
317 prop_line
->color
= drawing_colors_soft_irq
[COL_SOFT_IRQ_PENDING
];
319 prop_line
->color
= drawing_colors_soft_irq
[COL_SOFT_IRQ_IDLE
];
322 static void trap_set_line_color(PropertiesLine
*prop_line
, LttvTrapState
*s
)
325 prop_line
->color
= drawing_colors_trap
[COL_TRAP_IDLE
];
327 prop_line
->color
= drawing_colors_trap
[COL_TRAP_BUSY
];
330 static void bdev_set_line_color(PropertiesLine
*prop_line
, LttvBdevState
*s
)
332 GQuark present_state
;
333 if(s
== 0 || s
->mode_stack
->len
== 0)
334 present_state
= LTTV_BDEV_UNKNOWN
;
336 present_state
= ((GQuark
*)s
->mode_stack
->data
)[s
->mode_stack
->len
-1];
338 if(present_state
== LTTV_BDEV_IDLE
) {
339 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_IDLE
];
341 else if(present_state
== LTTV_BDEV_BUSY_READING
) {
342 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_BUSY_READING
];
344 else if(present_state
== LTTV_BDEV_BUSY_WRITING
) {
345 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_BUSY_WRITING
];
348 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_UNKNOWN
];
352 /* before_schedchange_hook
354 * This function basically draw lines and icons. Two types of lines are drawn :
355 * one small (3 pixels?) representing the state of the process and the second
356 * type is thicker (10 pixels?) representing on which CPU a process is running
357 * (and this only in running state).
359 * Extremums of the lines :
360 * x_min : time of the last event context for this process kept in memory.
361 * x_max : time of the current event.
362 * y : middle of the process in the process list. The process is found in the
363 * list, therefore is it's position in pixels.
365 * The choice of lines'color is defined by the context of the last event for this
370 int before_schedchange_hook(void *hook_data
, void *call_data
)
372 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
373 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
374 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
376 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
378 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
379 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
382 e
= ltt_tracefile_get_event(tfc
->tf
);
384 LttTime evtime
= ltt_event_time(e
);
386 /* we are in a schedchange, before the state update. We must draw the
387 * items corresponding to the state before it changes : now is the right
393 pid_out
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
394 pid_in
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
395 // TODO: can't we reenable this? pmf
396 // if(pid_in != 0 && pid_out != 0) {
397 // /* not a transition to/from idle */
401 tfc
->target_pid
= pid_out
;
403 guint cpu
= tfs
->cpu
;
405 guint trace_num
= ts
->parent
.index
;
406 /* Add process to process list (if not present) */
407 HashedResourceData
*hashed_process_data
= NULL
;
409 hashed_process_data
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
411 /* Now, the process is in the state hash and our own process hash.
412 * We definitely can draw the items related to the ending state.
415 if(ltt_time_compare(hashed_process_data
->next_good_time
,
418 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
420 TimeWindow time_window
=
421 lttvwindow_get_time_window(resourceview_data
->tab
);
423 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
424 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
427 Drawing_t
*drawing
= resourceview_data
->drawing
;
428 guint width
= drawing
->width
;
430 convert_time_to_pixels(
436 /* Draw collision indicator */
437 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
438 gdk_draw_point(hashed_process_data
->pixmap
,
441 COLLISION_POSITION(hashed_process_data
->height
));
442 hashed_process_data
->x
.middle_marked
= TRUE
;
445 TimeWindow time_window
=
446 lttvwindow_get_time_window(resourceview_data
->tab
);
448 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
449 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
452 Drawing_t
*drawing
= resourceview_data
->drawing
;
453 guint width
= drawing
->width
;
455 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 COLLISION_POSITION(hashed_process_data
->height
));
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 PropertiesLine prop_line
;
501 prop_line
.line_width
= STATE_LINE_WIDTH
;
502 prop_line
.style
= GDK_LINE_SOLID
;
503 prop_line
.y
= MIDDLE
;
504 cpu_set_line_color(&prop_line
, tfs
->cpu_state
);
505 draw_line((void*)&prop_line
, (void*)&draw_context
);
508 /* become the last x position */
509 hashed_process_data
->x
.middle
= x
;
510 hashed_process_data
->x
.middle_used
= TRUE
;
511 hashed_process_data
->x
.middle_marked
= FALSE
;
513 /* Calculate the next good time */
514 convert_pixels_to_time(width
, x
+1, time_window
,
515 &hashed_process_data
->next_good_time
);
522 /* after_schedchange_hook
524 * The draw after hook is called by the reading API to have a
525 * particular event drawn on the screen.
526 * @param hook_data ControlFlowData structure of the viewer.
527 * @param call_data Event context.
529 * This function adds items to be drawn in a queue for each process.
532 int after_schedchange_hook(void *hook_data
, void *call_data
)
534 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
535 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
536 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
537 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
538 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
539 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
542 e
= ltt_tracefile_get_event(tfc
->tf
);
544 LttvFilter
*filter
= resourceview_data
->filter
;
545 if(filter
!= NULL
&& filter
->head
!= NULL
)
546 if(!lttv_filter_tree_parse(filter
->head
,e
,tfc
->tf
,
547 tfc
->t_context
->t
,tfc
,NULL
,NULL
))
550 LttTime evtime
= ltt_event_time(e
);
552 /* Add process to process list (if not present) */
553 LttvProcessState
*process_in
;
555 HashedResourceData
*hashed_process_data_in
= NULL
;
557 ProcessList
*process_list
= resourceview_data
->process_list
;
562 pid_out
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
563 pid_in
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
567 /* Find process pid_in in the list... */
568 //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
569 //process_in = tfs->process;
570 guint cpu
= tfs
->cpu
;
571 guint trace_num
= ts
->parent
.index
;
572 process_in
= ts
->running_process
[cpu
];
573 /* It should exist, because we are after the state update. */
575 g_assert(process_in
!= NULL
);
577 birth
= process_in
->creation_time
;
579 //hashed_process_data_in = processlist_get_process_data(process_list, cpuq, trace_num);
580 hashed_process_data_in
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
582 /* Set the current process */
583 process_list
->current_hash_data
[trace_num
][process_in
->cpu
] =
584 hashed_process_data_in
;
586 if(ltt_time_compare(hashed_process_data_in
->next_good_time
,
589 TimeWindow time_window
=
590 lttvwindow_get_time_window(resourceview_data
->tab
);
593 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
594 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
597 Drawing_t
*drawing
= resourceview_data
->drawing
;
598 guint width
= drawing
->width
;
601 convert_time_to_pixels(
607 if(hashed_process_data_in
->x
.middle
!= new_x
) {
608 hashed_process_data_in
->x
.middle
= new_x
;
609 hashed_process_data_in
->x
.middle_used
= FALSE
;
610 hashed_process_data_in
->x
.middle_marked
= FALSE
;
616 int before_execmode_hook_irq(void *hook_data
, void *call_data
);
617 int before_execmode_hook_soft_irq(void *hook_data
, void *call_data
);
618 int before_execmode_hook_trap(void *hook_data
, void *call_data
);
620 /* before_execmode_hook
622 * This function basically draw lines and icons. Two types of lines are drawn :
623 * one small (3 pixels?) representing the state of the process and the second
624 * type is thicker (10 pixels?) representing on which CPU a process is running
625 * (and this only in running state).
627 * Extremums of the lines :
628 * x_min : time of the last event context for this process kept in memory.
629 * x_max : time of the current event.
630 * y : middle of the process in the process list. The process is found in the
631 * list, therefore is it's position in pixels.
633 * The choice of lines'color is defined by the context of the last event for this
637 int before_execmode_hook(void *hook_data
, void *call_data
)
639 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
640 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
641 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
643 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
645 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
646 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
649 e
= ltt_tracefile_get_event(tfc
->tf
);
651 LttTime evtime
= ltt_event_time(e
);
653 before_execmode_hook_irq(hook_data
, call_data
);
654 before_execmode_hook_soft_irq(hook_data
, call_data
);
655 before_execmode_hook_trap(hook_data
, call_data
);
657 /* we are in a execmode, before the state update. We must draw the
658 * items corresponding to the state before it changes : now is the right
662 guint cpu
= tfs
->cpu
;
664 guint trace_num
= ts
->parent
.index
;
665 LttvProcessState
*process
= ts
->running_process
[cpu
];
666 g_assert(process
!= NULL
);
668 /* Well, the process_out existed : we must get it in the process hash
669 * or add it, and draw its items.
671 /* Add process to process list (if not present) */
672 HashedResourceData
*hashed_process_data
= NULL
;
673 ProcessList
*process_list
= resourceview_data
->process_list
;
675 if(likely(process_list
->current_hash_data
[trace_num
][cpu
] != NULL
)) {
676 hashed_process_data
= process_list
->current_hash_data
[trace_num
][cpu
];
678 hashed_process_data
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
680 /* Set the current process */
681 process_list
->current_hash_data
[trace_num
][process
->cpu
] =
685 /* Now, the process is in the state hash and our own process hash.
686 * We definitely can draw the items related to the ending state.
689 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
692 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
693 TimeWindow time_window
=
694 lttvwindow_get_time_window(resourceview_data
->tab
);
697 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
698 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
701 Drawing_t
*drawing
= resourceview_data
->drawing
;
702 guint width
= drawing
->width
;
704 convert_time_to_pixels(
710 /* Draw collision indicator */
711 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
712 gdk_draw_point(hashed_process_data
->pixmap
,
715 COLLISION_POSITION(hashed_process_data
->height
));
716 hashed_process_data
->x
.middle_marked
= TRUE
;
720 TimeWindow time_window
=
721 lttvwindow_get_time_window(resourceview_data
->tab
);
724 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
725 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
728 Drawing_t
*drawing
= resourceview_data
->drawing
;
729 guint width
= drawing
->width
;
732 convert_time_to_pixels(
739 /* Jump over draw if we are at the same x position */
740 if(unlikely(x
== hashed_process_data
->x
.middle
&&
741 hashed_process_data
->x
.middle_used
))
743 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
744 /* Draw collision indicator */
745 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
746 gdk_draw_point(hashed_process_data
->pixmap
,
749 COLLISION_POSITION(hashed_process_data
->height
));
750 hashed_process_data
->x
.middle_marked
= TRUE
;
756 DrawContext draw_context
;
757 /* Now create the drawing context that will be used to draw
758 * items related to the last state. */
759 draw_context
.drawable
= hashed_process_data
->pixmap
;
760 draw_context
.gc
= drawing
->gc
;
761 draw_context
.pango_layout
= drawing
->pango_layout
;
762 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
763 draw_context
.drawinfo
.end
.x
= x
;
765 draw_context
.drawinfo
.y
.over
= 1;
766 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
767 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
769 draw_context
.drawinfo
.start
.offset
.over
= 0;
770 draw_context
.drawinfo
.start
.offset
.middle
= 0;
771 draw_context
.drawinfo
.start
.offset
.under
= 0;
772 draw_context
.drawinfo
.end
.offset
.over
= 0;
773 draw_context
.drawinfo
.end
.offset
.middle
= 0;
774 draw_context
.drawinfo
.end
.offset
.under
= 0;
778 PropertiesLine prop_line
;
779 prop_line
.line_width
= STATE_LINE_WIDTH
;
780 prop_line
.style
= GDK_LINE_SOLID
;
781 prop_line
.y
= MIDDLE
;
782 cpu_set_line_color(&prop_line
, tfs
->cpu_state
);
783 draw_line((void*)&prop_line
, (void*)&draw_context
);
785 /* become the last x position */
786 hashed_process_data
->x
.middle
= x
;
787 hashed_process_data
->x
.middle_used
= TRUE
;
788 hashed_process_data
->x
.middle_marked
= FALSE
;
790 /* Calculate the next good time */
791 convert_pixels_to_time(width
, x
+1, time_window
,
792 &hashed_process_data
->next_good_time
);
799 int before_execmode_hook_irq(void *hook_data
, void *call_data
)
801 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
802 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
803 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
805 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
807 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
808 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
809 struct marker_info
*minfo
;
812 e
= ltt_tracefile_get_event(tfc
->tf
);
814 LttTime evtime
= ltt_event_time(e
);
816 /* we are in a execmode, before the state update. We must draw the
817 * items corresponding to the state before it changes : now is the right
823 guint cpu
= tfs
->cpu
;
826 * Check for LTT_CHANNEL_KERNEL channel name and event ID
827 * corresponding to LTT_EVENT_IRQ_ENTRY or LTT_EVENT_IRQ_EXIT.
829 if (tfc
->tf
->name
!= LTT_CHANNEL_KERNEL
)
831 minfo
= marker_get_info_from_id(tfc
->tf
->mdata
, e
->event_id
);
832 g_assert(minfo
!= NULL
);
833 if (minfo
->name
== LTT_EVENT_IRQ_ENTRY
) {
834 irq
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
835 } else if (minfo
->name
== LTT_EVENT_IRQ_EXIT
) {
836 gint len
= ts
->cpu_states
[cpu
].irq_stack
->len
;
838 irq
= g_array_index(ts
->cpu_states
[cpu
].irq_stack
, gint
, len
-1);
846 guint trace_num
= ts
->parent
.index
;
848 /* Well, the process_out existed : we must get it in the process hash
849 * or add it, and draw its items.
851 /* Add process to process list (if not present) */
852 HashedResourceData
*hashed_process_data
= NULL
;
854 hashed_process_data
= resourcelist_obtain_irq(resourceview_data
, trace_num
, irq
);
855 // TODO: fix this, it's ugly and slow:
859 str
= g_strdup_printf("IRQ %" PRIu64
" [%s]", irq
,
860 (char*)g_quark_to_string(ts
->name_tables
->irq_names
[irq
]));
861 name
= g_quark_from_string(str
);
864 gtk_tree_store_set(resourceview_data
->process_list
->list_store
, &hashed_process_data
->y_iter
, NAME_COLUMN
, g_quark_to_string(name
), -1);
866 /* Now, the process is in the state hash and our own process hash.
867 * We definitely can draw the items related to the ending state.
870 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
873 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
874 TimeWindow time_window
=
875 lttvwindow_get_time_window(resourceview_data
->tab
);
878 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
879 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
882 Drawing_t
*drawing
= resourceview_data
->drawing
;
883 guint width
= drawing
->width
;
885 convert_time_to_pixels(
891 /* Draw collision indicator */
892 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
893 gdk_draw_point(hashed_process_data
->pixmap
,
896 COLLISION_POSITION(hashed_process_data
->height
));
897 hashed_process_data
->x
.middle_marked
= TRUE
;
901 TimeWindow time_window
=
902 lttvwindow_get_time_window(resourceview_data
->tab
);
905 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
906 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
909 Drawing_t
*drawing
= resourceview_data
->drawing
;
910 guint width
= drawing
->width
;
913 convert_time_to_pixels(
920 /* Jump over draw if we are at the same x position */
921 if(unlikely(x
== hashed_process_data
->x
.middle
&&
922 hashed_process_data
->x
.middle_used
))
924 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
925 /* Draw collision indicator */
926 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
927 gdk_draw_point(hashed_process_data
->pixmap
,
930 COLLISION_POSITION(hashed_process_data
->height
));
931 hashed_process_data
->x
.middle_marked
= TRUE
;
937 DrawContext draw_context
;
938 /* Now create the drawing context that will be used to draw
939 * items related to the last state. */
940 draw_context
.drawable
= hashed_process_data
->pixmap
;
941 draw_context
.gc
= drawing
->gc
;
942 draw_context
.pango_layout
= drawing
->pango_layout
;
943 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
944 draw_context
.drawinfo
.end
.x
= x
;
946 draw_context
.drawinfo
.y
.over
= 1;
947 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
948 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
950 draw_context
.drawinfo
.start
.offset
.over
= 0;
951 draw_context
.drawinfo
.start
.offset
.middle
= 0;
952 draw_context
.drawinfo
.start
.offset
.under
= 0;
953 draw_context
.drawinfo
.end
.offset
.over
= 0;
954 draw_context
.drawinfo
.end
.offset
.middle
= 0;
955 draw_context
.drawinfo
.end
.offset
.under
= 0;
959 PropertiesLine prop_line
;
960 prop_line
.line_width
= STATE_LINE_WIDTH
;
961 prop_line
.style
= GDK_LINE_SOLID
;
962 prop_line
.y
= MIDDLE
;
963 irq_set_line_color(&prop_line
, &ts
->irq_states
[irq
]);
964 draw_line((void*)&prop_line
, (void*)&draw_context
);
966 /* become the last x position */
967 hashed_process_data
->x
.middle
= x
;
968 hashed_process_data
->x
.middle_used
= TRUE
;
969 hashed_process_data
->x
.middle_marked
= FALSE
;
971 /* Calculate the next good time */
972 convert_pixels_to_time(width
, x
+1, time_window
,
973 &hashed_process_data
->next_good_time
);
980 int before_execmode_hook_soft_irq(void *hook_data
, void *call_data
)
982 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
983 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
984 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
986 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
988 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
989 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
990 struct marker_info
*minfo
;
993 e
= ltt_tracefile_get_event(tfc
->tf
);
995 LttTime evtime
= ltt_event_time(e
);
997 /* we are in a execmode, before the state update. We must draw the
998 * items corresponding to the state before it changes : now is the right
1004 guint cpu
= tfs
->cpu
;
1007 * Check for LTT_CHANNEL_KERNEL channel name and event ID
1008 * corresponding to LTT_EVENT_SOFT_IRQ_RAISE, LTT_EVENT_SOFT_IRQ_ENTRY
1009 * or LTT_EVENT_SOFT_IRQ_EXIT.
1011 if (tfc
->tf
->name
!= LTT_CHANNEL_KERNEL
)
1013 minfo
= marker_get_info_from_id(tfc
->tf
->mdata
, e
->event_id
);
1014 g_assert(minfo
!= NULL
);
1015 if (minfo
->name
== LTT_EVENT_SOFT_IRQ_RAISE
1016 || minfo
->name
== LTT_EVENT_SOFT_IRQ_ENTRY
) {
1017 softirq
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1018 } else if (minfo
->name
== LTT_EVENT_SOFT_IRQ_EXIT
) {
1019 gint len
= ts
->cpu_states
[cpu
].softirq_stack
->len
;
1021 softirq
= g_array_index(ts
->cpu_states
[cpu
].softirq_stack
, gint
, len
-1);
1029 guint trace_num
= ts
->parent
.index
;
1031 /* Well, the process_out existed : we must get it in the process hash
1032 * or add it, and draw its items.
1034 /* Add process to process list (if not present) */
1035 HashedResourceData
*hashed_process_data
= NULL
;
1037 hashed_process_data
= resourcelist_obtain_soft_irq(resourceview_data
, trace_num
, softirq
);
1039 /* Now, the process is in the state hash and our own process hash.
1040 * We definitely can draw the items related to the ending state.
1043 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1046 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1047 TimeWindow time_window
=
1048 lttvwindow_get_time_window(resourceview_data
->tab
);
1051 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1052 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1054 #endif //EXTRA_CHECK
1055 Drawing_t
*drawing
= resourceview_data
->drawing
;
1056 guint width
= drawing
->width
;
1058 convert_time_to_pixels(
1064 /* Draw collision indicator */
1065 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1066 gdk_draw_point(hashed_process_data
->pixmap
,
1069 COLLISION_POSITION(hashed_process_data
->height
));
1070 hashed_process_data
->x
.middle_marked
= TRUE
;
1074 TimeWindow time_window
=
1075 lttvwindow_get_time_window(resourceview_data
->tab
);
1078 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1079 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1081 #endif //EXTRA_CHECK
1082 Drawing_t
*drawing
= resourceview_data
->drawing
;
1083 guint width
= drawing
->width
;
1086 convert_time_to_pixels(
1093 /* Jump over draw if we are at the same x position */
1094 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1095 hashed_process_data
->x
.middle_used
))
1097 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1098 /* Draw collision indicator */
1099 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1100 gdk_draw_point(hashed_process_data
->pixmap
,
1103 COLLISION_POSITION(hashed_process_data
->height
));
1104 hashed_process_data
->x
.middle_marked
= TRUE
;
1110 DrawContext draw_context
;
1111 /* Now create the drawing context that will be used to draw
1112 * items related to the last state. */
1113 draw_context
.drawable
= hashed_process_data
->pixmap
;
1114 draw_context
.gc
= drawing
->gc
;
1115 draw_context
.pango_layout
= drawing
->pango_layout
;
1116 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1117 draw_context
.drawinfo
.end
.x
= x
;
1119 draw_context
.drawinfo
.y
.over
= 1;
1120 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1121 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1123 draw_context
.drawinfo
.start
.offset
.over
= 0;
1124 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1125 draw_context
.drawinfo
.start
.offset
.under
= 0;
1126 draw_context
.drawinfo
.end
.offset
.over
= 0;
1127 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1128 draw_context
.drawinfo
.end
.offset
.under
= 0;
1132 PropertiesLine prop_line
;
1133 prop_line
.line_width
= STATE_LINE_WIDTH
;
1134 prop_line
.style
= GDK_LINE_SOLID
;
1135 prop_line
.y
= MIDDLE
;
1136 soft_irq_set_line_color(&prop_line
, &ts
->soft_irq_states
[softirq
]);
1137 draw_line((void*)&prop_line
, (void*)&draw_context
);
1139 /* become the last x position */
1140 hashed_process_data
->x
.middle
= x
;
1141 hashed_process_data
->x
.middle_used
= TRUE
;
1142 hashed_process_data
->x
.middle_marked
= FALSE
;
1144 /* Calculate the next good time */
1145 convert_pixels_to_time(width
, x
+1, time_window
,
1146 &hashed_process_data
->next_good_time
);
1153 int before_execmode_hook_trap(void *hook_data
, void *call_data
)
1155 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
1156 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
1157 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1159 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1161 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1162 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1163 struct marker_info
*minfo
;
1166 e
= ltt_tracefile_get_event(tfc
->tf
);
1168 LttTime evtime
= ltt_event_time(e
);
1170 /* we are in a execmode, before the state update. We must draw the
1171 * items corresponding to the state before it changes : now is the right
1177 guint cpu
= tfs
->cpu
;
1180 * Check for LTT_CHANNEL_KERNEL channel name and event ID
1181 * corresponding to LTT_EVENT_TRAP/PAGE_FAULT_ENTRY or
1182 * LTT_EVENT_TRAP/PAGE_FAULT_EXIT.
1184 if (tfc
->tf
->name
!= LTT_CHANNEL_KERNEL
)
1186 minfo
= marker_get_info_from_id(tfc
->tf
->mdata
, e
->event_id
);
1187 g_assert(minfo
!= NULL
);
1188 if (minfo
->name
== LTT_EVENT_TRAP_ENTRY
1189 || minfo
->name
== LTT_EVENT_PAGE_FAULT_ENTRY
1190 || minfo
->name
== LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY
) {
1191 trap
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1192 } else if (minfo
->name
== LTT_EVENT_TRAP_EXIT
1193 || minfo
->name
== LTT_EVENT_PAGE_FAULT_EXIT
1194 || minfo
->name
== LTT_EVENT_PAGE_FAULT_NOSEM_EXIT
) {
1195 gint len
= ts
->cpu_states
[cpu
].trap_stack
->len
;
1197 trap
= g_array_index(ts
->cpu_states
[cpu
].trap_stack
, gint
, len
-1);
1205 guint trace_num
= ts
->parent
.index
;
1207 /* Well, the process_out existed : we must get it in the process hash
1208 * or add it, and draw its items.
1210 /* Add process to process list (if not present) */
1211 HashedResourceData
*hashed_process_data
= NULL
;
1213 hashed_process_data
= resourcelist_obtain_trap(resourceview_data
, trace_num
, trap
);
1215 /* Now, the process is in the state hash and our own process hash.
1216 * We definitely can draw the items related to the ending state.
1219 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1222 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1223 TimeWindow time_window
=
1224 lttvwindow_get_time_window(resourceview_data
->tab
);
1227 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1228 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1230 #endif //EXTRA_CHECK
1231 Drawing_t
*drawing
= resourceview_data
->drawing
;
1232 guint width
= drawing
->width
;
1234 convert_time_to_pixels(
1240 /* Draw collision indicator */
1241 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1242 gdk_draw_point(hashed_process_data
->pixmap
,
1245 COLLISION_POSITION(hashed_process_data
->height
));
1246 hashed_process_data
->x
.middle_marked
= TRUE
;
1250 TimeWindow time_window
=
1251 lttvwindow_get_time_window(resourceview_data
->tab
);
1254 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1255 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1257 #endif //EXTRA_CHECK
1258 Drawing_t
*drawing
= resourceview_data
->drawing
;
1259 guint width
= drawing
->width
;
1262 convert_time_to_pixels(
1269 /* Jump over draw if we are at the same x position */
1270 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1271 hashed_process_data
->x
.middle_used
))
1273 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1274 /* Draw collision indicator */
1275 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1276 gdk_draw_point(hashed_process_data
->pixmap
,
1279 COLLISION_POSITION(hashed_process_data
->height
));
1280 hashed_process_data
->x
.middle_marked
= TRUE
;
1286 DrawContext draw_context
;
1287 /* Now create the drawing context that will be used to draw
1288 * items related to the last state. */
1289 draw_context
.drawable
= hashed_process_data
->pixmap
;
1290 draw_context
.gc
= drawing
->gc
;
1291 draw_context
.pango_layout
= drawing
->pango_layout
;
1292 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1293 draw_context
.drawinfo
.end
.x
= x
;
1295 draw_context
.drawinfo
.y
.over
= 1;
1296 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1297 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1299 draw_context
.drawinfo
.start
.offset
.over
= 0;
1300 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1301 draw_context
.drawinfo
.start
.offset
.under
= 0;
1302 draw_context
.drawinfo
.end
.offset
.over
= 0;
1303 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1304 draw_context
.drawinfo
.end
.offset
.under
= 0;
1308 PropertiesLine prop_line
;
1309 prop_line
.line_width
= STATE_LINE_WIDTH
;
1310 prop_line
.style
= GDK_LINE_SOLID
;
1311 prop_line
.y
= MIDDLE
;
1312 trap_set_line_color(&prop_line
, &ts
->trap_states
[trap
]);
1313 draw_line((void*)&prop_line
, (void*)&draw_context
);
1315 /* become the last x position */
1316 hashed_process_data
->x
.middle
= x
;
1317 hashed_process_data
->x
.middle_used
= TRUE
;
1318 hashed_process_data
->x
.middle_marked
= FALSE
;
1320 /* Calculate the next good time */
1321 convert_pixels_to_time(width
, x
+1, time_window
,
1322 &hashed_process_data
->next_good_time
);
1330 int before_bdev_event_hook(void *hook_data
, void *call_data
)
1332 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
1333 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
1334 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1336 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1338 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1341 e
= ltt_tracefile_get_event(tfc
->tf
);
1343 LttTime evtime
= ltt_event_time(e
);
1345 /* we are in a execmode, before the state update. We must draw the
1346 * items corresponding to the state before it changes : now is the right
1351 guint8 major
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1352 guint8 minor
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
1353 gint devcode_gint
= MKDEV(major
,minor
);
1355 guint trace_num
= ts
->parent
.index
;
1357 LttvBdevState
*bdev
= g_hash_table_lookup(ts
->bdev_states
, &devcode_gint
);
1358 /* the result of the lookup might be NULL. that's ok, the rest of the function
1359 should understand it was not found and that its state is unknown */
1361 /* Well, the process_out existed : we must get it in the process hash
1362 * or add it, and draw its items.
1364 /* Add process to process list (if not present) */
1365 HashedResourceData
*hashed_process_data
= NULL
;
1366 // LttTime birth = process->creation_time;
1368 // if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) {
1369 // hashed_process_data = process_list->current_hash_data[trace_num][cpu];
1371 hashed_process_data
= resourcelist_obtain_bdev(resourceview_data
, trace_num
, devcode_gint
);
1372 ////hashed_process_data = processlist_get_process_data(process_list, resourceq, trace_num);
1373 // hashed_process_data = processlist_get_process_data(process_list,
1379 /* Set the current process */
1380 // process_list->current_hash_data[trace_num][process->cpu] =
1381 // hashed_process_data;
1384 /* Now, the process is in the state hash and our own process hash.
1385 * We definitely can draw the items related to the ending state.
1388 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1391 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1392 TimeWindow time_window
=
1393 lttvwindow_get_time_window(resourceview_data
->tab
);
1396 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1397 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1399 #endif //EXTRA_CHECK
1400 Drawing_t
*drawing
= resourceview_data
->drawing
;
1401 guint width
= drawing
->width
;
1403 convert_time_to_pixels(
1409 /* Draw collision indicator */
1410 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1411 gdk_draw_point(hashed_process_data
->pixmap
,
1414 COLLISION_POSITION(hashed_process_data
->height
));
1415 hashed_process_data
->x
.middle_marked
= TRUE
;
1419 TimeWindow time_window
=
1420 lttvwindow_get_time_window(resourceview_data
->tab
);
1423 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1424 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1426 #endif //EXTRA_CHECK
1427 Drawing_t
*drawing
= resourceview_data
->drawing
;
1428 guint width
= drawing
->width
;
1431 convert_time_to_pixels(
1438 /* Jump over draw if we are at the same x position */
1439 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1440 hashed_process_data
->x
.middle_used
))
1442 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1443 /* Draw collision indicator */
1444 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1445 gdk_draw_point(hashed_process_data
->pixmap
,
1448 COLLISION_POSITION(hashed_process_data
->height
));
1449 hashed_process_data
->x
.middle_marked
= TRUE
;
1455 DrawContext draw_context
;
1456 /* Now create the drawing context that will be used to draw
1457 * items related to the last state. */
1458 draw_context
.drawable
= hashed_process_data
->pixmap
;
1459 draw_context
.gc
= drawing
->gc
;
1460 draw_context
.pango_layout
= drawing
->pango_layout
;
1461 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1462 draw_context
.drawinfo
.end
.x
= x
;
1464 draw_context
.drawinfo
.y
.over
= 1;
1465 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1466 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1468 draw_context
.drawinfo
.start
.offset
.over
= 0;
1469 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1470 draw_context
.drawinfo
.start
.offset
.under
= 0;
1471 draw_context
.drawinfo
.end
.offset
.over
= 0;
1472 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1473 draw_context
.drawinfo
.end
.offset
.under
= 0;
1477 PropertiesLine prop_line
;
1478 prop_line
.line_width
= STATE_LINE_WIDTH
;
1479 prop_line
.style
= GDK_LINE_SOLID
;
1480 prop_line
.y
= MIDDLE
;
1481 bdev_set_line_color(&prop_line
, bdev
);
1482 draw_line((void*)&prop_line
, (void*)&draw_context
);
1484 /* become the last x position */
1485 hashed_process_data
->x
.middle
= x
;
1486 hashed_process_data
->x
.middle_used
= TRUE
;
1487 hashed_process_data
->x
.middle_marked
= FALSE
;
1489 /* Calculate the next good time */
1490 convert_pixels_to_time(width
, x
+1, time_window
,
1491 &hashed_process_data
->next_good_time
);
1498 gint
update_time_window_hook(void *hook_data
, void *call_data
)
1500 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1501 Drawing_t
*drawing
= resourceview_data
->drawing
;
1502 ProcessList
*process_list
= resourceview_data
->process_list
;
1504 const TimeWindowNotifyData
*time_window_nofify_data
=
1505 ((const TimeWindowNotifyData
*)call_data
);
1507 TimeWindow
*old_time_window
=
1508 time_window_nofify_data
->old_time_window
;
1509 TimeWindow
*new_time_window
=
1510 time_window_nofify_data
->new_time_window
;
1512 /* Update the ruler */
1513 drawing_update_ruler(resourceview_data
->drawing
,
1517 /* Two cases : zoom in/out or scrolling */
1519 /* In order to make sure we can reuse the old drawing, the scale must
1520 * be the same and the new time interval being partly located in the
1521 * currently shown time interval. (reuse is only for scrolling)
1524 g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
1525 old_time_window
->start_time
.tv_sec
,
1526 old_time_window
->start_time
.tv_nsec
,
1527 old_time_window
->time_width
.tv_sec
,
1528 old_time_window
->time_width
.tv_nsec
);
1530 g_info("New time window HOOK : %lu, %lu to %lu, %lu",
1531 new_time_window
->start_time
.tv_sec
,
1532 new_time_window
->start_time
.tv_nsec
,
1533 new_time_window
->time_width
.tv_sec
,
1534 new_time_window
->time_width
.tv_nsec
);
1536 if( new_time_window
->time_width
.tv_sec
== old_time_window
->time_width
.tv_sec
1537 && new_time_window
->time_width
.tv_nsec
== old_time_window
->time_width
.tv_nsec
)
1539 /* Same scale (scrolling) */
1540 g_info("scrolling");
1541 LttTime
*ns
= &new_time_window
->start_time
;
1542 LttTime
*os
= &old_time_window
->start_time
;
1543 LttTime old_end
= old_time_window
->end_time
;
1544 LttTime new_end
= new_time_window
->end_time
;
1546 //if(ns<os+w && os+w<ns+w)
1547 //if(ns<old_end && os<ns)
1548 if(ltt_time_compare(*ns
, old_end
) == -1
1549 && ltt_time_compare(*os
, *ns
) == -1)
1551 g_info("scrolling near right");
1552 /* Scroll right, keep right part of the screen */
1554 guint width
= resourceview_data
->drawing
->width
;
1555 convert_time_to_pixels(
1561 /* Copy old data to new location */
1562 copy_pixmap_region(process_list
,
1564 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1568 resourceview_data
->drawing
->width
-x
+SAFETY
, -1);
1570 if(drawing
->damage_begin
== drawing
->damage_end
)
1571 drawing
->damage_begin
= resourceview_data
->drawing
->width
-x
;
1573 drawing
->damage_begin
= 0;
1575 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1577 /* Clear the data request background, but not SAFETY */
1578 rectangle_pixmap(process_list
,
1579 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1581 drawing
->damage_begin
+SAFETY
, 0,
1582 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1584 gtk_widget_queue_draw(drawing
->drawing_area
);
1586 /* Get new data for the rest. */
1587 drawing_data_request(resourceview_data
->drawing
,
1588 drawing
->damage_begin
, 0,
1589 drawing
->damage_end
- drawing
->damage_begin
,
1590 resourceview_data
->drawing
->height
);
1592 if(ltt_time_compare(*ns
,*os
) == -1
1593 && ltt_time_compare(*os
,new_end
) == -1)
1595 g_info("scrolling near left");
1596 /* Scroll left, keep left part of the screen */
1598 guint width
= resourceview_data
->drawing
->width
;
1599 convert_time_to_pixels(
1605 /* Copy old data to new location */
1606 copy_pixmap_region (process_list
,
1608 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1614 if(drawing
->damage_begin
== drawing
->damage_end
)
1615 drawing
->damage_end
= x
;
1617 drawing
->damage_end
=
1618 resourceview_data
->drawing
->width
;
1620 drawing
->damage_begin
= 0;
1622 rectangle_pixmap (process_list
,
1623 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1625 drawing
->damage_begin
, 0,
1626 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1629 gtk_widget_queue_draw(drawing
->drawing_area
);
1631 /* Get new data for the rest. */
1632 drawing_data_request(resourceview_data
->drawing
,
1633 drawing
->damage_begin
, 0,
1634 drawing
->damage_end
- drawing
->damage_begin
,
1635 resourceview_data
->drawing
->height
);
1638 if(ltt_time_compare(*ns
,*os
) == 0)
1640 g_info("not scrolling");
1642 g_info("scrolling far");
1643 /* Cannot reuse any part of the screen : far jump */
1646 rectangle_pixmap (process_list
,
1647 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1650 resourceview_data
->drawing
->width
+SAFETY
, // do not overlap
1653 gtk_widget_queue_draw(drawing
->drawing_area
);
1655 drawing
->damage_begin
= 0;
1656 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1658 drawing_data_request(resourceview_data
->drawing
,
1660 resourceview_data
->drawing
->width
,
1661 resourceview_data
->drawing
->height
);
1667 /* Different scale (zoom) */
1670 rectangle_pixmap (process_list
,
1671 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1674 resourceview_data
->drawing
->width
+SAFETY
, // do not overlap
1677 gtk_widget_queue_draw(drawing
->drawing_area
);
1679 drawing
->damage_begin
= 0;
1680 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1682 drawing_data_request(resourceview_data
->drawing
,
1684 resourceview_data
->drawing
->width
,
1685 resourceview_data
->drawing
->height
);
1688 /* Update directly when scrolling */
1689 gdk_window_process_updates(resourceview_data
->drawing
->drawing_area
->window
,
1695 gint
traceset_notify(void *hook_data
, void *call_data
)
1697 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1698 Drawing_t
*drawing
= resourceview_data
->drawing
;
1700 if(unlikely(drawing
->gc
== NULL
)) {
1703 if(drawing
->dotted_gc
== NULL
) {
1707 drawing_clear(resourceview_data
->drawing
);
1708 processlist_clear(resourceview_data
->process_list
);
1709 gtk_widget_set_size_request(
1710 resourceview_data
->drawing
->drawing_area
,
1711 -1, processlist_get_height(resourceview_data
->process_list
));
1712 redraw_notify(resourceview_data
, NULL
);
1714 request_background_data(resourceview_data
);
1719 gint
redraw_notify(void *hook_data
, void *call_data
)
1721 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1722 Drawing_t
*drawing
= resourceview_data
->drawing
;
1723 GtkWidget
*widget
= drawing
->drawing_area
;
1725 drawing
->damage_begin
= 0;
1726 drawing
->damage_end
= drawing
->width
;
1728 /* fun feature, to be separated someday... */
1729 drawing_clear(resourceview_data
->drawing
);
1730 processlist_clear(resourceview_data
->process_list
);
1731 gtk_widget_set_size_request(
1732 resourceview_data
->drawing
->drawing_area
,
1733 -1, processlist_get_height(resourceview_data
->process_list
));
1735 rectangle_pixmap (resourceview_data
->process_list
,
1736 widget
->style
->black_gc
,
1739 drawing
->alloc_width
,
1742 gtk_widget_queue_draw(drawing
->drawing_area
);
1744 if(drawing
->damage_begin
< drawing
->damage_end
)
1746 drawing_data_request(drawing
,
1747 drawing
->damage_begin
,
1749 drawing
->damage_end
-drawing
->damage_begin
,
1758 gint
continue_notify(void *hook_data
, void *call_data
)
1760 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1761 Drawing_t
*drawing
= resourceview_data
->drawing
;
1763 if(drawing
->damage_begin
< drawing
->damage_end
)
1765 drawing_data_request(drawing
,
1766 drawing
->damage_begin
,
1768 drawing
->damage_end
-drawing
->damage_begin
,
1776 gint
update_current_time_hook(void *hook_data
, void *call_data
)
1778 ControlFlowData
*resourceview_data
= (ControlFlowData
*)hook_data
;
1780 LttTime current_time
= *((LttTime
*)call_data
);
1782 TimeWindow time_window
=
1783 lttvwindow_get_time_window(resourceview_data
->tab
);
1785 LttTime time_begin
= time_window
.start_time
;
1786 LttTime width
= time_window
.time_width
;
1789 guint64 time_ll
= ltt_time_to_uint64(width
);
1790 time_ll
= time_ll
>> 1; /* divide by two */
1791 half_width
= ltt_time_from_uint64(time_ll
);
1793 LttTime time_end
= ltt_time_add(time_begin
, width
);
1795 LttvTracesetContext
* tsc
=
1796 lttvwindow_get_traceset_context(resourceview_data
->tab
);
1798 LttTime trace_start
= tsc
->time_span
.start_time
;
1799 LttTime trace_end
= tsc
->time_span
.end_time
;
1801 g_info("New current time HOOK : %lu, %lu", current_time
.tv_sec
,
1802 current_time
.tv_nsec
);
1804 /* If current time is inside time interval, just move the highlight
1807 /* Else, we have to change the time interval. We have to tell it
1808 * to the main window. */
1809 /* The time interval change will take care of placing the current
1810 * time at the center of the visible area, or nearest possible if we are
1811 * at one end of the trace. */
1814 if(ltt_time_compare(current_time
, time_begin
) < 0)
1816 TimeWindow new_time_window
;
1818 if(ltt_time_compare(current_time
,
1819 ltt_time_add(trace_start
,half_width
)) < 0)
1820 time_begin
= trace_start
;
1822 time_begin
= ltt_time_sub(current_time
,half_width
);
1824 new_time_window
.start_time
= time_begin
;
1825 new_time_window
.time_width
= width
;
1826 new_time_window
.time_width_double
= ltt_time_to_double(width
);
1827 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
1829 lttvwindow_report_time_window(resourceview_data
->tab
, new_time_window
);
1831 else if(ltt_time_compare(current_time
, time_end
) > 0)
1833 TimeWindow new_time_window
;
1835 if(ltt_time_compare(current_time
, ltt_time_sub(trace_end
, half_width
)) > 0)
1836 time_begin
= ltt_time_sub(trace_end
,width
);
1838 time_begin
= ltt_time_sub(current_time
,half_width
);
1840 new_time_window
.start_time
= time_begin
;
1841 new_time_window
.time_width
= width
;
1842 new_time_window
.time_width_double
= ltt_time_to_double(width
);
1843 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
1845 lttvwindow_report_time_window(resourceview_data
->tab
, new_time_window
);
1848 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
1850 /* Update directly when scrolling */
1851 gdk_window_process_updates(resourceview_data
->drawing
->drawing_area
->window
,
1857 typedef struct _ClosureData
{
1858 EventsRequest
*events_request
;
1859 LttvTracesetState
*tss
;
1864 /* Draw line until end of the screen */
1866 void draw_closure(gpointer key
, gpointer value
, gpointer user_data
)
1868 ResourceUniqueNumeric
*process_info
= (ResourceUniqueNumeric
*)key
;
1869 HashedResourceData
*hashed_process_data
= (HashedResourceData
*)value
;
1870 ClosureData
*closure_data
= (ClosureData
*)user_data
;
1872 EventsRequest
*events_request
= closure_data
->events_request
;
1873 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1875 LttvTracesetState
*tss
= closure_data
->tss
;
1876 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)tss
;
1878 LttTime evtime
= closure_data
->end_time
;
1880 gboolean dodraw
= TRUE
;
1882 if(hashed_process_data
->type
== RV_RESOURCE_MACHINE
)
1886 /* For the process */
1887 /* First, check if the current process is in the state computation
1888 * process list. If it is there, that means we must add it right now and
1889 * draw items from the beginning of the read for it. If it is not
1890 * present, it's a new process and it was not present : it will
1891 * be added after the state update. */
1893 g_assert(lttv_traceset_number(tsc
->ts
) > 0);
1894 #endif //EXTRA_CHECK
1895 LttvTraceContext
*tc
= tsc
->traces
[process_info
->trace_num
];
1896 LttvTraceState
*ts
= (LttvTraceState
*)tc
;
1898 /* Only draw for processes that are currently in the trace states */
1901 /* Should be alike when background info is ready */
1902 if(resourceview_data
->background_info_waiting
==0)
1903 g_assert(ltt_time_compare(process
->creation_time
,
1904 process_info
->birth
) == 0);
1905 #endif //EXTRA_CHECK
1907 /* Now, the process is in the state hash and our own process hash.
1908 * We definitely can draw the items related to the ending state.
1911 if(unlikely(ltt_time_compare(hashed_process_data
->next_good_time
,
1914 TimeWindow time_window
=
1915 lttvwindow_get_time_window(resourceview_data
->tab
);
1918 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1919 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1921 #endif //EXTRA_CHECK
1922 Drawing_t
*drawing
= resourceview_data
->drawing
;
1923 guint width
= drawing
->width
;
1925 guint x
= closure_data
->x_end
;
1927 DrawContext draw_context
;
1929 /* Now create the drawing context that will be used to draw
1930 * items related to the last state. */
1931 draw_context
.drawable
= hashed_process_data
->pixmap
;
1932 draw_context
.gc
= drawing
->gc
;
1933 draw_context
.pango_layout
= drawing
->pango_layout
;
1934 draw_context
.drawinfo
.end
.x
= x
;
1936 draw_context
.drawinfo
.y
.over
= 1;
1937 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1938 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1940 draw_context
.drawinfo
.start
.offset
.over
= 0;
1941 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1942 draw_context
.drawinfo
.start
.offset
.under
= 0;
1943 draw_context
.drawinfo
.end
.offset
.over
= 0;
1944 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1945 draw_context
.drawinfo
.end
.offset
.under
= 0;
1947 /* Jump over draw if we are at the same x position */
1948 if(x
== hashed_process_data
->x
.over
)
1952 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.over
;
1954 PropertiesLine prop_line
= prepare_execmode_line(process
);
1955 draw_line((void*)&prop_line
, (void*)&draw_context
);
1957 hashed_process_data
->x
.over
= x
;
1961 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1962 hashed_process_data
->x
.middle_used
)) {
1963 #if 0 /* do not mark closure : not missing information */
1964 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
1965 /* Draw collision indicator */
1966 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1967 gdk_draw_point(drawing
->pixmap
,
1971 hashed_process_data
->x
.middle_marked
= TRUE
;
1976 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1979 PropertiesLine prop_line
;
1980 prop_line
.line_width
= STATE_LINE_WIDTH
;
1981 prop_line
.style
= GDK_LINE_SOLID
;
1982 prop_line
.y
= MIDDLE
;
1983 if(hashed_process_data
->type
== RV_RESOURCE_CPU
)
1984 cpu_set_line_color(&prop_line
, &ts
->cpu_states
[process_info
->id
]);
1985 else if(hashed_process_data
->type
== RV_RESOURCE_IRQ
)
1986 irq_set_line_color(&prop_line
, &ts
->irq_states
[process_info
->id
]);
1987 else if(hashed_process_data
->type
== RV_RESOURCE_SOFT_IRQ
)
1988 soft_irq_set_line_color(&prop_line
, &ts
->soft_irq_states
[process_info
->id
]);
1989 else if(hashed_process_data
->type
== RV_RESOURCE_TRAP
)
1990 trap_set_line_color(&prop_line
, &ts
->trap_states
[process_info
->id
]);
1991 else if(hashed_process_data
->type
== RV_RESOURCE_BDEV
) {
1992 gint devcode_gint
= process_info
->id
;
1993 LttvBdevState
*bdev
= g_hash_table_lookup(ts
->bdev_states
, &devcode_gint
);
1994 // the lookup may return null; bdev_set_line_color must act appropriately
1995 bdev_set_line_color(&prop_line
, bdev
);
1998 draw_line((void*)&prop_line
, (void*)&draw_context
);
2001 /* become the last x position */
2002 if(likely(x
!= hashed_process_data
->x
.middle
)) {
2003 hashed_process_data
->x
.middle
= x
;
2004 /* but don't use the pixel */
2005 hashed_process_data
->x
.middle_used
= FALSE
;
2007 /* Calculate the next good time */
2008 convert_pixels_to_time(width
, x
+1, time_window
,
2009 &hashed_process_data
->next_good_time
);
2016 int before_chunk(void *hook_data
, void *call_data
)
2018 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2019 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2021 /* Deactivate sort */
2022 gtk_tree_sortable_set_sort_column_id(
2023 GTK_TREE_SORTABLE(cfd
->process_list
->list_store
),
2025 GTK_SORT_ASCENDING
);
2027 drawing_chunk_begin(events_request
, tss
);
2034 * This gets executed just before an events request is executed
2037 int before_request(void *hook_data
, void *call_data
)
2039 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2040 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2042 drawing_data_request_begin(events_request
, tss
);
2049 * after request is necessary in addition of after chunk in order to draw
2050 * lines until the end of the screen. after chunk just draws lines until
2057 int after_request(void *hook_data
, void *call_data
)
2060 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2061 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2062 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2064 LttTime end_time
= events_request
->end_time
;
2066 ClosureData closure_data
;
2067 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2068 closure_data
.tss
= tss
;
2069 closure_data
.end_time
= end_time
;
2071 TimeWindow time_window
=
2072 lttvwindow_get_time_window(resourceview_data
->tab
);
2073 guint width
= resourceview_data
->drawing
->width
;
2074 convert_time_to_pixels(
2078 &closure_data
.x_end
);
2081 /* Draw last items */
2082 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2083 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2084 (void*)&closure_data
);
2087 /* Request expose */
2088 drawing_request_expose(events_request
, tss
, end_time
);
2097 int after_chunk(void *hook_data
, void *call_data
)
2099 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2100 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2101 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2102 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)call_data
;
2103 LttvTracefileContext
*tfc
= lttv_traceset_context_get_current_tfc(tsc
);
2106 ProcessList
*process_list
= resourceview_data
->process_list
;
2108 LttvTraceset
*traceset
= tsc
->ts
;
2109 guint nb_trace
= lttv_traceset_number(traceset
);
2111 /* Only execute when called for the first trace's events request */
2112 if(!process_list
->current_hash_data
)
2115 for(i
= 0 ; i
< nb_trace
; i
++) {
2116 g_free(process_list
->current_hash_data
[i
]);
2118 g_free(process_list
->current_hash_data
);
2119 process_list
->current_hash_data
= NULL
;
2122 end_time
= LTT_TIME_MIN(tfc
->timestamp
, events_request
->end_time
);
2123 else /* end of traceset, or position now out of request : end */
2124 end_time
= events_request
->end_time
;
2126 ClosureData closure_data
;
2127 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2128 closure_data
.tss
= tss
;
2129 closure_data
.end_time
= end_time
;
2131 TimeWindow time_window
=
2132 lttvwindow_get_time_window(resourceview_data
->tab
);
2133 guint width
= resourceview_data
->drawing
->width
;
2134 convert_time_to_pixels(
2138 &closure_data
.x_end
);
2140 /* Draw last items */
2141 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2142 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2143 (void*)&closure_data
);
2146 /* Reactivate sort */
2147 gtk_tree_sortable_set_sort_column_id(
2148 GTK_TREE_SORTABLE(resourceview_data
->process_list
->list_store
),
2149 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2150 GTK_SORT_ASCENDING
);
2152 update_index_to_pixmap(resourceview_data
->process_list
);
2153 /* Request a full expose : drawing scrambled */
2154 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
2156 /* Request expose (updates damages zone also) */
2157 drawing_request_expose(events_request
, tss
, end_time
);
2162 /* after_statedump_end
2164 * @param hook_data ControlFlowData structure of the viewer.
2165 * @param call_data Event context.
2167 * This function adds items to be drawn in a queue for each process.
2170 int before_statedump_end(void *hook_data
, void *call_data
)
2174 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
2175 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
2176 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2178 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
2180 LttvTracesetState
*tss
= (LttvTracesetState
*)tfc
->t_context
->ts_context
;
2183 e
= ltt_tracefile_get_event(tfc
->tf
);
2185 LttvFilter
*filter
= resourceview_data
->filter
;
2186 if(filter
!= NULL
&& filter
->head
!= NULL
)
2187 if(!lttv_filter_tree_parse(filter
->head
,e
,tfc
->tf
,
2188 tfc
->t_context
->t
,tfc
,NULL
,NULL
))
2191 LttTime evtime
= ltt_event_time(e
);
2193 ClosureData closure_data
;
2194 closure_data
.events_request
= events_request
;
2195 closure_data
.tss
= tss
;
2196 closure_data
.end_time
= evtime
;
2198 TimeWindow time_window
=
2199 lttvwindow_get_time_window(resourceview_data
->tab
);
2200 guint width
= resourceview_data
->drawing
->width
;
2201 convert_time_to_pixels(
2205 &closure_data
.x_end
);
2207 /* Draw last items */
2209 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2210 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2211 (void*)&closure_data
);
2214 /* Reactivate sort */
2215 gtk_tree_sortable_set_sort_column_id(
2216 GTK_TREE_SORTABLE(resourceview_data
->process_list
->list_store
),
2217 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2218 GTK_SORT_ASCENDING
);
2220 update_index_to_pixmap(resourceview_data
->process_list
);
2221 /* Request a full expose : drawing scrambled */
2222 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
2224 /* Request expose (updates damages zone also) */
2225 drawing_request_expose(events_request
, tss
, evtime
);