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>
64 #include <ltt/trace.h>
66 #include <lttv/lttv.h>
67 #include <lttv/hook.h>
68 #include <lttv/state.h>
69 #include <lttvwindow/lttvwindow.h>
70 #include <lttvwindow/lttvwindowtraces.h>
71 #include <lttvwindow/support.h>
74 #include "eventhooks.h"
76 #include "processlist.h"
80 #define MAX_PATH_LEN 256
81 #define STATE_LINE_WIDTH 6
82 #define COLLISION_POSITION(height) (((height - STATE_LINE_WIDTH)/2) -3)
84 extern GSList
*g_legend_list
;
87 /* Action to do when background computation completed.
89 * Wait for all the awaited computations to be over.
92 static gint
background_ready(void *hook_data
, void *call_data
)
94 ControlFlowData
*resourceview_data
= (ControlFlowData
*)hook_data
;
95 LttvTrace
*trace
= (LttvTrace
*)call_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 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
259 guint
*event_number
= (guint
*) call_data
;
261 g_debug("DEBUG : event selected by main window : %u", *event_number
);
266 static void cpu_set_line_color(PropertiesLine
*prop_line
, LttvCPUState
*s
)
268 GQuark present_state
;
270 if(s
->mode_stack
->len
== 0)
271 present_state
= LTTV_CPU_UNKNOWN
;
273 present_state
= ((GQuark
*)s
->mode_stack
->data
)[s
->mode_stack
->len
-1];
275 if(present_state
== LTTV_CPU_IDLE
) {
276 prop_line
->color
= drawing_colors_cpu
[COL_CPU_IDLE
];
278 else if(present_state
== LTTV_CPU_BUSY
) {
279 prop_line
->color
= drawing_colors_cpu
[COL_CPU_BUSY
];
281 else if(present_state
== LTTV_CPU_IRQ
) {
282 prop_line
->color
= drawing_colors_cpu
[COL_CPU_IRQ
];
284 else if(present_state
== LTTV_CPU_SOFT_IRQ
) {
285 prop_line
->color
= drawing_colors_cpu
[COL_CPU_SOFT_IRQ
];
287 else if(present_state
== LTTV_CPU_TRAP
) {
288 prop_line
->color
= drawing_colors_cpu
[COL_CPU_TRAP
];
290 prop_line
->color
= drawing_colors_cpu
[COL_CPU_UNKNOWN
];
294 static void irq_set_line_color(PropertiesLine
*prop_line
, LttvIRQState
*s
)
296 GQuark present_state
;
297 if(s
->mode_stack
->len
== 0)
298 present_state
= LTTV_IRQ_UNKNOWN
;
300 present_state
= ((GQuark
*)s
->mode_stack
->data
)[s
->mode_stack
->len
-1];
302 if(present_state
== LTTV_IRQ_IDLE
) {
303 prop_line
->color
= drawing_colors_irq
[COL_IRQ_IDLE
];
305 else if(present_state
== LTTV_IRQ_BUSY
) {
306 prop_line
->color
= drawing_colors_irq
[COL_IRQ_BUSY
];
309 prop_line
->color
= drawing_colors_irq
[COL_IRQ_UNKNOWN
];
313 static void soft_irq_set_line_color(PropertiesLine
*prop_line
, LttvSoftIRQState
*s
)
315 GQuark present_state
;
317 prop_line
->color
= drawing_colors_soft_irq
[COL_SOFT_IRQ_BUSY
];
319 prop_line
->color
= drawing_colors_soft_irq
[COL_SOFT_IRQ_PENDING
];
321 prop_line
->color
= drawing_colors_soft_irq
[COL_SOFT_IRQ_IDLE
];
324 static void trap_set_line_color(PropertiesLine
*prop_line
, LttvTrapState
*s
)
326 GQuark present_state
;
328 prop_line
->color
= drawing_colors_trap
[COL_TRAP_IDLE
];
330 prop_line
->color
= drawing_colors_trap
[COL_TRAP_BUSY
];
333 static void bdev_set_line_color(PropertiesLine
*prop_line
, LttvBdevState
*s
)
335 GQuark present_state
;
336 if(s
== 0 || s
->mode_stack
->len
== 0)
337 present_state
= LTTV_BDEV_UNKNOWN
;
339 present_state
= ((GQuark
*)s
->mode_stack
->data
)[s
->mode_stack
->len
-1];
341 if(present_state
== LTTV_BDEV_IDLE
) {
342 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_IDLE
];
344 else if(present_state
== LTTV_BDEV_BUSY_READING
) {
345 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_BUSY_READING
];
347 else if(present_state
== LTTV_BDEV_BUSY_WRITING
) {
348 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_BUSY_WRITING
];
351 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_UNKNOWN
];
355 /* before_schedchange_hook
357 * This function basically draw lines and icons. Two types of lines are drawn :
358 * one small (3 pixels?) representing the state of the process and the second
359 * type is thicker (10 pixels?) representing on which CPU a process is running
360 * (and this only in running state).
362 * Extremums of the lines :
363 * x_min : time of the last event context for this process kept in memory.
364 * x_max : time of the current event.
365 * y : middle of the process in the process list. The process is found in the
366 * list, therefore is it's position in pixels.
368 * The choice of lines'color is defined by the context of the last event for this
373 int before_schedchange_hook(void *hook_data
, void *call_data
)
375 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
376 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
377 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
379 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
381 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
382 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
385 e
= ltt_tracefile_get_event(tfc
->tf
);
386 gint target_pid_saved
= tfc
->target_pid
;
388 LttTime evtime
= ltt_event_time(e
);
389 LttvFilter
*filter
= resourceview_data
->filter
;
391 /* we are in a schedchange, before the state update. We must draw the
392 * items corresponding to the state before it changes : now is the right
398 pid_out
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
399 pid_in
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
400 // TODO: can't we reenable this? pmf
401 // if(pid_in != 0 && pid_out != 0) {
402 // /* not a transition to/from idle */
406 tfc
->target_pid
= pid_out
;
408 guint cpu
= tfs
->cpu
;
410 guint trace_num
= ts
->parent
.index
;
411 /* Add process to process list (if not present) */
413 HashedResourceData
*hashed_process_data
= NULL
;
414 ProcessList
*process_list
= resourceview_data
->process_list
;
416 hashed_process_data
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
418 /* Now, the process is in the state hash and our own process hash.
419 * We definitely can draw the items related to the ending state.
422 if(ltt_time_compare(hashed_process_data
->next_good_time
,
425 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
427 TimeWindow time_window
=
428 lttvwindow_get_time_window(resourceview_data
->tab
);
430 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
431 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
434 Drawing_t
*drawing
= resourceview_data
->drawing
;
435 guint width
= drawing
->width
;
437 convert_time_to_pixels(
443 /* Draw collision indicator */
444 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
445 gdk_draw_point(hashed_process_data
->pixmap
,
448 COLLISION_POSITION(hashed_process_data
->height
));
449 hashed_process_data
->x
.middle_marked
= TRUE
;
452 TimeWindow time_window
=
453 lttvwindow_get_time_window(resourceview_data
->tab
);
455 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
456 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
459 Drawing_t
*drawing
= resourceview_data
->drawing
;
460 guint width
= drawing
->width
;
462 convert_time_to_pixels(
468 /* Jump over draw if we are at the same x position */
469 if(x
== hashed_process_data
->x
.middle
&&
470 hashed_process_data
->x
.middle_used
)
472 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
473 /* Draw collision indicator */
474 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
475 gdk_draw_point(hashed_process_data
->pixmap
,
478 COLLISION_POSITION(hashed_process_data
->height
));
479 hashed_process_data
->x
.middle_marked
= TRUE
;
483 DrawContext draw_context
;
485 /* Now create the drawing context that will be used to draw
486 * items related to the last state. */
487 draw_context
.drawable
= hashed_process_data
->pixmap
;
488 draw_context
.gc
= drawing
->gc
;
489 draw_context
.pango_layout
= drawing
->pango_layout
;
490 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
491 draw_context
.drawinfo
.end
.x
= x
;
493 draw_context
.drawinfo
.y
.over
= 1;
494 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
495 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
497 draw_context
.drawinfo
.start
.offset
.over
= 0;
498 draw_context
.drawinfo
.start
.offset
.middle
= 0;
499 draw_context
.drawinfo
.start
.offset
.under
= 0;
500 draw_context
.drawinfo
.end
.offset
.over
= 0;
501 draw_context
.drawinfo
.end
.offset
.middle
= 0;
502 draw_context
.drawinfo
.end
.offset
.under
= 0;
506 //PropertiesLine prop_line = prepare_s_e_line(process);
507 PropertiesLine prop_line
;
508 prop_line
.line_width
= STATE_LINE_WIDTH
;
509 prop_line
.style
= GDK_LINE_SOLID
;
510 prop_line
.y
= MIDDLE
;
511 cpu_set_line_color(&prop_line
, tfs
->cpu_state
);
512 draw_line((void*)&prop_line
, (void*)&draw_context
);
515 /* become the last x position */
516 hashed_process_data
->x
.middle
= x
;
517 hashed_process_data
->x
.middle_used
= TRUE
;
518 hashed_process_data
->x
.middle_marked
= FALSE
;
520 /* Calculate the next good time */
521 convert_pixels_to_time(width
, x
+1, time_window
,
522 &hashed_process_data
->next_good_time
);
529 /* after_schedchange_hook
531 * The draw after hook is called by the reading API to have a
532 * particular event drawn on the screen.
533 * @param hook_data ControlFlowData structure of the viewer.
534 * @param call_data Event context.
536 * This function adds items to be drawn in a queue for each process.
539 int after_schedchange_hook(void *hook_data
, void *call_data
)
541 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
542 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
543 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
544 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
545 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
546 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
549 e
= ltt_tracefile_get_event(tfc
->tf
);
551 LttvFilter
*filter
= resourceview_data
->filter
;
552 if(filter
!= NULL
&& filter
->head
!= NULL
)
553 if(!lttv_filter_tree_parse(filter
->head
,e
,tfc
->tf
,
554 tfc
->t_context
->t
,tfc
,NULL
,NULL
))
557 LttTime evtime
= ltt_event_time(e
);
559 /* Add process to process list (if not present) */
560 LttvProcessState
*process_in
;
563 HashedResourceData
*hashed_process_data_in
= NULL
;
565 ProcessList
*process_list
= resourceview_data
->process_list
;
570 pid_out
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
571 pid_in
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
575 /* Find process pid_in in the list... */
576 //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
577 //process_in = tfs->process;
578 guint cpu
= tfs
->cpu
;
579 guint trace_num
= ts
->parent
.index
;
580 process_in
= ts
->running_process
[cpu
];
581 /* It should exist, because we are after the state update. */
583 g_assert(process_in
!= NULL
);
585 birth
= process_in
->creation_time
;
587 //hashed_process_data_in = processlist_get_process_data(process_list, cpuq, trace_num);
588 hashed_process_data_in
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
590 /* Set the current process */
591 process_list
->current_hash_data
[trace_num
][process_in
->cpu
] =
592 hashed_process_data_in
;
594 if(ltt_time_compare(hashed_process_data_in
->next_good_time
,
597 TimeWindow time_window
=
598 lttvwindow_get_time_window(resourceview_data
->tab
);
601 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
602 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
605 Drawing_t
*drawing
= resourceview_data
->drawing
;
606 guint width
= drawing
->width
;
609 convert_time_to_pixels(
615 if(hashed_process_data_in
->x
.middle
!= new_x
) {
616 hashed_process_data_in
->x
.middle
= new_x
;
617 hashed_process_data_in
->x
.middle_used
= FALSE
;
618 hashed_process_data_in
->x
.middle_marked
= FALSE
;
624 /* before_execmode_hook
626 * This function basically draw lines and icons. Two types of lines are drawn :
627 * one small (3 pixels?) representing the state of the process and the second
628 * type is thicker (10 pixels?) representing on which CPU a process is running
629 * (and this only in running state).
631 * Extremums of the lines :
632 * x_min : time of the last event context for this process kept in memory.
633 * x_max : time of the current event.
634 * y : middle of the process in the process list. The process is found in the
635 * list, therefore is it's position in pixels.
637 * The choice of lines'color is defined by the context of the last event for this
641 int before_execmode_hook(void *hook_data
, void *call_data
)
643 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
644 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
645 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
647 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
649 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
650 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
653 e
= ltt_tracefile_get_event(tfc
->tf
);
655 LttTime evtime
= ltt_event_time(e
);
657 before_execmode_hook_irq(hook_data
, call_data
);
658 before_execmode_hook_soft_irq(hook_data
, call_data
);
659 before_execmode_hook_trap(hook_data
, call_data
);
661 /* we are in a execmode, before the state update. We must draw the
662 * items corresponding to the state before it changes : now is the right
666 guint cpu
= tfs
->cpu
;
668 guint trace_num
= ts
->parent
.index
;
669 LttvProcessState
*process
= ts
->running_process
[cpu
];
670 g_assert(process
!= NULL
);
672 /* Well, the process_out existed : we must get it in the process hash
673 * or add it, and draw its items.
675 /* Add process to process list (if not present) */
677 HashedResourceData
*hashed_process_data
= NULL
;
678 ProcessList
*process_list
= resourceview_data
->process_list
;
680 LttTime birth
= process
->creation_time
;
682 if(likely(process_list
->current_hash_data
[trace_num
][cpu
] != NULL
)) {
683 hashed_process_data
= process_list
->current_hash_data
[trace_num
][cpu
];
685 hashed_process_data
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
687 /* Set the current process */
688 process_list
->current_hash_data
[trace_num
][process
->cpu
] =
692 /* Now, the process is in the state hash and our own process hash.
693 * We definitely can draw the items related to the ending state.
696 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
699 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
700 TimeWindow time_window
=
701 lttvwindow_get_time_window(resourceview_data
->tab
);
704 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
705 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
708 Drawing_t
*drawing
= resourceview_data
->drawing
;
709 guint width
= drawing
->width
;
711 convert_time_to_pixels(
717 /* Draw collision indicator */
718 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
719 gdk_draw_point(hashed_process_data
->pixmap
,
722 COLLISION_POSITION(hashed_process_data
->height
));
723 hashed_process_data
->x
.middle_marked
= TRUE
;
727 TimeWindow time_window
=
728 lttvwindow_get_time_window(resourceview_data
->tab
);
731 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
732 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
735 Drawing_t
*drawing
= resourceview_data
->drawing
;
736 guint width
= drawing
->width
;
739 convert_time_to_pixels(
746 /* Jump over draw if we are at the same x position */
747 if(unlikely(x
== hashed_process_data
->x
.middle
&&
748 hashed_process_data
->x
.middle_used
))
750 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
751 /* Draw collision indicator */
752 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
753 gdk_draw_point(hashed_process_data
->pixmap
,
756 COLLISION_POSITION(hashed_process_data
->height
));
757 hashed_process_data
->x
.middle_marked
= TRUE
;
763 DrawContext draw_context
;
764 /* Now create the drawing context that will be used to draw
765 * items related to the last state. */
766 draw_context
.drawable
= hashed_process_data
->pixmap
;
767 draw_context
.gc
= drawing
->gc
;
768 draw_context
.pango_layout
= drawing
->pango_layout
;
769 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
770 draw_context
.drawinfo
.end
.x
= x
;
772 draw_context
.drawinfo
.y
.over
= 1;
773 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
774 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
776 draw_context
.drawinfo
.start
.offset
.over
= 0;
777 draw_context
.drawinfo
.start
.offset
.middle
= 0;
778 draw_context
.drawinfo
.start
.offset
.under
= 0;
779 draw_context
.drawinfo
.end
.offset
.over
= 0;
780 draw_context
.drawinfo
.end
.offset
.middle
= 0;
781 draw_context
.drawinfo
.end
.offset
.under
= 0;
785 PropertiesLine prop_line
;
786 prop_line
.line_width
= STATE_LINE_WIDTH
;
787 prop_line
.style
= GDK_LINE_SOLID
;
788 prop_line
.y
= MIDDLE
;
789 cpu_set_line_color(&prop_line
, tfs
->cpu_state
);
790 draw_line((void*)&prop_line
, (void*)&draw_context
);
792 /* become the last x position */
793 hashed_process_data
->x
.middle
= x
;
794 hashed_process_data
->x
.middle_used
= TRUE
;
795 hashed_process_data
->x
.middle_marked
= FALSE
;
797 /* Calculate the next good time */
798 convert_pixels_to_time(width
, x
+1, time_window
,
799 &hashed_process_data
->next_good_time
);
806 int before_execmode_hook_irq(void *hook_data
, void *call_data
)
808 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
809 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
810 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
812 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
814 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
815 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
818 e
= ltt_tracefile_get_event(tfc
->tf
);
820 LttTime evtime
= ltt_event_time(e
);
822 LttTrace
*trace
= tfc
->t_context
->t
;
824 /* we are in a execmode, before the state update. We must draw the
825 * items corresponding to the state before it changes : now is the right
831 guint cpu
= tfs
->cpu
;
833 guint16 ev_id_entry
= marker_get_id_from_info(trace
, marker_get_info_from_name(trace
, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL
, LTT_EVENT_IRQ_ENTRY
)));
834 guint16 ev_id_exit
= marker_get_id_from_info(trace
, marker_get_info_from_name(trace
, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL
, LTT_EVENT_IRQ_EXIT
)));
835 if(ev_id_entry
== e
->event_id
) {
836 irq
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
838 else if(ev_id_exit
== e
->event_id
) {
839 irq
= ts
->cpu_states
[cpu
].last_irq
;
845 guint trace_num
= ts
->parent
.index
;
847 /* Well, the process_out existed : we must get it in the process hash
848 * or add it, and draw its items.
850 /* Add process to process list (if not present) */
852 HashedResourceData
*hashed_process_data
= NULL
;
853 ProcessList
*process_list
= resourceview_data
->process_list
;
855 hashed_process_data
= resourcelist_obtain_irq(resourceview_data
, trace_num
, irq
);
856 // TODO: fix this, it's ugly and slow:
860 str
= g_strdup_printf("IRQ %llu [%s]", irq
, (char*)g_quark_to_string(ts
->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
;
992 e
= ltt_tracefile_get_event(tfc
->tf
);
994 LttTime evtime
= ltt_event_time(e
);
996 LttTrace
*trace
= tfc
->t_context
->t
;
998 /* we are in a execmode, before the state update. We must draw the
999 * items corresponding to the state before it changes : now is the right
1005 guint cpu
= tfs
->cpu
;
1007 guint16 ev_id_raise
= marker_get_id_from_info(trace
, marker_get_info_from_name(trace
, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL
, LTT_EVENT_SOFT_IRQ_RAISE
)));
1008 guint16 ev_id_entry
= marker_get_id_from_info(trace
, marker_get_info_from_name(trace
, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL
, LTT_EVENT_SOFT_IRQ_ENTRY
)));
1009 guint16 ev_id_exit
= marker_get_id_from_info(trace
, marker_get_info_from_name(trace
, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL
, LTT_EVENT_SOFT_IRQ_EXIT
)));
1010 if(ev_id_entry
== e
->event_id
|| ev_id_raise
== e
->event_id
) {
1011 softirq
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1013 else if(ev_id_exit
== e
->event_id
) {
1014 softirq
= ts
->cpu_states
[cpu
].last_soft_irq
;
1020 guint trace_num
= ts
->parent
.index
;
1022 /* Well, the process_out existed : we must get it in the process hash
1023 * or add it, and draw its items.
1025 /* Add process to process list (if not present) */
1026 guint pl_height
= 0;
1027 HashedResourceData
*hashed_process_data
= NULL
;
1028 ProcessList
*process_list
= resourceview_data
->process_list
;
1030 hashed_process_data
= resourcelist_obtain_soft_irq(resourceview_data
, trace_num
, softirq
);
1032 /* Now, the process is in the state hash and our own process hash.
1033 * We definitely can draw the items related to the ending state.
1036 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1039 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1040 TimeWindow time_window
=
1041 lttvwindow_get_time_window(resourceview_data
->tab
);
1044 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1045 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1047 #endif //EXTRA_CHECK
1048 Drawing_t
*drawing
= resourceview_data
->drawing
;
1049 guint width
= drawing
->width
;
1051 convert_time_to_pixels(
1057 /* Draw collision indicator */
1058 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1059 gdk_draw_point(hashed_process_data
->pixmap
,
1062 COLLISION_POSITION(hashed_process_data
->height
));
1063 hashed_process_data
->x
.middle_marked
= TRUE
;
1067 TimeWindow time_window
=
1068 lttvwindow_get_time_window(resourceview_data
->tab
);
1071 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1072 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1074 #endif //EXTRA_CHECK
1075 Drawing_t
*drawing
= resourceview_data
->drawing
;
1076 guint width
= drawing
->width
;
1079 convert_time_to_pixels(
1086 /* Jump over draw if we are at the same x position */
1087 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1088 hashed_process_data
->x
.middle_used
))
1090 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1091 /* Draw collision indicator */
1092 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1093 gdk_draw_point(hashed_process_data
->pixmap
,
1096 COLLISION_POSITION(hashed_process_data
->height
));
1097 hashed_process_data
->x
.middle_marked
= TRUE
;
1103 DrawContext draw_context
;
1104 /* Now create the drawing context that will be used to draw
1105 * items related to the last state. */
1106 draw_context
.drawable
= hashed_process_data
->pixmap
;
1107 draw_context
.gc
= drawing
->gc
;
1108 draw_context
.pango_layout
= drawing
->pango_layout
;
1109 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1110 draw_context
.drawinfo
.end
.x
= x
;
1112 draw_context
.drawinfo
.y
.over
= 1;
1113 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1114 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1116 draw_context
.drawinfo
.start
.offset
.over
= 0;
1117 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1118 draw_context
.drawinfo
.start
.offset
.under
= 0;
1119 draw_context
.drawinfo
.end
.offset
.over
= 0;
1120 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1121 draw_context
.drawinfo
.end
.offset
.under
= 0;
1125 PropertiesLine prop_line
;
1126 prop_line
.line_width
= STATE_LINE_WIDTH
;
1127 prop_line
.style
= GDK_LINE_SOLID
;
1128 prop_line
.y
= MIDDLE
;
1129 soft_irq_set_line_color(&prop_line
, &ts
->soft_irq_states
[softirq
]);
1130 draw_line((void*)&prop_line
, (void*)&draw_context
);
1132 /* become the last x position */
1133 hashed_process_data
->x
.middle
= x
;
1134 hashed_process_data
->x
.middle_used
= TRUE
;
1135 hashed_process_data
->x
.middle_marked
= FALSE
;
1137 /* Calculate the next good time */
1138 convert_pixels_to_time(width
, x
+1, time_window
,
1139 &hashed_process_data
->next_good_time
);
1146 int before_execmode_hook_trap(void *hook_data
, void *call_data
)
1148 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
1149 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
1150 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1152 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1154 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1155 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1158 e
= ltt_tracefile_get_event(tfc
->tf
);
1160 LttTime evtime
= ltt_event_time(e
);
1162 LttTrace
*trace
= tfc
->t_context
->t
;
1164 /* we are in a execmode, before the state update. We must draw the
1165 * items corresponding to the state before it changes : now is the right
1171 guint cpu
= tfs
->cpu
;
1173 guint16 ev_id_entry
= marker_get_id_from_info(trace
, marker_get_info_from_name(trace
, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL_ARCH
, LTT_EVENT_TRAP_ENTRY
)));
1174 guint16 ev_id_exit
= marker_get_id_from_info(trace
, marker_get_info_from_name(trace
, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL_ARCH
, LTT_EVENT_TRAP_EXIT
)));
1175 if(ev_id_entry
== e
->event_id
) {
1176 trap
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1178 else if(ev_id_exit
== e
->event_id
) {
1179 trap
= ts
->cpu_states
[cpu
].last_trap
;
1185 guint trace_num
= ts
->parent
.index
;
1187 /* Well, the process_out existed : we must get it in the process hash
1188 * or add it, and draw its items.
1190 /* Add process to process list (if not present) */
1191 guint pl_height
= 0;
1192 HashedResourceData
*hashed_process_data
= NULL
;
1193 ProcessList
*process_list
= resourceview_data
->process_list
;
1195 hashed_process_data
= resourcelist_obtain_trap(resourceview_data
, trace_num
, trap
);
1197 /* Now, the process is in the state hash and our own process hash.
1198 * We definitely can draw the items related to the ending state.
1201 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1204 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1205 TimeWindow time_window
=
1206 lttvwindow_get_time_window(resourceview_data
->tab
);
1209 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1210 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1212 #endif //EXTRA_CHECK
1213 Drawing_t
*drawing
= resourceview_data
->drawing
;
1214 guint width
= drawing
->width
;
1216 convert_time_to_pixels(
1222 /* Draw collision indicator */
1223 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1224 gdk_draw_point(hashed_process_data
->pixmap
,
1227 COLLISION_POSITION(hashed_process_data
->height
));
1228 hashed_process_data
->x
.middle_marked
= TRUE
;
1232 TimeWindow time_window
=
1233 lttvwindow_get_time_window(resourceview_data
->tab
);
1236 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1237 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1239 #endif //EXTRA_CHECK
1240 Drawing_t
*drawing
= resourceview_data
->drawing
;
1241 guint width
= drawing
->width
;
1244 convert_time_to_pixels(
1251 /* Jump over draw if we are at the same x position */
1252 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1253 hashed_process_data
->x
.middle_used
))
1255 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1256 /* Draw collision indicator */
1257 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1258 gdk_draw_point(hashed_process_data
->pixmap
,
1261 COLLISION_POSITION(hashed_process_data
->height
));
1262 hashed_process_data
->x
.middle_marked
= TRUE
;
1268 DrawContext draw_context
;
1269 /* Now create the drawing context that will be used to draw
1270 * items related to the last state. */
1271 draw_context
.drawable
= hashed_process_data
->pixmap
;
1272 draw_context
.gc
= drawing
->gc
;
1273 draw_context
.pango_layout
= drawing
->pango_layout
;
1274 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1275 draw_context
.drawinfo
.end
.x
= x
;
1277 draw_context
.drawinfo
.y
.over
= 1;
1278 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1279 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1281 draw_context
.drawinfo
.start
.offset
.over
= 0;
1282 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1283 draw_context
.drawinfo
.start
.offset
.under
= 0;
1284 draw_context
.drawinfo
.end
.offset
.over
= 0;
1285 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1286 draw_context
.drawinfo
.end
.offset
.under
= 0;
1290 PropertiesLine prop_line
;
1291 prop_line
.line_width
= STATE_LINE_WIDTH
;
1292 prop_line
.style
= GDK_LINE_SOLID
;
1293 prop_line
.y
= MIDDLE
;
1294 trap_set_line_color(&prop_line
, &ts
->trap_states
[trap
]);
1295 draw_line((void*)&prop_line
, (void*)&draw_context
);
1297 /* become the last x position */
1298 hashed_process_data
->x
.middle
= x
;
1299 hashed_process_data
->x
.middle_used
= TRUE
;
1300 hashed_process_data
->x
.middle_marked
= FALSE
;
1302 /* Calculate the next good time */
1303 convert_pixels_to_time(width
, x
+1, time_window
,
1304 &hashed_process_data
->next_good_time
);
1312 int before_bdev_event_hook(void *hook_data
, void *call_data
)
1314 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
1315 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
1316 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1318 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1320 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1321 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1324 e
= ltt_tracefile_get_event(tfc
->tf
);
1326 LttTime evtime
= ltt_event_time(e
);
1328 /* we are in a execmode, before the state update. We must draw the
1329 * items corresponding to the state before it changes : now is the right
1334 guint cpu
= tfs
->cpu
;
1335 guint8 major
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1336 guint8 minor
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
1337 guint oper
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 2));
1338 gint devcode_gint
= MKDEV(major
,minor
);
1340 guint trace_num
= ts
->parent
.index
;
1342 LttvBdevState
*bdev
= g_hash_table_lookup(ts
->bdev_states
, &devcode_gint
);
1343 /* the result of the lookup might be NULL. that's ok, the rest of the function
1344 should understand it was not found and that its state is unknown */
1346 /* Well, the process_out existed : we must get it in the process hash
1347 * or add it, and draw its items.
1349 /* Add process to process list (if not present) */
1350 guint pl_height
= 0;
1351 HashedResourceData
*hashed_process_data
= NULL
;
1352 ProcessList
*process_list
= resourceview_data
->process_list
;
1353 // LttTime birth = process->creation_time;
1355 // if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) {
1356 // hashed_process_data = process_list->current_hash_data[trace_num][cpu];
1358 hashed_process_data
= resourcelist_obtain_bdev(resourceview_data
, trace_num
, devcode_gint
);
1359 ////hashed_process_data = processlist_get_process_data(process_list, resourceq, trace_num);
1360 // hashed_process_data = processlist_get_process_data(process_list,
1366 /* Set the current process */
1367 // process_list->current_hash_data[trace_num][process->cpu] =
1368 // hashed_process_data;
1371 /* Now, the process is in the state hash and our own process hash.
1372 * We definitely can draw the items related to the ending state.
1375 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1378 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1379 TimeWindow time_window
=
1380 lttvwindow_get_time_window(resourceview_data
->tab
);
1383 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1384 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1386 #endif //EXTRA_CHECK
1387 Drawing_t
*drawing
= resourceview_data
->drawing
;
1388 guint width
= drawing
->width
;
1390 convert_time_to_pixels(
1396 /* Draw collision indicator */
1397 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1398 gdk_draw_point(hashed_process_data
->pixmap
,
1401 COLLISION_POSITION(hashed_process_data
->height
));
1402 hashed_process_data
->x
.middle_marked
= TRUE
;
1406 TimeWindow time_window
=
1407 lttvwindow_get_time_window(resourceview_data
->tab
);
1410 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1411 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1413 #endif //EXTRA_CHECK
1414 Drawing_t
*drawing
= resourceview_data
->drawing
;
1415 guint width
= drawing
->width
;
1418 convert_time_to_pixels(
1425 /* Jump over draw if we are at the same x position */
1426 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1427 hashed_process_data
->x
.middle_used
))
1429 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1430 /* Draw collision indicator */
1431 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1432 gdk_draw_point(hashed_process_data
->pixmap
,
1435 COLLISION_POSITION(hashed_process_data
->height
));
1436 hashed_process_data
->x
.middle_marked
= TRUE
;
1442 DrawContext draw_context
;
1443 /* Now create the drawing context that will be used to draw
1444 * items related to the last state. */
1445 draw_context
.drawable
= hashed_process_data
->pixmap
;
1446 draw_context
.gc
= drawing
->gc
;
1447 draw_context
.pango_layout
= drawing
->pango_layout
;
1448 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1449 draw_context
.drawinfo
.end
.x
= x
;
1451 draw_context
.drawinfo
.y
.over
= 1;
1452 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1453 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1455 draw_context
.drawinfo
.start
.offset
.over
= 0;
1456 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1457 draw_context
.drawinfo
.start
.offset
.under
= 0;
1458 draw_context
.drawinfo
.end
.offset
.over
= 0;
1459 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1460 draw_context
.drawinfo
.end
.offset
.under
= 0;
1464 PropertiesLine prop_line
;
1465 prop_line
.line_width
= STATE_LINE_WIDTH
;
1466 prop_line
.style
= GDK_LINE_SOLID
;
1467 prop_line
.y
= MIDDLE
;
1468 bdev_set_line_color(&prop_line
, bdev
);
1469 draw_line((void*)&prop_line
, (void*)&draw_context
);
1471 /* become the last x position */
1472 hashed_process_data
->x
.middle
= x
;
1473 hashed_process_data
->x
.middle_used
= TRUE
;
1474 hashed_process_data
->x
.middle_marked
= FALSE
;
1476 /* Calculate the next good time */
1477 convert_pixels_to_time(width
, x
+1, time_window
,
1478 &hashed_process_data
->next_good_time
);
1485 gint
update_time_window_hook(void *hook_data
, void *call_data
)
1487 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1488 Drawing_t
*drawing
= resourceview_data
->drawing
;
1489 ProcessList
*process_list
= resourceview_data
->process_list
;
1491 const TimeWindowNotifyData
*time_window_nofify_data
=
1492 ((const TimeWindowNotifyData
*)call_data
);
1494 TimeWindow
*old_time_window
=
1495 time_window_nofify_data
->old_time_window
;
1496 TimeWindow
*new_time_window
=
1497 time_window_nofify_data
->new_time_window
;
1499 /* Update the ruler */
1500 drawing_update_ruler(resourceview_data
->drawing
,
1504 /* Two cases : zoom in/out or scrolling */
1506 /* In order to make sure we can reuse the old drawing, the scale must
1507 * be the same and the new time interval being partly located in the
1508 * currently shown time interval. (reuse is only for scrolling)
1511 g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
1512 old_time_window
->start_time
.tv_sec
,
1513 old_time_window
->start_time
.tv_nsec
,
1514 old_time_window
->time_width
.tv_sec
,
1515 old_time_window
->time_width
.tv_nsec
);
1517 g_info("New time window HOOK : %lu, %lu to %lu, %lu",
1518 new_time_window
->start_time
.tv_sec
,
1519 new_time_window
->start_time
.tv_nsec
,
1520 new_time_window
->time_width
.tv_sec
,
1521 new_time_window
->time_width
.tv_nsec
);
1523 if( new_time_window
->time_width
.tv_sec
== old_time_window
->time_width
.tv_sec
1524 && new_time_window
->time_width
.tv_nsec
== old_time_window
->time_width
.tv_nsec
)
1526 /* Same scale (scrolling) */
1527 g_info("scrolling");
1528 LttTime
*ns
= &new_time_window
->start_time
;
1529 LttTime
*nw
= &new_time_window
->time_width
;
1530 LttTime
*os
= &old_time_window
->start_time
;
1531 LttTime
*ow
= &old_time_window
->time_width
;
1532 LttTime old_end
= old_time_window
->end_time
;
1533 LttTime new_end
= new_time_window
->end_time
;
1535 //if(ns<os+w && os+w<ns+w)
1536 //if(ns<old_end && os<ns)
1537 if(ltt_time_compare(*ns
, old_end
) == -1
1538 && ltt_time_compare(*os
, *ns
) == -1)
1540 g_info("scrolling near right");
1541 /* Scroll right, keep right part of the screen */
1543 guint width
= resourceview_data
->drawing
->width
;
1544 convert_time_to_pixels(
1550 /* Copy old data to new location */
1551 copy_pixmap_region(process_list
,
1553 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1557 resourceview_data
->drawing
->width
-x
+SAFETY
, -1);
1559 if(drawing
->damage_begin
== drawing
->damage_end
)
1560 drawing
->damage_begin
= resourceview_data
->drawing
->width
-x
;
1562 drawing
->damage_begin
= 0;
1564 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1566 /* Clear the data request background, but not SAFETY */
1567 rectangle_pixmap(process_list
,
1568 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1570 drawing
->damage_begin
+SAFETY
, 0,
1571 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1573 gtk_widget_queue_draw(drawing
->drawing_area
);
1575 /* Get new data for the rest. */
1576 drawing_data_request(resourceview_data
->drawing
,
1577 drawing
->damage_begin
, 0,
1578 drawing
->damage_end
- drawing
->damage_begin
,
1579 resourceview_data
->drawing
->height
);
1581 if(ltt_time_compare(*ns
,*os
) == -1
1582 && ltt_time_compare(*os
,new_end
) == -1)
1584 g_info("scrolling near left");
1585 /* Scroll left, keep left part of the screen */
1587 guint width
= resourceview_data
->drawing
->width
;
1588 convert_time_to_pixels(
1594 /* Copy old data to new location */
1595 copy_pixmap_region (process_list
,
1597 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1603 if(drawing
->damage_begin
== drawing
->damage_end
)
1604 drawing
->damage_end
= x
;
1606 drawing
->damage_end
=
1607 resourceview_data
->drawing
->width
;
1609 drawing
->damage_begin
= 0;
1611 rectangle_pixmap (process_list
,
1612 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1614 drawing
->damage_begin
, 0,
1615 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1618 gtk_widget_queue_draw(drawing
->drawing_area
);
1620 /* Get new data for the rest. */
1621 drawing_data_request(resourceview_data
->drawing
,
1622 drawing
->damage_begin
, 0,
1623 drawing
->damage_end
- drawing
->damage_begin
,
1624 resourceview_data
->drawing
->height
);
1627 if(ltt_time_compare(*ns
,*os
) == 0)
1629 g_info("not scrolling");
1631 g_info("scrolling far");
1632 /* Cannot reuse any part of the screen : far jump */
1635 rectangle_pixmap (process_list
,
1636 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1639 resourceview_data
->drawing
->width
+SAFETY
, // do not overlap
1642 gtk_widget_queue_draw(drawing
->drawing_area
);
1644 drawing
->damage_begin
= 0;
1645 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1647 drawing_data_request(resourceview_data
->drawing
,
1649 resourceview_data
->drawing
->width
,
1650 resourceview_data
->drawing
->height
);
1656 /* Different scale (zoom) */
1659 rectangle_pixmap (process_list
,
1660 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1663 resourceview_data
->drawing
->width
+SAFETY
, // do not overlap
1666 gtk_widget_queue_draw(drawing
->drawing_area
);
1668 drawing
->damage_begin
= 0;
1669 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1671 drawing_data_request(resourceview_data
->drawing
,
1673 resourceview_data
->drawing
->width
,
1674 resourceview_data
->drawing
->height
);
1677 /* Update directly when scrolling */
1678 gdk_window_process_updates(resourceview_data
->drawing
->drawing_area
->window
,
1684 gint
traceset_notify(void *hook_data
, void *call_data
)
1686 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1687 Drawing_t
*drawing
= resourceview_data
->drawing
;
1689 if(unlikely(drawing
->gc
== NULL
)) {
1692 if(drawing
->dotted_gc
== NULL
) {
1696 drawing_clear(resourceview_data
->drawing
);
1697 processlist_clear(resourceview_data
->process_list
);
1698 gtk_widget_set_size_request(
1699 resourceview_data
->drawing
->drawing_area
,
1700 -1, processlist_get_height(resourceview_data
->process_list
));
1701 redraw_notify(resourceview_data
, NULL
);
1703 request_background_data(resourceview_data
);
1708 gint
redraw_notify(void *hook_data
, void *call_data
)
1710 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1711 Drawing_t
*drawing
= resourceview_data
->drawing
;
1712 GtkWidget
*widget
= drawing
->drawing_area
;
1714 drawing
->damage_begin
= 0;
1715 drawing
->damage_end
= drawing
->width
;
1717 /* fun feature, to be separated someday... */
1718 drawing_clear(resourceview_data
->drawing
);
1719 processlist_clear(resourceview_data
->process_list
);
1720 gtk_widget_set_size_request(
1721 resourceview_data
->drawing
->drawing_area
,
1722 -1, processlist_get_height(resourceview_data
->process_list
));
1724 rectangle_pixmap (resourceview_data
->process_list
,
1725 widget
->style
->black_gc
,
1728 drawing
->alloc_width
,
1731 gtk_widget_queue_draw(drawing
->drawing_area
);
1733 if(drawing
->damage_begin
< drawing
->damage_end
)
1735 drawing_data_request(drawing
,
1736 drawing
->damage_begin
,
1738 drawing
->damage_end
-drawing
->damage_begin
,
1747 gint
continue_notify(void *hook_data
, void *call_data
)
1749 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1750 Drawing_t
*drawing
= resourceview_data
->drawing
;
1752 if(drawing
->damage_begin
< drawing
->damage_end
)
1754 drawing_data_request(drawing
,
1755 drawing
->damage_begin
,
1757 drawing
->damage_end
-drawing
->damage_begin
,
1765 gint
update_current_time_hook(void *hook_data
, void *call_data
)
1767 ControlFlowData
*resourceview_data
= (ControlFlowData
*)hook_data
;
1768 Drawing_t
*drawing
= resourceview_data
->drawing
;
1770 LttTime current_time
= *((LttTime
*)call_data
);
1772 TimeWindow time_window
=
1773 lttvwindow_get_time_window(resourceview_data
->tab
);
1775 LttTime time_begin
= time_window
.start_time
;
1776 LttTime width
= time_window
.time_width
;
1779 guint64 time_ll
= ltt_time_to_uint64(width
);
1780 time_ll
= time_ll
>> 1; /* divide by two */
1781 half_width
= ltt_time_from_uint64(time_ll
);
1783 LttTime time_end
= ltt_time_add(time_begin
, width
);
1785 LttvTracesetContext
* tsc
=
1786 lttvwindow_get_traceset_context(resourceview_data
->tab
);
1788 LttTime trace_start
= tsc
->time_span
.start_time
;
1789 LttTime trace_end
= tsc
->time_span
.end_time
;
1791 g_info("New current time HOOK : %lu, %lu", current_time
.tv_sec
,
1792 current_time
.tv_nsec
);
1794 /* If current time is inside time interval, just move the highlight
1797 /* Else, we have to change the time interval. We have to tell it
1798 * to the main window. */
1799 /* The time interval change will take care of placing the current
1800 * time at the center of the visible area, or nearest possible if we are
1801 * at one end of the trace. */
1804 if(ltt_time_compare(current_time
, time_begin
) < 0)
1806 TimeWindow new_time_window
;
1808 if(ltt_time_compare(current_time
,
1809 ltt_time_add(trace_start
,half_width
)) < 0)
1810 time_begin
= trace_start
;
1812 time_begin
= ltt_time_sub(current_time
,half_width
);
1814 new_time_window
.start_time
= time_begin
;
1815 new_time_window
.time_width
= width
;
1816 new_time_window
.time_width_double
= ltt_time_to_double(width
);
1817 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
1819 lttvwindow_report_time_window(resourceview_data
->tab
, new_time_window
);
1821 else if(ltt_time_compare(current_time
, time_end
) > 0)
1823 TimeWindow new_time_window
;
1825 if(ltt_time_compare(current_time
, ltt_time_sub(trace_end
, half_width
)) > 0)
1826 time_begin
= ltt_time_sub(trace_end
,width
);
1828 time_begin
= ltt_time_sub(current_time
,half_width
);
1830 new_time_window
.start_time
= time_begin
;
1831 new_time_window
.time_width
= width
;
1832 new_time_window
.time_width_double
= ltt_time_to_double(width
);
1833 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
1835 lttvwindow_report_time_window(resourceview_data
->tab
, new_time_window
);
1838 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
1840 /* Update directly when scrolling */
1841 gdk_window_process_updates(resourceview_data
->drawing
->drawing_area
->window
,
1847 typedef struct _ClosureData
{
1848 EventsRequest
*events_request
;
1849 LttvTracesetState
*tss
;
1854 /* Draw line until end of the screen */
1856 void draw_closure(gpointer key
, gpointer value
, gpointer user_data
)
1858 ResourceUniqueNumeric
*process_info
= (ResourceUniqueNumeric
*)key
;
1859 HashedResourceData
*hashed_process_data
= (HashedResourceData
*)value
;
1860 ClosureData
*closure_data
= (ClosureData
*)user_data
;
1862 EventsRequest
*events_request
= closure_data
->events_request
;
1863 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1865 LttvTracesetState
*tss
= closure_data
->tss
;
1866 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)tss
;
1868 LttTime evtime
= closure_data
->end_time
;
1870 gboolean dodraw
= TRUE
;
1872 if(hashed_process_data
->type
== RV_RESOURCE_MACHINE
)
1876 /* For the process */
1877 /* First, check if the current process is in the state computation
1878 * process list. If it is there, that means we must add it right now and
1879 * draw items from the beginning of the read for it. If it is not
1880 * present, it's a new process and it was not present : it will
1881 * be added after the state update. */
1883 g_assert(lttv_traceset_number(tsc
->ts
) > 0);
1884 #endif //EXTRA_CHECK
1885 LttvTraceContext
*tc
= tsc
->traces
[process_info
->trace_num
];
1886 LttvTraceState
*ts
= (LttvTraceState
*)tc
;
1888 /* Only draw for processes that are currently in the trace states */
1890 ProcessList
*process_list
= resourceview_data
->process_list
;
1892 /* Should be alike when background info is ready */
1893 if(resourceview_data
->background_info_waiting
==0)
1894 g_assert(ltt_time_compare(process
->creation_time
,
1895 process_info
->birth
) == 0);
1896 #endif //EXTRA_CHECK
1898 /* Now, the process is in the state hash and our own process hash.
1899 * We definitely can draw the items related to the ending state.
1902 if(unlikely(ltt_time_compare(hashed_process_data
->next_good_time
,
1905 TimeWindow time_window
=
1906 lttvwindow_get_time_window(resourceview_data
->tab
);
1909 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1910 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1912 #endif //EXTRA_CHECK
1913 Drawing_t
*drawing
= resourceview_data
->drawing
;
1914 guint width
= drawing
->width
;
1916 guint x
= closure_data
->x_end
;
1918 DrawContext draw_context
;
1920 /* Now create the drawing context that will be used to draw
1921 * items related to the last state. */
1922 draw_context
.drawable
= hashed_process_data
->pixmap
;
1923 draw_context
.gc
= drawing
->gc
;
1924 draw_context
.pango_layout
= drawing
->pango_layout
;
1925 draw_context
.drawinfo
.end
.x
= x
;
1927 draw_context
.drawinfo
.y
.over
= 1;
1928 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1929 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1931 draw_context
.drawinfo
.start
.offset
.over
= 0;
1932 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1933 draw_context
.drawinfo
.start
.offset
.under
= 0;
1934 draw_context
.drawinfo
.end
.offset
.over
= 0;
1935 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1936 draw_context
.drawinfo
.end
.offset
.under
= 0;
1938 /* Jump over draw if we are at the same x position */
1939 if(x
== hashed_process_data
->x
.over
)
1943 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.over
;
1945 PropertiesLine prop_line
= prepare_execmode_line(process
);
1946 draw_line((void*)&prop_line
, (void*)&draw_context
);
1948 hashed_process_data
->x
.over
= x
;
1952 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1953 hashed_process_data
->x
.middle_used
)) {
1954 #if 0 /* do not mark closure : not missing information */
1955 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
1956 /* Draw collision indicator */
1957 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1958 gdk_draw_point(drawing
->pixmap
,
1962 hashed_process_data
->x
.middle_marked
= TRUE
;
1967 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1970 PropertiesLine prop_line
;
1971 prop_line
.line_width
= STATE_LINE_WIDTH
;
1972 prop_line
.style
= GDK_LINE_SOLID
;
1973 prop_line
.y
= MIDDLE
;
1974 if(hashed_process_data
->type
== RV_RESOURCE_CPU
)
1975 cpu_set_line_color(&prop_line
, &ts
->cpu_states
[process_info
->id
]);
1976 else if(hashed_process_data
->type
== RV_RESOURCE_IRQ
)
1977 irq_set_line_color(&prop_line
, &ts
->irq_states
[process_info
->id
]);
1978 else if(hashed_process_data
->type
== RV_RESOURCE_SOFT_IRQ
)
1979 soft_irq_set_line_color(&prop_line
, &ts
->soft_irq_states
[process_info
->id
]);
1980 else if(hashed_process_data
->type
== RV_RESOURCE_TRAP
)
1981 trap_set_line_color(&prop_line
, &ts
->trap_states
[process_info
->id
]);
1982 else if(hashed_process_data
->type
== RV_RESOURCE_BDEV
) {
1983 gint devcode_gint
= process_info
->id
;
1984 LttvBdevState
*bdev
= g_hash_table_lookup(ts
->bdev_states
, &devcode_gint
);
1985 // the lookup may return null; bdev_set_line_color must act appropriately
1986 bdev_set_line_color(&prop_line
, bdev
);
1989 draw_line((void*)&prop_line
, (void*)&draw_context
);
1992 /* become the last x position */
1993 if(likely(x
!= hashed_process_data
->x
.middle
)) {
1994 hashed_process_data
->x
.middle
= x
;
1995 /* but don't use the pixel */
1996 hashed_process_data
->x
.middle_used
= FALSE
;
1998 /* Calculate the next good time */
1999 convert_pixels_to_time(width
, x
+1, time_window
,
2000 &hashed_process_data
->next_good_time
);
2007 int before_chunk(void *hook_data
, void *call_data
)
2009 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2010 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2011 ControlFlowData
*cfd
= (ControlFlowData
*)events_request
->viewer_data
;
2013 /* Deactivate sort */
2014 gtk_tree_sortable_set_sort_column_id(
2015 GTK_TREE_SORTABLE(cfd
->process_list
->list_store
),
2017 GTK_SORT_ASCENDING
);
2019 drawing_chunk_begin(events_request
, tss
);
2026 * This gets executed just before an events request is executed
2029 int before_request(void *hook_data
, void *call_data
)
2031 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2032 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2034 drawing_data_request_begin(events_request
, tss
);
2041 * after request is necessary in addition of after chunk in order to draw
2042 * lines until the end of the screen. after chunk just draws lines until
2049 int after_request(void *hook_data
, void *call_data
)
2052 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2053 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2054 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2056 ProcessList
*process_list
= resourceview_data
->process_list
;
2057 LttTime end_time
= events_request
->end_time
;
2059 ClosureData closure_data
;
2060 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2061 closure_data
.tss
= tss
;
2062 closure_data
.end_time
= end_time
;
2064 TimeWindow time_window
=
2065 lttvwindow_get_time_window(resourceview_data
->tab
);
2066 guint width
= resourceview_data
->drawing
->width
;
2067 convert_time_to_pixels(
2071 &closure_data
.x_end
);
2074 /* Draw last items */
2075 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2076 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2077 (void*)&closure_data
);
2080 /* Request expose */
2081 drawing_request_expose(events_request
, tss
, end_time
);
2090 int after_chunk(void *hook_data
, void *call_data
)
2092 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2093 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2094 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2095 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)call_data
;
2096 LttvTracefileContext
*tfc
= lttv_traceset_context_get_current_tfc(tsc
);
2099 ProcessList
*process_list
= resourceview_data
->process_list
;
2101 LttvTraceset
*traceset
= tsc
->ts
;
2102 guint nb_trace
= lttv_traceset_number(traceset
);
2104 /* Only execute when called for the first trace's events request */
2105 if(!process_list
->current_hash_data
) return;
2107 for(i
= 0 ; i
< nb_trace
; i
++) {
2108 g_free(process_list
->current_hash_data
[i
]);
2110 g_free(process_list
->current_hash_data
);
2111 process_list
->current_hash_data
= NULL
;
2114 end_time
= LTT_TIME_MIN(tfc
->timestamp
, events_request
->end_time
);
2115 else /* end of traceset, or position now out of request : end */
2116 end_time
= events_request
->end_time
;
2118 ClosureData closure_data
;
2119 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2120 closure_data
.tss
= tss
;
2121 closure_data
.end_time
= end_time
;
2123 TimeWindow time_window
=
2124 lttvwindow_get_time_window(resourceview_data
->tab
);
2125 guint width
= resourceview_data
->drawing
->width
;
2126 convert_time_to_pixels(
2130 &closure_data
.x_end
);
2132 /* Draw last items */
2133 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2134 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2135 (void*)&closure_data
);
2138 /* Reactivate sort */
2139 gtk_tree_sortable_set_sort_column_id(
2140 GTK_TREE_SORTABLE(resourceview_data
->process_list
->list_store
),
2141 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2142 GTK_SORT_ASCENDING
);
2144 update_index_to_pixmap(resourceview_data
->process_list
);
2145 /* Request a full expose : drawing scrambled */
2146 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
2148 /* Request expose (updates damages zone also) */
2149 drawing_request_expose(events_request
, tss
, end_time
);
2154 /* after_statedump_end
2156 * @param hook_data ControlFlowData structure of the viewer.
2157 * @param call_data Event context.
2159 * This function adds items to be drawn in a queue for each process.
2162 int before_statedump_end(void *hook_data
, void *call_data
)
2166 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
2167 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
2168 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2170 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
2172 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
2174 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
2176 LttvTracesetState
*tss
= (LttvTracesetState
*)tfc
->t_context
->ts_context
;
2177 ProcessList
*process_list
= resourceview_data
->process_list
;
2180 e
= ltt_tracefile_get_event(tfc
->tf
);
2182 LttvFilter
*filter
= resourceview_data
->filter
;
2183 if(filter
!= NULL
&& filter
->head
!= NULL
)
2184 if(!lttv_filter_tree_parse(filter
->head
,e
,tfc
->tf
,
2185 tfc
->t_context
->t
,tfc
,NULL
,NULL
))
2188 LttTime evtime
= ltt_event_time(e
);
2190 ClosureData closure_data
;
2191 closure_data
.events_request
= events_request
;
2192 closure_data
.tss
= tss
;
2193 closure_data
.end_time
= evtime
;
2195 TimeWindow time_window
=
2196 lttvwindow_get_time_window(resourceview_data
->tab
);
2197 guint width
= resourceview_data
->drawing
->width
;
2198 convert_time_to_pixels(
2202 &closure_data
.x_end
);
2204 /* Draw last items */
2206 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2207 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2208 (void*)&closure_data
);
2211 /* Reactivate sort */
2212 gtk_tree_sortable_set_sort_column_id(
2213 GTK_TREE_SORTABLE(resourceview_data
->process_list
->list_store
),
2214 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2215 GTK_SORT_ASCENDING
);
2217 update_index_to_pixmap(resourceview_data
->process_list
);
2218 /* Request a full expose : drawing scrambled */
2219 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
2221 /* Request expose (updates damages zone also) */
2222 drawing_request_expose(events_request
, tss
, evtime
);