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 4
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_IDLE
];
319 prop_line
->color
= drawing_colors_soft_irq
[COL_SOFT_IRQ_BUSY
];
322 static void trap_set_line_color(PropertiesLine
*prop_line
, LttvTrapState
*s
)
324 GQuark present_state
;
326 prop_line
->color
= drawing_colors_trap
[COL_TRAP_IDLE
];
328 prop_line
->color
= drawing_colors_trap
[COL_TRAP_BUSY
];
331 static void bdev_set_line_color(PropertiesLine
*prop_line
, LttvBdevState
*s
)
333 GQuark present_state
;
334 if(s
== 0 || s
->mode_stack
->len
== 0)
335 present_state
= LTTV_BDEV_UNKNOWN
;
337 present_state
= ((GQuark
*)s
->mode_stack
->data
)[s
->mode_stack
->len
-1];
339 if(present_state
== LTTV_BDEV_IDLE
) {
340 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_IDLE
];
342 else if(present_state
== LTTV_BDEV_BUSY_READING
) {
343 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_BUSY_READING
];
345 else if(present_state
== LTTV_BDEV_BUSY_WRITING
) {
346 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_BUSY_WRITING
];
349 prop_line
->color
= drawing_colors_bdev
[COL_BDEV_UNKNOWN
];
353 /* before_schedchange_hook
355 * This function basically draw lines and icons. Two types of lines are drawn :
356 * one small (3 pixels?) representing the state of the process and the second
357 * type is thicker (10 pixels?) representing on which CPU a process is running
358 * (and this only in running state).
360 * Extremums of the lines :
361 * x_min : time of the last event context for this process kept in memory.
362 * x_max : time of the current event.
363 * y : middle of the process in the process list. The process is found in the
364 * list, therefore is it's position in pixels.
366 * The choice of lines'color is defined by the context of the last event for this
371 int before_schedchange_hook(void *hook_data
, void *call_data
)
373 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
374 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
375 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
377 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
379 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
380 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
383 e
= ltt_tracefile_get_event(tfc
->tf
);
384 gint target_pid_saved
= tfc
->target_pid
;
386 LttTime evtime
= ltt_event_time(e
);
387 LttvFilter
*filter
= resourceview_data
->filter
;
389 /* we are in a schedchange, before the state update. We must draw the
390 * items corresponding to the state before it changes : now is the right
396 pid_out
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
397 pid_in
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
398 // TODO: can't we reenable this? pmf
399 // if(pid_in != 0 && pid_out != 0) {
400 // /* not a transition to/from idle */
404 tfc
->target_pid
= pid_out
;
406 guint cpu
= tfs
->cpu
;
408 guint trace_num
= ts
->parent
.index
;
409 /* Add process to process list (if not present) */
411 HashedResourceData
*hashed_process_data
= NULL
;
412 ProcessList
*process_list
= resourceview_data
->process_list
;
414 hashed_process_data
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
416 /* Now, the process is in the state hash and our own process hash.
417 * We definitely can draw the items related to the ending state.
420 if(ltt_time_compare(hashed_process_data
->next_good_time
,
423 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
425 TimeWindow time_window
=
426 lttvwindow_get_time_window(resourceview_data
->tab
);
428 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
429 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
432 Drawing_t
*drawing
= resourceview_data
->drawing
;
433 guint width
= drawing
->width
;
435 convert_time_to_pixels(
441 /* Draw collision indicator */
442 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
443 gdk_draw_point(hashed_process_data
->pixmap
,
446 COLLISION_POSITION(hashed_process_data
->height
));
447 hashed_process_data
->x
.middle_marked
= TRUE
;
450 TimeWindow time_window
=
451 lttvwindow_get_time_window(resourceview_data
->tab
);
453 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
454 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
457 Drawing_t
*drawing
= resourceview_data
->drawing
;
458 guint width
= drawing
->width
;
460 convert_time_to_pixels(
466 /* Jump over draw if we are at the same x position */
467 if(x
== hashed_process_data
->x
.middle
&&
468 hashed_process_data
->x
.middle_used
)
470 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
471 /* Draw collision indicator */
472 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
473 gdk_draw_point(hashed_process_data
->pixmap
,
476 COLLISION_POSITION(hashed_process_data
->height
));
477 hashed_process_data
->x
.middle_marked
= TRUE
;
481 DrawContext draw_context
;
483 /* Now create the drawing context that will be used to draw
484 * items related to the last state. */
485 draw_context
.drawable
= hashed_process_data
->pixmap
;
486 draw_context
.gc
= drawing
->gc
;
487 draw_context
.pango_layout
= drawing
->pango_layout
;
488 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
489 draw_context
.drawinfo
.end
.x
= x
;
491 draw_context
.drawinfo
.y
.over
= 1;
492 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
493 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
495 draw_context
.drawinfo
.start
.offset
.over
= 0;
496 draw_context
.drawinfo
.start
.offset
.middle
= 0;
497 draw_context
.drawinfo
.start
.offset
.under
= 0;
498 draw_context
.drawinfo
.end
.offset
.over
= 0;
499 draw_context
.drawinfo
.end
.offset
.middle
= 0;
500 draw_context
.drawinfo
.end
.offset
.under
= 0;
504 //PropertiesLine prop_line = prepare_s_e_line(process);
505 PropertiesLine prop_line
;
506 prop_line
.line_width
= STATE_LINE_WIDTH
;
507 prop_line
.style
= GDK_LINE_SOLID
;
508 prop_line
.y
= MIDDLE
;
509 cpu_set_line_color(&prop_line
, tfs
->cpu_state
);
510 draw_line((void*)&prop_line
, (void*)&draw_context
);
513 /* become the last x position */
514 hashed_process_data
->x
.middle
= x
;
515 hashed_process_data
->x
.middle_used
= TRUE
;
516 hashed_process_data
->x
.middle_marked
= FALSE
;
518 /* Calculate the next good time */
519 convert_pixels_to_time(width
, x
+1, time_window
,
520 &hashed_process_data
->next_good_time
);
527 /* after_schedchange_hook
529 * The draw after hook is called by the reading API to have a
530 * particular event drawn on the screen.
531 * @param hook_data ControlFlowData structure of the viewer.
532 * @param call_data Event context.
534 * This function adds items to be drawn in a queue for each process.
537 int after_schedchange_hook(void *hook_data
, void *call_data
)
539 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
540 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
541 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
542 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
543 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
544 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
547 e
= ltt_tracefile_get_event(tfc
->tf
);
549 LttvFilter
*filter
= resourceview_data
->filter
;
550 if(filter
!= NULL
&& filter
->head
!= NULL
)
551 if(!lttv_filter_tree_parse(filter
->head
,e
,tfc
->tf
,
552 tfc
->t_context
->t
,tfc
,NULL
,NULL
))
555 LttTime evtime
= ltt_event_time(e
);
557 /* Add process to process list (if not present) */
558 LttvProcessState
*process_in
;
561 HashedResourceData
*hashed_process_data_in
= NULL
;
563 ProcessList
*process_list
= resourceview_data
->process_list
;
568 pid_out
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
569 pid_in
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
573 /* Find process pid_in in the list... */
574 //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
575 //process_in = tfs->process;
576 guint cpu
= tfs
->cpu
;
577 guint trace_num
= ts
->parent
.index
;
578 process_in
= ts
->running_process
[cpu
];
579 /* It should exist, because we are after the state update. */
581 g_assert(process_in
!= NULL
);
583 birth
= process_in
->creation_time
;
585 //hashed_process_data_in = processlist_get_process_data(process_list, cpuq, trace_num);
586 hashed_process_data_in
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
588 /* Set the current process */
589 process_list
->current_hash_data
[trace_num
][process_in
->cpu
] =
590 hashed_process_data_in
;
592 if(ltt_time_compare(hashed_process_data_in
->next_good_time
,
595 TimeWindow time_window
=
596 lttvwindow_get_time_window(resourceview_data
->tab
);
599 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
600 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
603 Drawing_t
*drawing
= resourceview_data
->drawing
;
604 guint width
= drawing
->width
;
607 convert_time_to_pixels(
613 if(hashed_process_data_in
->x
.middle
!= new_x
) {
614 hashed_process_data_in
->x
.middle
= new_x
;
615 hashed_process_data_in
->x
.middle_used
= FALSE
;
616 hashed_process_data_in
->x
.middle_marked
= FALSE
;
622 /* before_execmode_hook
624 * This function basically draw lines and icons. Two types of lines are drawn :
625 * one small (3 pixels?) representing the state of the process and the second
626 * type is thicker (10 pixels?) representing on which CPU a process is running
627 * (and this only in running state).
629 * Extremums of the lines :
630 * x_min : time of the last event context for this process kept in memory.
631 * x_max : time of the current event.
632 * y : middle of the process in the process list. The process is found in the
633 * list, therefore is it's position in pixels.
635 * The choice of lines'color is defined by the context of the last event for this
639 int before_execmode_hook(void *hook_data
, void *call_data
)
641 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
642 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
643 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
645 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
647 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
648 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
651 e
= ltt_tracefile_get_event(tfc
->tf
);
653 LttTime evtime
= ltt_event_time(e
);
655 before_execmode_hook_irq(hook_data
, call_data
);
656 before_execmode_hook_soft_irq(hook_data
, call_data
);
657 before_execmode_hook_trap(hook_data
, call_data
);
659 /* we are in a execmode, before the state update. We must draw the
660 * items corresponding to the state before it changes : now is the right
664 guint cpu
= tfs
->cpu
;
666 guint trace_num
= ts
->parent
.index
;
667 LttvProcessState
*process
= ts
->running_process
[cpu
];
668 g_assert(process
!= NULL
);
670 /* Well, the process_out existed : we must get it in the process hash
671 * or add it, and draw its items.
673 /* Add process to process list (if not present) */
675 HashedResourceData
*hashed_process_data
= NULL
;
676 ProcessList
*process_list
= resourceview_data
->process_list
;
678 LttTime birth
= process
->creation_time
;
680 if(likely(process_list
->current_hash_data
[trace_num
][cpu
] != NULL
)) {
681 hashed_process_data
= process_list
->current_hash_data
[trace_num
][cpu
];
683 hashed_process_data
= resourcelist_obtain_cpu(resourceview_data
, trace_num
, cpu
);
685 /* Set the current process */
686 process_list
->current_hash_data
[trace_num
][process
->cpu
] =
690 /* Now, the process is in the state hash and our own process hash.
691 * We definitely can draw the items related to the ending state.
694 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
697 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
698 TimeWindow time_window
=
699 lttvwindow_get_time_window(resourceview_data
->tab
);
702 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
703 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
706 Drawing_t
*drawing
= resourceview_data
->drawing
;
707 guint width
= drawing
->width
;
709 convert_time_to_pixels(
715 /* Draw collision indicator */
716 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
717 gdk_draw_point(hashed_process_data
->pixmap
,
720 COLLISION_POSITION(hashed_process_data
->height
));
721 hashed_process_data
->x
.middle_marked
= TRUE
;
725 TimeWindow time_window
=
726 lttvwindow_get_time_window(resourceview_data
->tab
);
729 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
730 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
733 Drawing_t
*drawing
= resourceview_data
->drawing
;
734 guint width
= drawing
->width
;
737 convert_time_to_pixels(
744 /* Jump over draw if we are at the same x position */
745 if(unlikely(x
== hashed_process_data
->x
.middle
&&
746 hashed_process_data
->x
.middle_used
))
748 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
749 /* Draw collision indicator */
750 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
751 gdk_draw_point(hashed_process_data
->pixmap
,
754 COLLISION_POSITION(hashed_process_data
->height
));
755 hashed_process_data
->x
.middle_marked
= TRUE
;
761 DrawContext draw_context
;
762 /* Now create the drawing context that will be used to draw
763 * items related to the last state. */
764 draw_context
.drawable
= hashed_process_data
->pixmap
;
765 draw_context
.gc
= drawing
->gc
;
766 draw_context
.pango_layout
= drawing
->pango_layout
;
767 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
768 draw_context
.drawinfo
.end
.x
= x
;
770 draw_context
.drawinfo
.y
.over
= 1;
771 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
772 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
774 draw_context
.drawinfo
.start
.offset
.over
= 0;
775 draw_context
.drawinfo
.start
.offset
.middle
= 0;
776 draw_context
.drawinfo
.start
.offset
.under
= 0;
777 draw_context
.drawinfo
.end
.offset
.over
= 0;
778 draw_context
.drawinfo
.end
.offset
.middle
= 0;
779 draw_context
.drawinfo
.end
.offset
.under
= 0;
783 PropertiesLine prop_line
;
784 prop_line
.line_width
= STATE_LINE_WIDTH
;
785 prop_line
.style
= GDK_LINE_SOLID
;
786 prop_line
.y
= MIDDLE
;
787 cpu_set_line_color(&prop_line
, tfs
->cpu_state
);
788 draw_line((void*)&prop_line
, (void*)&draw_context
);
790 /* become the last x position */
791 hashed_process_data
->x
.middle
= x
;
792 hashed_process_data
->x
.middle_used
= TRUE
;
793 hashed_process_data
->x
.middle_marked
= FALSE
;
795 /* Calculate the next good time */
796 convert_pixels_to_time(width
, x
+1, time_window
,
797 &hashed_process_data
->next_good_time
);
804 int before_execmode_hook_irq(void *hook_data
, void *call_data
)
806 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
807 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
808 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
810 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
812 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
813 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
816 e
= ltt_tracefile_get_event(tfc
->tf
);
818 LttTime evtime
= ltt_event_time(e
);
820 LttTrace
*trace
= tfc
->t_context
->t
;
822 /* we are in a execmode, before the state update. We must draw the
823 * items corresponding to the state before it changes : now is the right
829 guint cpu
= tfs
->cpu
;
831 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
)));
832 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
)));
833 if(ev_id_entry
== e
->event_id
) {
834 irq
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
836 else if(ev_id_exit
== e
->event_id
) {
837 irq
= ts
->cpu_states
[cpu
].last_irq
;
843 guint trace_num
= ts
->parent
.index
;
845 /* Well, the process_out existed : we must get it in the process hash
846 * or add it, and draw its items.
848 /* Add process to process list (if not present) */
850 HashedResourceData
*hashed_process_data
= NULL
;
851 ProcessList
*process_list
= resourceview_data
->process_list
;
853 hashed_process_data
= resourcelist_obtain_irq(resourceview_data
, trace_num
, irq
);
854 // TODO: fix this, it's ugly and slow:
858 str
= g_strdup_printf("IRQ %llu [%s]", irq
, (char*)g_quark_to_string(ts
->irq_names
[irq
]));
859 name
= g_quark_from_string(str
);
862 gtk_tree_store_set(resourceview_data
->process_list
->list_store
, &hashed_process_data
->y_iter
, NAME_COLUMN
, g_quark_to_string(name
), -1);
864 /* Now, the process is in the state hash and our own process hash.
865 * We definitely can draw the items related to the ending state.
868 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
871 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
872 TimeWindow time_window
=
873 lttvwindow_get_time_window(resourceview_data
->tab
);
876 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
877 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
880 Drawing_t
*drawing
= resourceview_data
->drawing
;
881 guint width
= drawing
->width
;
883 convert_time_to_pixels(
889 /* Draw collision indicator */
890 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
891 gdk_draw_point(hashed_process_data
->pixmap
,
894 COLLISION_POSITION(hashed_process_data
->height
));
895 hashed_process_data
->x
.middle_marked
= TRUE
;
899 TimeWindow time_window
=
900 lttvwindow_get_time_window(resourceview_data
->tab
);
903 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
904 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
907 Drawing_t
*drawing
= resourceview_data
->drawing
;
908 guint width
= drawing
->width
;
911 convert_time_to_pixels(
918 /* Jump over draw if we are at the same x position */
919 if(unlikely(x
== hashed_process_data
->x
.middle
&&
920 hashed_process_data
->x
.middle_used
))
922 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
923 /* Draw collision indicator */
924 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
925 gdk_draw_point(hashed_process_data
->pixmap
,
928 COLLISION_POSITION(hashed_process_data
->height
));
929 hashed_process_data
->x
.middle_marked
= TRUE
;
935 DrawContext draw_context
;
936 /* Now create the drawing context that will be used to draw
937 * items related to the last state. */
938 draw_context
.drawable
= hashed_process_data
->pixmap
;
939 draw_context
.gc
= drawing
->gc
;
940 draw_context
.pango_layout
= drawing
->pango_layout
;
941 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
942 draw_context
.drawinfo
.end
.x
= x
;
944 draw_context
.drawinfo
.y
.over
= 1;
945 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
946 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
948 draw_context
.drawinfo
.start
.offset
.over
= 0;
949 draw_context
.drawinfo
.start
.offset
.middle
= 0;
950 draw_context
.drawinfo
.start
.offset
.under
= 0;
951 draw_context
.drawinfo
.end
.offset
.over
= 0;
952 draw_context
.drawinfo
.end
.offset
.middle
= 0;
953 draw_context
.drawinfo
.end
.offset
.under
= 0;
957 PropertiesLine prop_line
;
958 prop_line
.line_width
= STATE_LINE_WIDTH
;
959 prop_line
.style
= GDK_LINE_SOLID
;
960 prop_line
.y
= MIDDLE
;
961 irq_set_line_color(&prop_line
, &ts
->irq_states
[irq
]);
962 draw_line((void*)&prop_line
, (void*)&draw_context
);
964 /* become the last x position */
965 hashed_process_data
->x
.middle
= x
;
966 hashed_process_data
->x
.middle_used
= TRUE
;
967 hashed_process_data
->x
.middle_marked
= FALSE
;
969 /* Calculate the next good time */
970 convert_pixels_to_time(width
, x
+1, time_window
,
971 &hashed_process_data
->next_good_time
);
978 int before_execmode_hook_soft_irq(void *hook_data
, void *call_data
)
980 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
981 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
982 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
984 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
986 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
987 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
990 e
= ltt_tracefile_get_event(tfc
->tf
);
992 LttTime evtime
= ltt_event_time(e
);
994 LttTrace
*trace
= tfc
->t_context
->t
;
996 /* we are in a execmode, before the state update. We must draw the
997 * items corresponding to the state before it changes : now is the right
1003 guint cpu
= tfs
->cpu
;
1005 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
)));
1006 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
)));
1007 if(ev_id_entry
== e
->event_id
) {
1008 softirq
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1010 else if(ev_id_exit
== e
->event_id
) {
1011 softirq
= ts
->cpu_states
[cpu
].last_soft_irq
;
1017 guint trace_num
= ts
->parent
.index
;
1019 /* Well, the process_out existed : we must get it in the process hash
1020 * or add it, and draw its items.
1022 /* Add process to process list (if not present) */
1023 guint pl_height
= 0;
1024 HashedResourceData
*hashed_process_data
= NULL
;
1025 ProcessList
*process_list
= resourceview_data
->process_list
;
1027 hashed_process_data
= resourcelist_obtain_soft_irq(resourceview_data
, trace_num
, softirq
);
1029 /* Now, the process is in the state hash and our own process hash.
1030 * We definitely can draw the items related to the ending state.
1033 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1036 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1037 TimeWindow time_window
=
1038 lttvwindow_get_time_window(resourceview_data
->tab
);
1041 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1042 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1044 #endif //EXTRA_CHECK
1045 Drawing_t
*drawing
= resourceview_data
->drawing
;
1046 guint width
= drawing
->width
;
1048 convert_time_to_pixels(
1054 /* Draw collision indicator */
1055 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1056 gdk_draw_point(hashed_process_data
->pixmap
,
1059 COLLISION_POSITION(hashed_process_data
->height
));
1060 hashed_process_data
->x
.middle_marked
= TRUE
;
1064 TimeWindow time_window
=
1065 lttvwindow_get_time_window(resourceview_data
->tab
);
1068 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1069 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1071 #endif //EXTRA_CHECK
1072 Drawing_t
*drawing
= resourceview_data
->drawing
;
1073 guint width
= drawing
->width
;
1076 convert_time_to_pixels(
1083 /* Jump over draw if we are at the same x position */
1084 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1085 hashed_process_data
->x
.middle_used
))
1087 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1088 /* Draw collision indicator */
1089 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1090 gdk_draw_point(hashed_process_data
->pixmap
,
1093 COLLISION_POSITION(hashed_process_data
->height
));
1094 hashed_process_data
->x
.middle_marked
= TRUE
;
1100 DrawContext draw_context
;
1101 /* Now create the drawing context that will be used to draw
1102 * items related to the last state. */
1103 draw_context
.drawable
= hashed_process_data
->pixmap
;
1104 draw_context
.gc
= drawing
->gc
;
1105 draw_context
.pango_layout
= drawing
->pango_layout
;
1106 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1107 draw_context
.drawinfo
.end
.x
= x
;
1109 draw_context
.drawinfo
.y
.over
= 1;
1110 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1111 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1113 draw_context
.drawinfo
.start
.offset
.over
= 0;
1114 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1115 draw_context
.drawinfo
.start
.offset
.under
= 0;
1116 draw_context
.drawinfo
.end
.offset
.over
= 0;
1117 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1118 draw_context
.drawinfo
.end
.offset
.under
= 0;
1122 PropertiesLine prop_line
;
1123 prop_line
.line_width
= STATE_LINE_WIDTH
;
1124 prop_line
.style
= GDK_LINE_SOLID
;
1125 prop_line
.y
= MIDDLE
;
1126 soft_irq_set_line_color(&prop_line
, &ts
->soft_irq_states
[softirq
]);
1127 draw_line((void*)&prop_line
, (void*)&draw_context
);
1129 /* become the last x position */
1130 hashed_process_data
->x
.middle
= x
;
1131 hashed_process_data
->x
.middle_used
= TRUE
;
1132 hashed_process_data
->x
.middle_marked
= FALSE
;
1134 /* Calculate the next good time */
1135 convert_pixels_to_time(width
, x
+1, time_window
,
1136 &hashed_process_data
->next_good_time
);
1143 int before_execmode_hook_trap(void *hook_data
, void *call_data
)
1145 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
1146 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
1147 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1149 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1151 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1152 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1155 e
= ltt_tracefile_get_event(tfc
->tf
);
1157 LttTime evtime
= ltt_event_time(e
);
1159 LttTrace
*trace
= tfc
->t_context
->t
;
1161 /* we are in a execmode, before the state update. We must draw the
1162 * items corresponding to the state before it changes : now is the right
1168 guint cpu
= tfs
->cpu
;
1170 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
)));
1171 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
)));
1172 if(ev_id_entry
== e
->event_id
) {
1173 trap
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1175 else if(ev_id_exit
== e
->event_id
) {
1176 trap
= ts
->cpu_states
[cpu
].last_trap
;
1182 guint trace_num
= ts
->parent
.index
;
1184 /* Well, the process_out existed : we must get it in the process hash
1185 * or add it, and draw its items.
1187 /* Add process to process list (if not present) */
1188 guint pl_height
= 0;
1189 HashedResourceData
*hashed_process_data
= NULL
;
1190 ProcessList
*process_list
= resourceview_data
->process_list
;
1192 hashed_process_data
= resourcelist_obtain_trap(resourceview_data
, trace_num
, trap
);
1194 /* Now, the process is in the state hash and our own process hash.
1195 * We definitely can draw the items related to the ending state.
1198 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1201 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1202 TimeWindow time_window
=
1203 lttvwindow_get_time_window(resourceview_data
->tab
);
1206 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1207 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1209 #endif //EXTRA_CHECK
1210 Drawing_t
*drawing
= resourceview_data
->drawing
;
1211 guint width
= drawing
->width
;
1213 convert_time_to_pixels(
1219 /* Draw collision indicator */
1220 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1221 gdk_draw_point(hashed_process_data
->pixmap
,
1224 COLLISION_POSITION(hashed_process_data
->height
));
1225 hashed_process_data
->x
.middle_marked
= TRUE
;
1229 TimeWindow time_window
=
1230 lttvwindow_get_time_window(resourceview_data
->tab
);
1233 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1234 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1236 #endif //EXTRA_CHECK
1237 Drawing_t
*drawing
= resourceview_data
->drawing
;
1238 guint width
= drawing
->width
;
1241 convert_time_to_pixels(
1248 /* Jump over draw if we are at the same x position */
1249 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1250 hashed_process_data
->x
.middle_used
))
1252 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1253 /* Draw collision indicator */
1254 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1255 gdk_draw_point(hashed_process_data
->pixmap
,
1258 COLLISION_POSITION(hashed_process_data
->height
));
1259 hashed_process_data
->x
.middle_marked
= TRUE
;
1265 DrawContext draw_context
;
1266 /* Now create the drawing context that will be used to draw
1267 * items related to the last state. */
1268 draw_context
.drawable
= hashed_process_data
->pixmap
;
1269 draw_context
.gc
= drawing
->gc
;
1270 draw_context
.pango_layout
= drawing
->pango_layout
;
1271 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1272 draw_context
.drawinfo
.end
.x
= x
;
1274 draw_context
.drawinfo
.y
.over
= 1;
1275 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1276 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1278 draw_context
.drawinfo
.start
.offset
.over
= 0;
1279 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1280 draw_context
.drawinfo
.start
.offset
.under
= 0;
1281 draw_context
.drawinfo
.end
.offset
.over
= 0;
1282 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1283 draw_context
.drawinfo
.end
.offset
.under
= 0;
1287 PropertiesLine prop_line
;
1288 prop_line
.line_width
= STATE_LINE_WIDTH
;
1289 prop_line
.style
= GDK_LINE_SOLID
;
1290 prop_line
.y
= MIDDLE
;
1291 trap_set_line_color(&prop_line
, &ts
->trap_states
[trap
]);
1292 draw_line((void*)&prop_line
, (void*)&draw_context
);
1294 /* become the last x position */
1295 hashed_process_data
->x
.middle
= x
;
1296 hashed_process_data
->x
.middle_used
= TRUE
;
1297 hashed_process_data
->x
.middle_marked
= FALSE
;
1299 /* Calculate the next good time */
1300 convert_pixels_to_time(width
, x
+1, time_window
,
1301 &hashed_process_data
->next_good_time
);
1309 int before_bdev_event_hook(void *hook_data
, void *call_data
)
1311 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
1312 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
1313 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1315 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
1317 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
1318 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
1321 e
= ltt_tracefile_get_event(tfc
->tf
);
1323 LttTime evtime
= ltt_event_time(e
);
1325 /* we are in a execmode, before the state update. We must draw the
1326 * items corresponding to the state before it changes : now is the right
1331 guint cpu
= tfs
->cpu
;
1332 guint8 major
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 0));
1333 guint8 minor
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 1));
1334 guint oper
= ltt_event_get_long_unsigned(e
, lttv_trace_get_hook_field(th
, 2));
1335 gint devcode_gint
= MKDEV(major
,minor
);
1337 guint trace_num
= ts
->parent
.index
;
1339 LttvBdevState
*bdev
= g_hash_table_lookup(ts
->bdev_states
, &devcode_gint
);
1340 /* the result of the lookup might be NULL. that's ok, the rest of the function
1341 should understand it was not found and that its state is unknown */
1343 /* Well, the process_out existed : we must get it in the process hash
1344 * or add it, and draw its items.
1346 /* Add process to process list (if not present) */
1347 guint pl_height
= 0;
1348 HashedResourceData
*hashed_process_data
= NULL
;
1349 ProcessList
*process_list
= resourceview_data
->process_list
;
1350 // LttTime birth = process->creation_time;
1352 // if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) {
1353 // hashed_process_data = process_list->current_hash_data[trace_num][cpu];
1355 hashed_process_data
= resourcelist_obtain_bdev(resourceview_data
, trace_num
, devcode_gint
);
1356 ////hashed_process_data = processlist_get_process_data(process_list, resourceq, trace_num);
1357 // hashed_process_data = processlist_get_process_data(process_list,
1363 /* Set the current process */
1364 // process_list->current_hash_data[trace_num][process->cpu] =
1365 // hashed_process_data;
1368 /* Now, the process is in the state hash and our own process hash.
1369 * We definitely can draw the items related to the ending state.
1372 if(likely(ltt_time_compare(hashed_process_data
->next_good_time
,
1375 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1376 TimeWindow time_window
=
1377 lttvwindow_get_time_window(resourceview_data
->tab
);
1380 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1381 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1383 #endif //EXTRA_CHECK
1384 Drawing_t
*drawing
= resourceview_data
->drawing
;
1385 guint width
= drawing
->width
;
1387 convert_time_to_pixels(
1393 /* Draw collision indicator */
1394 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1395 gdk_draw_point(hashed_process_data
->pixmap
,
1398 COLLISION_POSITION(hashed_process_data
->height
));
1399 hashed_process_data
->x
.middle_marked
= TRUE
;
1403 TimeWindow time_window
=
1404 lttvwindow_get_time_window(resourceview_data
->tab
);
1407 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1408 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1410 #endif //EXTRA_CHECK
1411 Drawing_t
*drawing
= resourceview_data
->drawing
;
1412 guint width
= drawing
->width
;
1415 convert_time_to_pixels(
1422 /* Jump over draw if we are at the same x position */
1423 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1424 hashed_process_data
->x
.middle_used
))
1426 if(unlikely(hashed_process_data
->x
.middle_marked
== FALSE
)) {
1427 /* Draw collision indicator */
1428 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1429 gdk_draw_point(hashed_process_data
->pixmap
,
1432 COLLISION_POSITION(hashed_process_data
->height
));
1433 hashed_process_data
->x
.middle_marked
= TRUE
;
1439 DrawContext draw_context
;
1440 /* Now create the drawing context that will be used to draw
1441 * items related to the last state. */
1442 draw_context
.drawable
= hashed_process_data
->pixmap
;
1443 draw_context
.gc
= drawing
->gc
;
1444 draw_context
.pango_layout
= drawing
->pango_layout
;
1445 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1446 draw_context
.drawinfo
.end
.x
= x
;
1448 draw_context
.drawinfo
.y
.over
= 1;
1449 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1450 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1452 draw_context
.drawinfo
.start
.offset
.over
= 0;
1453 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1454 draw_context
.drawinfo
.start
.offset
.under
= 0;
1455 draw_context
.drawinfo
.end
.offset
.over
= 0;
1456 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1457 draw_context
.drawinfo
.end
.offset
.under
= 0;
1461 PropertiesLine prop_line
;
1462 prop_line
.line_width
= STATE_LINE_WIDTH
;
1463 prop_line
.style
= GDK_LINE_SOLID
;
1464 prop_line
.y
= MIDDLE
;
1465 bdev_set_line_color(&prop_line
, bdev
);
1466 draw_line((void*)&prop_line
, (void*)&draw_context
);
1468 /* become the last x position */
1469 hashed_process_data
->x
.middle
= x
;
1470 hashed_process_data
->x
.middle_used
= TRUE
;
1471 hashed_process_data
->x
.middle_marked
= FALSE
;
1473 /* Calculate the next good time */
1474 convert_pixels_to_time(width
, x
+1, time_window
,
1475 &hashed_process_data
->next_good_time
);
1482 gint
update_time_window_hook(void *hook_data
, void *call_data
)
1484 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1485 Drawing_t
*drawing
= resourceview_data
->drawing
;
1486 ProcessList
*process_list
= resourceview_data
->process_list
;
1488 const TimeWindowNotifyData
*time_window_nofify_data
=
1489 ((const TimeWindowNotifyData
*)call_data
);
1491 TimeWindow
*old_time_window
=
1492 time_window_nofify_data
->old_time_window
;
1493 TimeWindow
*new_time_window
=
1494 time_window_nofify_data
->new_time_window
;
1496 /* Update the ruler */
1497 drawing_update_ruler(resourceview_data
->drawing
,
1501 /* Two cases : zoom in/out or scrolling */
1503 /* In order to make sure we can reuse the old drawing, the scale must
1504 * be the same and the new time interval being partly located in the
1505 * currently shown time interval. (reuse is only for scrolling)
1508 g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
1509 old_time_window
->start_time
.tv_sec
,
1510 old_time_window
->start_time
.tv_nsec
,
1511 old_time_window
->time_width
.tv_sec
,
1512 old_time_window
->time_width
.tv_nsec
);
1514 g_info("New time window HOOK : %lu, %lu to %lu, %lu",
1515 new_time_window
->start_time
.tv_sec
,
1516 new_time_window
->start_time
.tv_nsec
,
1517 new_time_window
->time_width
.tv_sec
,
1518 new_time_window
->time_width
.tv_nsec
);
1520 if( new_time_window
->time_width
.tv_sec
== old_time_window
->time_width
.tv_sec
1521 && new_time_window
->time_width
.tv_nsec
== old_time_window
->time_width
.tv_nsec
)
1523 /* Same scale (scrolling) */
1524 g_info("scrolling");
1525 LttTime
*ns
= &new_time_window
->start_time
;
1526 LttTime
*nw
= &new_time_window
->time_width
;
1527 LttTime
*os
= &old_time_window
->start_time
;
1528 LttTime
*ow
= &old_time_window
->time_width
;
1529 LttTime old_end
= old_time_window
->end_time
;
1530 LttTime new_end
= new_time_window
->end_time
;
1532 //if(ns<os+w && os+w<ns+w)
1533 //if(ns<old_end && os<ns)
1534 if(ltt_time_compare(*ns
, old_end
) == -1
1535 && ltt_time_compare(*os
, *ns
) == -1)
1537 g_info("scrolling near right");
1538 /* Scroll right, keep right part of the screen */
1540 guint width
= resourceview_data
->drawing
->width
;
1541 convert_time_to_pixels(
1547 /* Copy old data to new location */
1548 copy_pixmap_region(process_list
,
1550 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1554 resourceview_data
->drawing
->width
-x
+SAFETY
, -1);
1556 if(drawing
->damage_begin
== drawing
->damage_end
)
1557 drawing
->damage_begin
= resourceview_data
->drawing
->width
-x
;
1559 drawing
->damage_begin
= 0;
1561 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1563 /* Clear the data request background, but not SAFETY */
1564 rectangle_pixmap(process_list
,
1565 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1567 drawing
->damage_begin
+SAFETY
, 0,
1568 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1570 gtk_widget_queue_draw(drawing
->drawing_area
);
1572 /* Get new data for the rest. */
1573 drawing_data_request(resourceview_data
->drawing
,
1574 drawing
->damage_begin
, 0,
1575 drawing
->damage_end
- drawing
->damage_begin
,
1576 resourceview_data
->drawing
->height
);
1578 if(ltt_time_compare(*ns
,*os
) == -1
1579 && ltt_time_compare(*os
,new_end
) == -1)
1581 g_info("scrolling near left");
1582 /* Scroll left, keep left part of the screen */
1584 guint width
= resourceview_data
->drawing
->width
;
1585 convert_time_to_pixels(
1591 /* Copy old data to new location */
1592 copy_pixmap_region (process_list
,
1594 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1600 if(drawing
->damage_begin
== drawing
->damage_end
)
1601 drawing
->damage_end
= x
;
1603 drawing
->damage_end
=
1604 resourceview_data
->drawing
->width
;
1606 drawing
->damage_begin
= 0;
1608 rectangle_pixmap (process_list
,
1609 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1611 drawing
->damage_begin
, 0,
1612 drawing
->damage_end
- drawing
->damage_begin
, // do not overlap
1615 gtk_widget_queue_draw(drawing
->drawing_area
);
1617 /* Get new data for the rest. */
1618 drawing_data_request(resourceview_data
->drawing
,
1619 drawing
->damage_begin
, 0,
1620 drawing
->damage_end
- drawing
->damage_begin
,
1621 resourceview_data
->drawing
->height
);
1624 if(ltt_time_compare(*ns
,*os
) == 0)
1626 g_info("not scrolling");
1628 g_info("scrolling far");
1629 /* Cannot reuse any part of the screen : far jump */
1632 rectangle_pixmap (process_list
,
1633 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1636 resourceview_data
->drawing
->width
+SAFETY
, // do not overlap
1639 gtk_widget_queue_draw(drawing
->drawing_area
);
1641 drawing
->damage_begin
= 0;
1642 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1644 drawing_data_request(resourceview_data
->drawing
,
1646 resourceview_data
->drawing
->width
,
1647 resourceview_data
->drawing
->height
);
1653 /* Different scale (zoom) */
1656 rectangle_pixmap (process_list
,
1657 resourceview_data
->drawing
->drawing_area
->style
->black_gc
,
1660 resourceview_data
->drawing
->width
+SAFETY
, // do not overlap
1663 gtk_widget_queue_draw(drawing
->drawing_area
);
1665 drawing
->damage_begin
= 0;
1666 drawing
->damage_end
= resourceview_data
->drawing
->width
;
1668 drawing_data_request(resourceview_data
->drawing
,
1670 resourceview_data
->drawing
->width
,
1671 resourceview_data
->drawing
->height
);
1674 /* Update directly when scrolling */
1675 gdk_window_process_updates(resourceview_data
->drawing
->drawing_area
->window
,
1681 gint
traceset_notify(void *hook_data
, void *call_data
)
1683 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1684 Drawing_t
*drawing
= resourceview_data
->drawing
;
1686 if(unlikely(drawing
->gc
== NULL
)) {
1689 if(drawing
->dotted_gc
== NULL
) {
1693 drawing_clear(resourceview_data
->drawing
);
1694 processlist_clear(resourceview_data
->process_list
);
1695 gtk_widget_set_size_request(
1696 resourceview_data
->drawing
->drawing_area
,
1697 -1, processlist_get_height(resourceview_data
->process_list
));
1698 redraw_notify(resourceview_data
, NULL
);
1700 request_background_data(resourceview_data
);
1705 gint
redraw_notify(void *hook_data
, void *call_data
)
1707 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1708 Drawing_t
*drawing
= resourceview_data
->drawing
;
1709 GtkWidget
*widget
= drawing
->drawing_area
;
1711 drawing
->damage_begin
= 0;
1712 drawing
->damage_end
= drawing
->width
;
1714 /* fun feature, to be separated someday... */
1715 drawing_clear(resourceview_data
->drawing
);
1716 processlist_clear(resourceview_data
->process_list
);
1717 gtk_widget_set_size_request(
1718 resourceview_data
->drawing
->drawing_area
,
1719 -1, processlist_get_height(resourceview_data
->process_list
));
1721 rectangle_pixmap (resourceview_data
->process_list
,
1722 widget
->style
->black_gc
,
1725 drawing
->alloc_width
,
1728 gtk_widget_queue_draw(drawing
->drawing_area
);
1730 if(drawing
->damage_begin
< drawing
->damage_end
)
1732 drawing_data_request(drawing
,
1733 drawing
->damage_begin
,
1735 drawing
->damage_end
-drawing
->damage_begin
,
1744 gint
continue_notify(void *hook_data
, void *call_data
)
1746 ControlFlowData
*resourceview_data
= (ControlFlowData
*) hook_data
;
1747 Drawing_t
*drawing
= resourceview_data
->drawing
;
1749 if(drawing
->damage_begin
< drawing
->damage_end
)
1751 drawing_data_request(drawing
,
1752 drawing
->damage_begin
,
1754 drawing
->damage_end
-drawing
->damage_begin
,
1762 gint
update_current_time_hook(void *hook_data
, void *call_data
)
1764 ControlFlowData
*resourceview_data
= (ControlFlowData
*)hook_data
;
1765 Drawing_t
*drawing
= resourceview_data
->drawing
;
1767 LttTime current_time
= *((LttTime
*)call_data
);
1769 TimeWindow time_window
=
1770 lttvwindow_get_time_window(resourceview_data
->tab
);
1772 LttTime time_begin
= time_window
.start_time
;
1773 LttTime width
= time_window
.time_width
;
1776 guint64 time_ll
= ltt_time_to_uint64(width
);
1777 time_ll
= time_ll
>> 1; /* divide by two */
1778 half_width
= ltt_time_from_uint64(time_ll
);
1780 LttTime time_end
= ltt_time_add(time_begin
, width
);
1782 LttvTracesetContext
* tsc
=
1783 lttvwindow_get_traceset_context(resourceview_data
->tab
);
1785 LttTime trace_start
= tsc
->time_span
.start_time
;
1786 LttTime trace_end
= tsc
->time_span
.end_time
;
1788 g_info("New current time HOOK : %lu, %lu", current_time
.tv_sec
,
1789 current_time
.tv_nsec
);
1791 /* If current time is inside time interval, just move the highlight
1794 /* Else, we have to change the time interval. We have to tell it
1795 * to the main window. */
1796 /* The time interval change will take care of placing the current
1797 * time at the center of the visible area, or nearest possible if we are
1798 * at one end of the trace. */
1801 if(ltt_time_compare(current_time
, time_begin
) < 0)
1803 TimeWindow new_time_window
;
1805 if(ltt_time_compare(current_time
,
1806 ltt_time_add(trace_start
,half_width
)) < 0)
1807 time_begin
= trace_start
;
1809 time_begin
= ltt_time_sub(current_time
,half_width
);
1811 new_time_window
.start_time
= time_begin
;
1812 new_time_window
.time_width
= width
;
1813 new_time_window
.time_width_double
= ltt_time_to_double(width
);
1814 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
1816 lttvwindow_report_time_window(resourceview_data
->tab
, new_time_window
);
1818 else if(ltt_time_compare(current_time
, time_end
) > 0)
1820 TimeWindow new_time_window
;
1822 if(ltt_time_compare(current_time
, ltt_time_sub(trace_end
, half_width
)) > 0)
1823 time_begin
= ltt_time_sub(trace_end
,width
);
1825 time_begin
= ltt_time_sub(current_time
,half_width
);
1827 new_time_window
.start_time
= time_begin
;
1828 new_time_window
.time_width
= width
;
1829 new_time_window
.time_width_double
= ltt_time_to_double(width
);
1830 new_time_window
.end_time
= ltt_time_add(time_begin
, width
);
1832 lttvwindow_report_time_window(resourceview_data
->tab
, new_time_window
);
1835 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
1837 /* Update directly when scrolling */
1838 gdk_window_process_updates(resourceview_data
->drawing
->drawing_area
->window
,
1844 typedef struct _ClosureData
{
1845 EventsRequest
*events_request
;
1846 LttvTracesetState
*tss
;
1851 /* Draw line until end of the screen */
1853 void draw_closure(gpointer key
, gpointer value
, gpointer user_data
)
1855 ResourceUniqueNumeric
*process_info
= (ResourceUniqueNumeric
*)key
;
1856 HashedResourceData
*hashed_process_data
= (HashedResourceData
*)value
;
1857 ClosureData
*closure_data
= (ClosureData
*)user_data
;
1859 EventsRequest
*events_request
= closure_data
->events_request
;
1860 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
1862 LttvTracesetState
*tss
= closure_data
->tss
;
1863 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)tss
;
1865 LttTime evtime
= closure_data
->end_time
;
1867 gboolean dodraw
= TRUE
;
1869 if(hashed_process_data
->type
== RV_RESOURCE_MACHINE
)
1873 /* For the process */
1874 /* First, check if the current process is in the state computation
1875 * process list. If it is there, that means we must add it right now and
1876 * draw items from the beginning of the read for it. If it is not
1877 * present, it's a new process and it was not present : it will
1878 * be added after the state update. */
1880 g_assert(lttv_traceset_number(tsc
->ts
) > 0);
1881 #endif //EXTRA_CHECK
1882 LttvTraceContext
*tc
= tsc
->traces
[process_info
->trace_num
];
1883 LttvTraceState
*ts
= (LttvTraceState
*)tc
;
1885 /* Only draw for processes that are currently in the trace states */
1887 ProcessList
*process_list
= resourceview_data
->process_list
;
1889 /* Should be alike when background info is ready */
1890 if(resourceview_data
->background_info_waiting
==0)
1891 g_assert(ltt_time_compare(process
->creation_time
,
1892 process_info
->birth
) == 0);
1893 #endif //EXTRA_CHECK
1895 /* Now, the process is in the state hash and our own process hash.
1896 * We definitely can draw the items related to the ending state.
1899 if(unlikely(ltt_time_compare(hashed_process_data
->next_good_time
,
1902 TimeWindow time_window
=
1903 lttvwindow_get_time_window(resourceview_data
->tab
);
1906 if(ltt_time_compare(evtime
, time_window
.start_time
) == -1
1907 || ltt_time_compare(evtime
, time_window
.end_time
) == 1)
1909 #endif //EXTRA_CHECK
1910 Drawing_t
*drawing
= resourceview_data
->drawing
;
1911 guint width
= drawing
->width
;
1913 guint x
= closure_data
->x_end
;
1915 DrawContext draw_context
;
1917 /* Now create the drawing context that will be used to draw
1918 * items related to the last state. */
1919 draw_context
.drawable
= hashed_process_data
->pixmap
;
1920 draw_context
.gc
= drawing
->gc
;
1921 draw_context
.pango_layout
= drawing
->pango_layout
;
1922 draw_context
.drawinfo
.end
.x
= x
;
1924 draw_context
.drawinfo
.y
.over
= 1;
1925 draw_context
.drawinfo
.y
.middle
= (hashed_process_data
->height
/2);
1926 draw_context
.drawinfo
.y
.under
= hashed_process_data
->height
;
1928 draw_context
.drawinfo
.start
.offset
.over
= 0;
1929 draw_context
.drawinfo
.start
.offset
.middle
= 0;
1930 draw_context
.drawinfo
.start
.offset
.under
= 0;
1931 draw_context
.drawinfo
.end
.offset
.over
= 0;
1932 draw_context
.drawinfo
.end
.offset
.middle
= 0;
1933 draw_context
.drawinfo
.end
.offset
.under
= 0;
1935 /* Jump over draw if we are at the same x position */
1936 if(x
== hashed_process_data
->x
.over
)
1940 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.over
;
1942 PropertiesLine prop_line
= prepare_execmode_line(process
);
1943 draw_line((void*)&prop_line
, (void*)&draw_context
);
1945 hashed_process_data
->x
.over
= x
;
1949 if(unlikely(x
== hashed_process_data
->x
.middle
&&
1950 hashed_process_data
->x
.middle_used
)) {
1951 #if 0 /* do not mark closure : not missing information */
1952 if(hashed_process_data
->x
.middle_marked
== FALSE
) {
1953 /* Draw collision indicator */
1954 gdk_gc_set_foreground(drawing
->gc
, &drawing_colors
[COL_WHITE
]);
1955 gdk_draw_point(drawing
->pixmap
,
1959 hashed_process_data
->x
.middle_marked
= TRUE
;
1964 draw_context
.drawinfo
.start
.x
= hashed_process_data
->x
.middle
;
1967 PropertiesLine prop_line
;
1968 prop_line
.line_width
= STATE_LINE_WIDTH
;
1969 prop_line
.style
= GDK_LINE_SOLID
;
1970 prop_line
.y
= MIDDLE
;
1971 if(hashed_process_data
->type
== RV_RESOURCE_CPU
)
1972 cpu_set_line_color(&prop_line
, &ts
->cpu_states
[process_info
->id
]);
1973 else if(hashed_process_data
->type
== RV_RESOURCE_IRQ
)
1974 irq_set_line_color(&prop_line
, &ts
->irq_states
[process_info
->id
]);
1975 else if(hashed_process_data
->type
== RV_RESOURCE_SOFT_IRQ
)
1976 soft_irq_set_line_color(&prop_line
, &ts
->soft_irq_states
[process_info
->id
]);
1977 else if(hashed_process_data
->type
== RV_RESOURCE_TRAP
)
1978 trap_set_line_color(&prop_line
, &ts
->trap_states
[process_info
->id
]);
1979 else if(hashed_process_data
->type
== RV_RESOURCE_BDEV
) {
1980 gint devcode_gint
= process_info
->id
;
1981 LttvBdevState
*bdev
= g_hash_table_lookup(ts
->bdev_states
, &devcode_gint
);
1982 // the lookup may return null; bdev_set_line_color must act appropriately
1983 bdev_set_line_color(&prop_line
, bdev
);
1986 draw_line((void*)&prop_line
, (void*)&draw_context
);
1989 /* become the last x position */
1990 if(likely(x
!= hashed_process_data
->x
.middle
)) {
1991 hashed_process_data
->x
.middle
= x
;
1992 /* but don't use the pixel */
1993 hashed_process_data
->x
.middle_used
= FALSE
;
1995 /* Calculate the next good time */
1996 convert_pixels_to_time(width
, x
+1, time_window
,
1997 &hashed_process_data
->next_good_time
);
2004 int before_chunk(void *hook_data
, void *call_data
)
2006 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2007 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2008 ControlFlowData
*cfd
= (ControlFlowData
*)events_request
->viewer_data
;
2010 /* Deactivate sort */
2011 gtk_tree_sortable_set_sort_column_id(
2012 GTK_TREE_SORTABLE(cfd
->process_list
->list_store
),
2014 GTK_SORT_ASCENDING
);
2016 drawing_chunk_begin(events_request
, tss
);
2021 int before_request(void *hook_data
, void *call_data
)
2023 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2024 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2026 drawing_data_request_begin(events_request
, tss
);
2033 * after request is necessary in addition of after chunk in order to draw
2034 * lines until the end of the screen. after chunk just draws lines until
2041 int after_request(void *hook_data
, void *call_data
)
2044 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2045 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2046 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2048 ProcessList
*process_list
= resourceview_data
->process_list
;
2049 LttTime end_time
= events_request
->end_time
;
2051 ClosureData closure_data
;
2052 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2053 closure_data
.tss
= tss
;
2054 closure_data
.end_time
= end_time
;
2056 TimeWindow time_window
=
2057 lttvwindow_get_time_window(resourceview_data
->tab
);
2058 guint width
= resourceview_data
->drawing
->width
;
2059 convert_time_to_pixels(
2063 &closure_data
.x_end
);
2066 /* Draw last items */
2067 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2068 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2069 (void*)&closure_data
);
2072 /* Request expose */
2073 drawing_request_expose(events_request
, tss
, end_time
);
2082 int after_chunk(void *hook_data
, void *call_data
)
2084 EventsRequest
*events_request
= (EventsRequest
*)hook_data
;
2085 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2086 LttvTracesetState
*tss
= (LttvTracesetState
*)call_data
;
2087 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)call_data
;
2088 LttvTracefileContext
*tfc
= lttv_traceset_context_get_current_tfc(tsc
);
2091 ProcessList
*process_list
= resourceview_data
->process_list
;
2093 LttvTraceset
*traceset
= tsc
->ts
;
2094 guint nb_trace
= lttv_traceset_number(traceset
);
2096 /* Only execute when called for the first trace's events request */
2097 if(!process_list
->current_hash_data
) return;
2099 for(i
= 0 ; i
< nb_trace
; i
++) {
2100 g_free(process_list
->current_hash_data
[i
]);
2102 g_free(process_list
->current_hash_data
);
2103 process_list
->current_hash_data
= NULL
;
2106 end_time
= LTT_TIME_MIN(tfc
->timestamp
, events_request
->end_time
);
2107 else /* end of traceset, or position now out of request : end */
2108 end_time
= events_request
->end_time
;
2110 ClosureData closure_data
;
2111 closure_data
.events_request
= (EventsRequest
*)hook_data
;
2112 closure_data
.tss
= tss
;
2113 closure_data
.end_time
= end_time
;
2115 TimeWindow time_window
=
2116 lttvwindow_get_time_window(resourceview_data
->tab
);
2117 guint width
= resourceview_data
->drawing
->width
;
2118 convert_time_to_pixels(
2122 &closure_data
.x_end
);
2124 /* Draw last items */
2125 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2126 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2127 (void*)&closure_data
);
2130 /* Reactivate sort */
2131 gtk_tree_sortable_set_sort_column_id(
2132 GTK_TREE_SORTABLE(resourceview_data
->process_list
->list_store
),
2133 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2134 GTK_SORT_ASCENDING
);
2136 update_index_to_pixmap(resourceview_data
->process_list
);
2137 /* Request a full expose : drawing scrambled */
2138 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
2140 /* Request expose (updates damages zone also) */
2141 drawing_request_expose(events_request
, tss
, end_time
);
2146 /* after_statedump_end
2148 * @param hook_data ControlFlowData structure of the viewer.
2149 * @param call_data Event context.
2151 * This function adds items to be drawn in a queue for each process.
2154 int before_statedump_end(void *hook_data
, void *call_data
)
2158 LttvTraceHook
*th
= (LttvTraceHook
*)hook_data
;
2159 EventsRequest
*events_request
= (EventsRequest
*)th
->hook_data
;
2160 ControlFlowData
*resourceview_data
= events_request
->viewer_data
;
2162 LttvTracefileContext
*tfc
= (LttvTracefileContext
*)call_data
;
2164 LttvTracefileState
*tfs
= (LttvTracefileState
*)call_data
;
2166 LttvTraceState
*ts
= (LttvTraceState
*)tfc
->t_context
;
2168 LttvTracesetState
*tss
= (LttvTracesetState
*)tfc
->t_context
->ts_context
;
2169 ProcessList
*process_list
= resourceview_data
->process_list
;
2172 e
= ltt_tracefile_get_event(tfc
->tf
);
2174 LttvFilter
*filter
= resourceview_data
->filter
;
2175 if(filter
!= NULL
&& filter
->head
!= NULL
)
2176 if(!lttv_filter_tree_parse(filter
->head
,e
,tfc
->tf
,
2177 tfc
->t_context
->t
,tfc
,NULL
,NULL
))
2180 LttTime evtime
= ltt_event_time(e
);
2182 ClosureData closure_data
;
2183 closure_data
.events_request
= events_request
;
2184 closure_data
.tss
= tss
;
2185 closure_data
.end_time
= evtime
;
2187 TimeWindow time_window
=
2188 lttvwindow_get_time_window(resourceview_data
->tab
);
2189 guint width
= resourceview_data
->drawing
->width
;
2190 convert_time_to_pixels(
2194 &closure_data
.x_end
);
2196 /* Draw last items */
2198 for(i
=0; i
<RV_RESOURCE_COUNT
; i
++) {
2199 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data
, i
), draw_closure
,
2200 (void*)&closure_data
);
2203 /* Reactivate sort */
2204 gtk_tree_sortable_set_sort_column_id(
2205 GTK_TREE_SORTABLE(resourceview_data
->process_list
->list_store
),
2206 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
,
2207 GTK_SORT_ASCENDING
);
2209 update_index_to_pixmap(resourceview_data
->process_list
);
2210 /* Request a full expose : drawing scrambled */
2211 gtk_widget_queue_draw(resourceview_data
->drawing
->drawing_area
);
2213 /* Request expose (updates damages zone also) */
2214 drawing_request_expose(events_request
, tss
, evtime
);