update compat
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / eventhooks.c
CommitLineData
ce0214a6 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
3 *
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;
7 *
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.
12 *
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,
16 * MA 02111-1307, USA.
17 */
18
19
f0d936c0 20/*****************************************************************************
21 * Hooks to be called by the main window *
22 *****************************************************************************/
23
f0d936c0 24
b9a010a2 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.
27 *
e92eabaf 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.
b9a010a2 31 *
e92eabaf 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.
b9a010a2 34 *
e92eabaf 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
b9a010a2 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
e92eabaf 40 * corresponding to it is over, which happens to be at the next before_schedchange
b9a010a2 41 * hook.
42 *
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
45 * line/background.
46 */
47
4e4d11b3 48#ifdef HAVE_CONFIG_H
49#include <config.h>
50#endif
b9a010a2 51
cf6cb7e0 52//#define PANGO_ENABLE_BACKEND
558aa013 53#include <gtk/gtk.h>
54#include <gdk/gdk.h>
5f16133f 55#include <glib.h>
80a52ff8 56#include <assert.h>
50439712 57#include <string.h>
319e9d81 58#include <stdio.h>
5f16133f 59
cf6cb7e0 60//#include <pango/pango.h>
61
80a52ff8 62#include <ltt/event.h>
4ba42155 63#include <ltt/time.h>
50439712 64#include <ltt/type.h>
2c82c4dc 65#include <ltt/trace.h>
80a52ff8 66
2a2fa4f0 67#include <lttv/lttv.h>
558aa013 68#include <lttv/hook.h>
80a52ff8 69#include <lttv/state.h>
2d262115 70#include <lttvwindow/lttvwindow.h>
6395d57c 71#include <lttvwindow/lttvwindowtraces.h>
0de51231 72#include <lttvwindow/support.h>
80a52ff8 73
f0d936c0 74
a117e3f7 75#include "eventhooks.h"
76#include "cfv.h"
77#include "processlist.h"
78#include "drawing.h"
5f16133f 79
80a52ff8 80
1a31868c 81#define MAX_PATH_LEN 256
82
0de51231 83extern GSList *g_legend_list;
84
b9a010a2 85
6395d57c 86/* Action to do when background computation completed.
87 *
e800cf84 88 * Wait for all the awaited computations to be over.
6395d57c 89 */
90
703b25fa 91static gint background_ready(void *hook_data, void *call_data)
6395d57c 92{
93 ControlFlowData *control_flow_data = (ControlFlowData *)hook_data;
94 LttvTrace *trace = (LttvTrace*)call_data;
95
e800cf84 96 control_flow_data->background_info_waiting--;
97
98 if(control_flow_data->background_info_waiting == 0) {
4a24fa1f 99 g_message("control flow viewer : background computation data ready.");
6395d57c 100
e800cf84 101 drawing_clear(control_flow_data->drawing);
102 processlist_clear(control_flow_data->process_list);
07390ec1 103 gtk_widget_set_size_request(
104 control_flow_data->drawing->drawing_area,
105 -1, processlist_get_height(control_flow_data->process_list));
e800cf84 106 redraw_notify(control_flow_data, NULL);
b9a010a2 107 }
6395d57c 108
109 return 0;
110}
111
112
113/* Request background computation. Verify if it is in progress or ready first.
e800cf84 114 * Only for each trace in the tab's traceset.
6395d57c 115 */
3f7f592e 116static void request_background_data(ControlFlowData *control_flow_data)
6395d57c 117{
e800cf84 118 LttvTracesetContext * tsc =
119 lttvwindow_get_traceset_context(control_flow_data->tab);
120 gint num_traces = lttv_traceset_number(tsc->ts);
6395d57c 121 gint i;
122 LttvTrace *trace;
123
124 LttvHooks *background_ready_hook =
125 lttv_hooks_new();
126 lttv_hooks_add(background_ready_hook, background_ready, control_flow_data,
127 LTTV_PRIO_DEFAULT);
e800cf84 128 control_flow_data->background_info_waiting = 0;
6395d57c 129
130 for(i=0;i<num_traces;i++) {
e800cf84 131 trace = lttv_traceset_get(tsc->ts, i);
6395d57c 132
133 if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE) {
134
135 if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"),
136 trace) == FALSE) {
137 /* We first remove requests that could have been done for the same
138 * information. Happens when two viewers ask for it before servicing
139 * starts.
140 */
93ac601b 141 if(!lttvwindowtraces_background_request_find(trace, "state"))
b5e17af5 142 lttvwindowtraces_background_request_queue(
143 main_window_get_widget(control_flow_data->tab), trace, "state");
6395d57c 144 lttvwindowtraces_background_notify_queue(control_flow_data,
145 trace,
146 ltt_time_infinite,
147 NULL,
148 background_ready_hook);
e800cf84 149 control_flow_data->background_info_waiting++;
6395d57c 150 } else { /* in progress */
151
152 lttvwindowtraces_background_notify_current(control_flow_data,
153 trace,
154 ltt_time_infinite,
155 NULL,
156 background_ready_hook);
e800cf84 157 control_flow_data->background_info_waiting++;
6395d57c 158 }
4368b993 159 } else {
160 /* Data ready. Be its nature, this viewer doesn't need to have
618fbcc1 161 * its data ready hook called there, because a background
4368b993 162 * request is always linked with a redraw.
163 */
6395d57c 164 }
4368b993 165
6395d57c 166 }
167
168 lttv_hooks_destroy(background_ready_hook);
169}
170
171
172
173
f0d936c0 174/**
175 * Event Viewer's constructor hook
176 *
177 * This constructor is given as a parameter to the menuitem and toolbar button
178 * registration. It creates the list.
ca0f8a8e 179 * @param tab A pointer to the parent tab.
f0d936c0 180 * @return The widget created.
181 */
182GtkWidget *
d47b33d2 183h_guicontrolflow(Tab *tab)
f0d936c0 184{
d47b33d2 185 g_info("h_guicontrolflow, %p", tab);
6cec4cd2 186 ControlFlowData *control_flow_data = guicontrolflow(tab) ;
a56a1ba4 187
ca0f8a8e 188 control_flow_data->tab = tab;
a56a1ba4 189
a56a1ba4 190 // Unreg done in the GuiControlFlow_Destructor
6395d57c 191 lttvwindow_register_traceset_notify(tab,
192 traceset_notify,
193 control_flow_data);
194
ca0f8a8e 195 lttvwindow_register_time_window_notify(tab,
224446ce 196 update_time_window_hook,
197 control_flow_data);
ca0f8a8e 198 lttvwindow_register_current_time_notify(tab,
224446ce 199 update_current_time_hook,
200 control_flow_data);
ca0f8a8e 201 lttvwindow_register_redraw_notify(tab,
202 redraw_notify,
203 control_flow_data);
204 lttvwindow_register_continue_notify(tab,
205 continue_notify,
206 control_flow_data);
667ca2a0 207 request_background_data(control_flow_data);
6395d57c 208
ca0f8a8e 209
68997a22 210 return guicontrolflow_get_widget(control_flow_data) ;
a56a1ba4 211
f0d936c0 212}
213
0de51231 214void legend_destructor(GtkWindow *legend)
215{
216 g_legend_list = g_slist_remove(g_legend_list, legend);
217}
218
219/* Create a popup legend */
220GtkWidget *
221h_legend(Tab *tab)
222{
223 g_info("h_legend, %p", tab);
224
225 GtkWindow *legend = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
226
227 g_legend_list = g_slist_append(
228 g_legend_list,
229 legend);
230
231 g_object_set_data_full(
232 G_OBJECT(legend),
233 "legend",
234 legend,
235 (GDestroyNotify)legend_destructor);
236
237 gtk_window_set_title(legend, "Control Flow View Legend");
238
239 GtkWidget *pixmap = create_pixmap(GTK_WIDGET(legend), "lttv-color-list.png");
240
241 // GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixmap(
242 // GDK_PIXMAP(pixmap), NULL));
243
244 gtk_container_add(GTK_CONTAINER(legend), GTK_WIDGET(pixmap));
245
246 gtk_widget_show(GTK_WIDGET(pixmap));
247 gtk_widget_show(GTK_WIDGET(legend));
248
249
250 return NULL; /* This is a popup window */
251}
252
253
3cff8cc1 254int event_selected_hook(void *hook_data, void *call_data)
f0d936c0 255{
68997a22 256 ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
14963be0 257 guint *event_number = (guint*) call_data;
f0d936c0 258
2a2fa4f0 259 g_debug("DEBUG : event selected by main window : %u", *event_number);
a56a1ba4 260
2eef04b5 261 return 0;
f0d936c0 262}
263
9a1ec01b 264/* Function that selects the color of status&exemode line */
6550d711 265static inline PropertiesLine prepare_s_e_line(LttvProcessState *process)
9a1ec01b 266{
267 PropertiesLine prop_line;
268 prop_line.line_width = 2;
269 prop_line.style = GDK_LINE_SOLID;
270 prop_line.y = MIDDLE;
271 //GdkColormap *colormap = gdk_colormap_get_system();
272
9a1ec01b 273 if(process->state->s == LTTV_STATE_RUN) {
274 if(process->state->t == LTTV_STATE_USER_MODE)
275 prop_line.color = drawing_colors[COL_RUN_USER_MODE];
276 else if(process->state->t == LTTV_STATE_SYSCALL)
277 prop_line.color = drawing_colors[COL_RUN_SYSCALL];
278 else if(process->state->t == LTTV_STATE_TRAP)
279 prop_line.color = drawing_colors[COL_RUN_TRAP];
280 else if(process->state->t == LTTV_STATE_IRQ)
281 prop_line.color = drawing_colors[COL_RUN_IRQ];
faf074a3 282 else if(process->state->t == LTTV_STATE_SOFT_IRQ)
283 prop_line.color = drawing_colors[COL_RUN_SOFT_IRQ];
9a1ec01b 284 else if(process->state->t == LTTV_STATE_MODE_UNKNOWN)
285 prop_line.color = drawing_colors[COL_MODE_UNKNOWN];
286 else
287 g_assert(FALSE); /* RUNNING MODE UNKNOWN */
288 } else if(process->state->s == LTTV_STATE_WAIT) {
289 /* We don't show if we wait while in user mode, trap, irq or syscall */
290 prop_line.color = drawing_colors[COL_WAIT];
291 } else if(process->state->s == LTTV_STATE_WAIT_CPU) {
292 /* We don't show if we wait for CPU while in user mode, trap, irq
293 * or syscall */
294 prop_line.color = drawing_colors[COL_WAIT_CPU];
295 } else if(process->state->s == LTTV_STATE_ZOMBIE) {
296 prop_line.color = drawing_colors[COL_ZOMBIE];
297 } else if(process->state->s == LTTV_STATE_WAIT_FORK) {
298 prop_line.color = drawing_colors[COL_WAIT_FORK];
299 } else if(process->state->s == LTTV_STATE_EXIT) {
300 prop_line.color = drawing_colors[COL_EXIT];
301 } else if(process->state->s == LTTV_STATE_UNNAMED) {
302 prop_line.color = drawing_colors[COL_UNNAMED];
303 } else
304 g_assert(FALSE); /* UNKNOWN STATE */
305
306 return prop_line;
307
308}
309
c8bba5fa 310
e92eabaf 311/* before_schedchange_hook
b9a010a2 312 *
f0d936c0 313 * This function basically draw lines and icons. Two types of lines are drawn :
314 * one small (3 pixels?) representing the state of the process and the second
315 * type is thicker (10 pixels?) representing on which CPU a process is running
316 * (and this only in running state).
317 *
318 * Extremums of the lines :
319 * x_min : time of the last event context for this process kept in memory.
320 * x_max : time of the current event.
321 * y : middle of the process in the process list. The process is found in the
322 * list, therefore is it's position in pixels.
323 *
324 * The choice of lines'color is defined by the context of the last event for this
325 * process.
326 */
b9a010a2 327
328
e92eabaf 329int before_schedchange_hook(void *hook_data, void *call_data)
f0d936c0 330{
2c82c4dc 331 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
332 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
b9a010a2 333 ControlFlowData *control_flow_data = events_request->viewer_data;
334
335 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
336
337 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
348c6ba8 338 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
b9a010a2 339
340 LttEvent *e;
2c82c4dc 341 e = ltt_tracefile_get_event(tfc->tf);
b9a010a2 342
343 LttTime evtime = ltt_event_time(e);
fd22065b 344
10a1069a 345 /* we are in a schedchange, before the state update. We must draw the
346 * items corresponding to the state before it changes : now is the right
347 * time to do it.
348 */
b9a010a2 349
10a1069a 350 guint pid_out;
351 guint pid_in;
352 {
2c82c4dc 353 pid_out = ltt_event_get_long_unsigned(e, thf->f1);
354 pid_in = ltt_event_get_long_unsigned(e, thf->f2);
10a1069a 355 }
356
357 {
358 /* For the pid_out */
359 /* First, check if the current process is in the state computation
360 * process list. If it is there, that means we must add it right now and
361 * draw items from the beginning of the read for it. If it is not
362 * present, it's a new process and it was not present : it will
363 * be added after the state update. */
348c6ba8 364 guint cpu = ltt_tracefile_num(tfc->tf);
365 LttvProcessState *process = ts->running_process[cpu];
40debf7b 366 /* unknown state, bad current pid */
348c6ba8 367 if(process->pid != pid_out)
800aa029 368 process = lttv_state_find_process(ts,
369 ltt_tracefile_num(tfc->tf), pid_out);
b9a010a2 370
10a1069a 371 if(process != NULL) {
372 /* Well, the process_out existed : we must get it in the process hash
373 * or add it, and draw its items.
374 */
375 /* Add process to process list (if not present) */
1c736ed5 376 guint pl_height = 0;
10a1069a 377 HashedProcessData *hashed_process_data = NULL;
5c230fc4 378 ProcessList *process_list = control_flow_data->process_list;
10a1069a 379 LttTime birth = process->creation_time;
b9a010a2 380
ac4e21cf 381 hashed_process_data = processlist_get_process_data(process_list,
10a1069a 382 pid_out,
348c6ba8 383 process->cpu,
10a1069a 384 &birth,
ac4e21cf 385 tfc->t_context->index);
386 if(hashed_process_data == NULL)
10a1069a 387 {
388 g_assert(pid_out == 0 || pid_out != process->ppid);
389 /* Process not present */
4e86ae2e 390 ProcessInfo *process_info;
1c736ed5 391 Drawing_t *drawing = control_flow_data->drawing;
10a1069a 392 processlist_add(process_list,
1c736ed5 393 drawing,
10a1069a 394 pid_out,
348c6ba8 395 process->cpu,
10a1069a 396 process->ppid,
397 &birth,
398 tfc->t_context->index,
f4b88a7d 399 process->name,
10a1069a 400 &pl_height,
4e86ae2e 401 &process_info,
10a1069a 402 &hashed_process_data);
1c736ed5 403 gtk_widget_set_size_request(drawing->drawing_area,
404 -1,
405 pl_height);
406 gtk_widget_queue_draw(drawing->drawing_area);
407
10a1069a 408 }
ac4e21cf 409
10a1069a 410 /* Now, the process is in the state hash and our own process hash.
411 * We definitely can draw the items related to the ending state.
412 */
e800cf84 413
b2743953 414 if(ltt_time_compare(hashed_process_data->next_good_time,
415 evtime) > 0)
10a1069a 416 {
b2743953 417 if(hashed_process_data->x.middle_marked == FALSE) {
ac4e21cf 418
fd22065b 419 TimeWindow time_window =
420 lttvwindow_get_time_window(control_flow_data->tab);
421#ifdef EXTRA_CHECK
422 if(ltt_time_compare(evtime, time_window.start_time) == -1
423 || ltt_time_compare(evtime, time_window.end_time) == 1)
424 return;
425#endif //EXTRA_CHECK
d6fef890 426 Drawing_t *drawing = control_flow_data->drawing;
96947fcf 427 guint width = drawing->width;
b2743953 428 guint x;
429 convert_time_to_pixels(
430 time_window,
431 evtime,
432 width,
433 &x);
434
435 /* Draw collision indicator */
436 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1c736ed5 437 gdk_draw_point(hashed_process_data->pixmap,
b2743953 438 drawing->gc,
439 x,
1c736ed5 440 (hashed_process_data->height/2)-3);
b2743953 441 hashed_process_data->x.middle_marked = TRUE;
442 }
443 } else {
ac4e21cf 444 TimeWindow time_window =
445 lttvwindow_get_time_window(control_flow_data->tab);
fd22065b 446#ifdef EXTRA_CHECK
ac4e21cf 447 if(ltt_time_compare(evtime, time_window.start_time) == -1
448 || ltt_time_compare(evtime, time_window.end_time) == 1)
449 return;
fd22065b 450#endif //EXTRA_CHECK
d6fef890 451 Drawing_t *drawing = control_flow_data->drawing;
96947fcf 452 guint width = drawing->width;
10a1069a 453 guint x;
10a1069a 454 convert_time_to_pixels(
a18124ff 455 time_window,
4b7dc462 456 evtime,
457 width,
458 &x);
10a1069a 459
10a1069a 460
4b7dc462 461 /* Jump over draw if we are at the same x position */
e72908ed 462 if(x == hashed_process_data->x.middle &&
463 hashed_process_data->x.middle_used)
e800cf84 464 {
e72908ed 465 if(hashed_process_data->x.middle_marked == FALSE) {
466 /* Draw collision indicator */
467 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1c736ed5 468 gdk_draw_point(hashed_process_data->pixmap,
e72908ed 469 drawing->gc,
470 x,
1c736ed5 471 (hashed_process_data->height/2)-3);
de4ea1ad 472 hashed_process_data->x.middle_marked = TRUE;
e72908ed 473 }
4b7dc462 474 /* jump */
475 } else {
476 DrawContext draw_context;
10a1069a 477
4b7dc462 478 /* Now create the drawing context that will be used to draw
479 * items related to the last state. */
1c736ed5 480 draw_context.drawable = hashed_process_data->pixmap;
4b7dc462 481 draw_context.gc = drawing->gc;
482 draw_context.pango_layout = drawing->pango_layout;
483 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
484 draw_context.drawinfo.end.x = x;
485
1c736ed5 486 draw_context.drawinfo.y.over = 1;
487 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
488 draw_context.drawinfo.y.under = hashed_process_data->height;
4b7dc462 489
490 draw_context.drawinfo.start.offset.over = 0;
491 draw_context.drawinfo.start.offset.middle = 0;
492 draw_context.drawinfo.start.offset.under = 0;
493 draw_context.drawinfo.end.offset.over = 0;
494 draw_context.drawinfo.end.offset.middle = 0;
495 draw_context.drawinfo.end.offset.under = 0;
496
497 {
498 /* Draw the line */
9a1ec01b 499 PropertiesLine prop_line = prepare_s_e_line(process);
4b7dc462 500 draw_line((void*)&prop_line, (void*)&draw_context);
501
502 }
503 /* become the last x position */
504 hashed_process_data->x.middle = x;
e72908ed 505 hashed_process_data->x.middle_used = TRUE;
506 hashed_process_data->x.middle_marked = FALSE;
b2743953 507
508 /* Calculate the next good time */
509 convert_pixels_to_time(width, x+1, time_window,
510 &hashed_process_data->next_good_time);
e800cf84 511 }
512 }
513 }
10a1069a 514 }
e800cf84 515
10a1069a 516 {
517 /* For the pid_in */
518 /* First, check if the current process is in the state computation
519 * process list. If it is there, that means we must add it right now and
520 * draw items from the beginning of the read for it. If it is not
521 * present, it's a new process and it was not present : it will
522 * be added after the state update. */
523 LttvProcessState *process;
800aa029 524 process = lttv_state_find_process(ts,
525 ltt_tracefile_num(tfc->tf), pid_in);
10a1069a 526
527 if(process != NULL) {
800aa029 528 /* Well, the process existed : we must get it in the process hash
10a1069a 529 * or add it, and draw its items.
530 */
531 /* Add process to process list (if not present) */
1c736ed5 532 guint pl_height = 0;
10a1069a 533 HashedProcessData *hashed_process_data = NULL;
5c230fc4 534 ProcessList *process_list = control_flow_data->process_list;
10a1069a 535 LttTime birth = process->creation_time;
e800cf84 536
ac4e21cf 537 hashed_process_data = processlist_get_process_data(process_list,
10a1069a 538 pid_in,
8e680509 539 ltt_tracefile_num(tfc->tf),
10a1069a 540 &birth,
ac4e21cf 541 tfc->t_context->index);
542 if(hashed_process_data == NULL)
10a1069a 543 {
544 g_assert(pid_in == 0 || pid_in != process->ppid);
545 /* Process not present */
4e86ae2e 546 ProcessInfo *process_info;
1c736ed5 547 Drawing_t *drawing = control_flow_data->drawing;
10a1069a 548 processlist_add(process_list,
1c736ed5 549 drawing,
10a1069a 550 pid_in,
8e680509 551 ltt_tracefile_num(tfc->tf),
10a1069a 552 process->ppid,
553 &birth,
554 tfc->t_context->index,
f4b88a7d 555 process->name,
10a1069a 556 &pl_height,
4e86ae2e 557 &process_info,
10a1069a 558 &hashed_process_data);
1c736ed5 559 gtk_widget_set_size_request(drawing->drawing_area,
560 -1,
561 pl_height);
562 gtk_widget_queue_draw(drawing->drawing_area);
563
10a1069a 564 }
40debf7b 565 //We could set the current process and hash here, but will be done
566 //by after schedchange hook
10a1069a 567
568 /* Now, the process is in the state hash and our own process hash.
569 * We definitely can draw the items related to the ending state.
570 */
b9a010a2 571
b2743953 572 if(ltt_time_compare(hashed_process_data->next_good_time,
573 evtime) > 0)
10a1069a 574 {
b2743953 575 if(hashed_process_data->x.middle_marked == FALSE) {
ac4e21cf 576
fd22065b 577 TimeWindow time_window =
578 lttvwindow_get_time_window(control_flow_data->tab);
579#ifdef EXTRA_CHECK
580 if(ltt_time_compare(evtime, time_window.start_time) == -1
581 || ltt_time_compare(evtime, time_window.end_time) == 1)
582 return;
583#endif //EXTRA_CHECK
d6fef890 584 Drawing_t *drawing = control_flow_data->drawing;
96947fcf 585 guint width = drawing->width;
b2743953 586 guint x;
587 convert_time_to_pixels(
588 time_window,
589 evtime,
590 width,
591 &x);
592
593 /* Draw collision indicator */
594 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1c736ed5 595 gdk_draw_point(hashed_process_data->pixmap,
b2743953 596 drawing->gc,
597 x,
1c736ed5 598 (hashed_process_data->height/2)-3);
b2743953 599 hashed_process_data->x.middle_marked = TRUE;
600 }
601 } else {
fd22065b 602 TimeWindow time_window =
603 lttvwindow_get_time_window(control_flow_data->tab);
604#ifdef EXTRA_CHECK
605 if(ltt_time_compare(evtime, time_window.start_time) == -1
606 || ltt_time_compare(evtime, time_window.end_time) == 1)
607 return;
608#endif //EXTRA_CHECK
d6fef890 609 Drawing_t *drawing = control_flow_data->drawing;
96947fcf 610 guint width = drawing->width;
10a1069a 611 guint x;
10a1069a 612
613 convert_time_to_pixels(
a18124ff 614 time_window,
4b7dc462 615 evtime,
616 width,
617 &x);
10a1069a 618
10a1069a 619
4b7dc462 620 /* Jump over draw if we are at the same x position */
e72908ed 621 if(x == hashed_process_data->x.middle &&
622 hashed_process_data->x.middle_used)
4b7dc462 623 {
e72908ed 624 if(hashed_process_data->x.middle_marked == FALSE) {
625 /* Draw collision indicator */
626 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1c736ed5 627 gdk_draw_point(hashed_process_data->pixmap,
e72908ed 628 drawing->gc,
629 x,
1c736ed5 630 (hashed_process_data->height/2)-3);
de4ea1ad 631 hashed_process_data->x.middle_marked = TRUE;
e72908ed 632 }
4b7dc462 633 /* jump */
634 } else {
635 DrawContext draw_context;
10a1069a 636
4b7dc462 637 /* Now create the drawing context that will be used to draw
638 * items related to the last state. */
1c736ed5 639 draw_context.drawable = hashed_process_data->pixmap;
4b7dc462 640 draw_context.gc = drawing->gc;
641 draw_context.pango_layout = drawing->pango_layout;
642 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
643 draw_context.drawinfo.end.x = x;
10a1069a 644
1c736ed5 645 draw_context.drawinfo.y.over = 1;
646 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
647 draw_context.drawinfo.y.under = hashed_process_data->height;
10a1069a 648
4b7dc462 649 draw_context.drawinfo.start.offset.over = 0;
650 draw_context.drawinfo.start.offset.middle = 0;
651 draw_context.drawinfo.start.offset.under = 0;
652 draw_context.drawinfo.end.offset.over = 0;
653 draw_context.drawinfo.end.offset.middle = 0;
654 draw_context.drawinfo.end.offset.under = 0;
655
656 {
657 /* Draw the line */
9a1ec01b 658 PropertiesLine prop_line = prepare_s_e_line(process);
4b7dc462 659 draw_line((void*)&prop_line, (void*)&draw_context);
660 }
661
662
663 /* become the last x position */
664 hashed_process_data->x.middle = x;
e72908ed 665 hashed_process_data->x.middle_used = TRUE;
666 hashed_process_data->x.middle_marked = FALSE;
b2743953 667
668 /* Calculate the next good time */
669 convert_pixels_to_time(width, x+1, time_window,
670 &hashed_process_data->next_good_time);
4b7dc462 671 }
c8bba5fa 672 }
8e680509 673 } else
674 g_warning("Cannot find pin_in in schedchange %u", pid_in);
b9a010a2 675 }
b9a010a2 676 return 0;
677
678
b9a010a2 679
a56a1ba4 680
51705146 681 /* Text dump */
80a52ff8 682#ifdef DONTSHOW
a56a1ba4 683 GString *string = g_string_new("");;
684 gboolean field_names = TRUE, state = TRUE;
80a52ff8 685
e9a9c513 686 lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs);
687 g_string_append_printf(string,"\n");
688
689 if(state) {
690 g_string_append_printf(string, " %s",
691 g_quark_to_string(tfs->process->state->s));
692 }
693
694 g_info("%s",string->str);
695
a56a1ba4 696 g_string_free(string, TRUE);
697
698 /* End of text dump */
80a52ff8 699#endif //DONTSHOW
50439712 700
f0d936c0 701}
702
e92eabaf 703/* after_schedchange_hook
b9a010a2 704 *
705 * The draw after hook is called by the reading API to have a
706 * particular event drawn on the screen.
707 * @param hook_data ControlFlowData structure of the viewer.
708 * @param call_data Event context.
709 *
710 * This function adds items to be drawn in a queue for each process.
711 *
712 */
e92eabaf 713int after_schedchange_hook(void *hook_data, void *call_data)
f0d936c0 714{
2c82c4dc 715 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
716 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
ca0f8a8e 717 ControlFlowData *control_flow_data = events_request->viewer_data;
50439712 718
a56a1ba4 719 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
50439712 720
721 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
722
348c6ba8 723 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
724
b9a010a2 725 LttEvent *e;
2c82c4dc 726 e = ltt_tracefile_get_event(tfc->tf);
b9a010a2 727
728 LttTime evtime = ltt_event_time(e);
b9a010a2 729
10a1069a 730 /* Add process to process list (if not present) */
2eef04b5 731 LttvProcessState *process_in;
10a1069a 732 LttTime birth;
1c736ed5 733 guint pl_height = 0;
10a1069a 734 HashedProcessData *hashed_process_data_in = NULL;
b9a010a2 735
5c230fc4 736 ProcessList *process_list = control_flow_data->process_list;
10a1069a 737
738 guint pid_in;
739 {
740 guint pid_out;
2c82c4dc 741 pid_out = ltt_event_get_long_unsigned(e, thf->f1);
742 pid_in = ltt_event_get_long_unsigned(e, thf->f2);
10a1069a 743 }
b9a010a2 744
745
10a1069a 746 /* Find process pid_in in the list... */
348c6ba8 747 //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
748 //process_in = tfs->process;
749 guint cpu = ltt_tracefile_num(tfc->tf);
750 process_in = ts->running_process[cpu];
10a1069a 751 /* It should exist, because we are after the state update. */
96947fcf 752#ifdef EXTRA_CHECK
10a1069a 753 g_assert(process_in != NULL);
96947fcf 754#endif //EXTRA_CHECK
10a1069a 755 birth = process_in->creation_time;
b9a010a2 756
ac4e21cf 757 hashed_process_data_in = processlist_get_process_data(process_list,
10a1069a 758 pid_in,
348c6ba8 759 process_in->cpu,
10a1069a 760 &birth,
ac4e21cf 761 tfc->t_context->index);
762 if(hashed_process_data_in == NULL)
10a1069a 763 {
764 g_assert(pid_in == 0 || pid_in != process_in->ppid);
4e86ae2e 765 ProcessInfo *process_info;
1c736ed5 766 Drawing_t *drawing = control_flow_data->drawing;
10a1069a 767 /* Process not present */
768 processlist_add(process_list,
1c736ed5 769 drawing,
10a1069a 770 pid_in,
348c6ba8 771 process_in->cpu,
10a1069a 772 process_in->ppid,
773 &birth,
774 tfc->t_context->index,
f4b88a7d 775 process_in->name,
10a1069a 776 &pl_height,
4e86ae2e 777 &process_info,
10a1069a 778 &hashed_process_data_in);
1c736ed5 779 gtk_widget_set_size_request(drawing->drawing_area,
780 -1,
781 pl_height);
782 gtk_widget_queue_draw(drawing->drawing_area);
b9a010a2 783 }
40debf7b 784 /* Set the current process */
348c6ba8 785 process_list->current_hash_data[process_in->cpu] =
40debf7b 786 hashed_process_data_in;
10a1069a 787
b2743953 788 if(ltt_time_compare(hashed_process_data_in->next_good_time,
789 evtime) <= 0)
790 {
fd22065b 791 TimeWindow time_window =
792 lttvwindow_get_time_window(control_flow_data->tab);
793
794#ifdef EXTRA_CHECK
795 if(ltt_time_compare(evtime, time_window.start_time) == -1
796 || ltt_time_compare(evtime, time_window.end_time) == 1)
797 return;
798#endif //EXTRA_CHECK
d6fef890 799 Drawing_t *drawing = control_flow_data->drawing;
800 guint width = drawing->width;
b2743953 801 guint new_x;
802
803 convert_time_to_pixels(
804 time_window,
805 evtime,
806 width,
807 &new_x);
e72908ed 808
b2743953 809 if(hashed_process_data_in->x.middle != new_x) {
810 hashed_process_data_in->x.middle = new_x;
811 hashed_process_data_in->x.middle_used = FALSE;
812 hashed_process_data_in->x.middle_marked = FALSE;
813 }
814 }
b9a010a2 815 return 0;
4a24fa1f 816}
b9a010a2 817
818
819
e72908ed 820
4a24fa1f 821/* before_execmode_hook
822 *
823 * This function basically draw lines and icons. Two types of lines are drawn :
824 * one small (3 pixels?) representing the state of the process and the second
825 * type is thicker (10 pixels?) representing on which CPU a process is running
826 * (and this only in running state).
827 *
828 * Extremums of the lines :
829 * x_min : time of the last event context for this process kept in memory.
830 * x_max : time of the current event.
831 * y : middle of the process in the process list. The process is found in the
832 * list, therefore is it's position in pixels.
833 *
834 * The choice of lines'color is defined by the context of the last event for this
835 * process.
836 */
837
e72908ed 838
4a24fa1f 839int before_execmode_hook(void *hook_data, void *call_data)
840{
841 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
842 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
b9a010a2 843 ControlFlowData *control_flow_data = events_request->viewer_data;
844
845 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
846
847 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
b9a010a2 848
4a24fa1f 849 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
850
50439712 851 LttEvent *e;
4a24fa1f 852 e = ltt_tracefile_get_event(tfc->tf);
50439712 853
9444deae 854 LttTime evtime = ltt_event_time(e);
9444deae 855
4a24fa1f 856 /* we are in a execmode, before the state update. We must draw the
857 * items corresponding to the state before it changes : now is the right
858 * time to do it.
859 */
860 /* For the pid */
861 //LttvProcessState *process = tfs->process;
862 guint cpu = ltt_tracefile_num(tfc->tf);
863 LttvProcessState *process = ts->running_process[cpu];
864 g_assert(process != NULL);
23093869 865
10a1069a 866 guint pid = process->pid;
23093869 867
10a1069a 868 /* Well, the process_out existed : we must get it in the process hash
869 * or add it, and draw its items.
870 */
871 /* Add process to process list (if not present) */
1c736ed5 872 guint pl_height = 0;
10a1069a 873 HashedProcessData *hashed_process_data = NULL;
5c230fc4 874 ProcessList *process_list = control_flow_data->process_list;
10a1069a 875 LttTime birth = process->creation_time;
40debf7b 876
348c6ba8 877 if(likely(process_list->current_hash_data[cpu] != NULL)) {
878 hashed_process_data = process_list->current_hash_data[cpu];
40debf7b 879 } else {
ac4e21cf 880 hashed_process_data = processlist_get_process_data(process_list,
40debf7b 881 pid,
348c6ba8 882 process->cpu,
40debf7b 883 &birth,
ac4e21cf 884 tfc->t_context->index);
1d1df11d 885 if(unlikely(hashed_process_data == NULL))
40debf7b 886 {
887 g_assert(pid == 0 || pid != process->ppid);
888 ProcessInfo *process_info;
889 /* Process not present */
1c736ed5 890 Drawing_t *drawing = control_flow_data->drawing;
40debf7b 891 processlist_add(process_list,
1c736ed5 892 drawing,
40debf7b 893 pid,
348c6ba8 894 process->cpu,
40debf7b 895 process->ppid,
896 &birth,
897 tfc->t_context->index,
f4b88a7d 898 process->name,
40debf7b 899 &pl_height,
900 &process_info,
901 &hashed_process_data);
1c736ed5 902 gtk_widget_set_size_request(drawing->drawing_area,
903 -1,
904 pl_height);
905 gtk_widget_queue_draw(drawing->drawing_area);
40debf7b 906 }
907 /* Set the current process */
348c6ba8 908 process_list->current_hash_data[process->cpu] =
40debf7b 909 hashed_process_data;
10a1069a 910 }
23093869 911
10a1069a 912 /* Now, the process is in the state hash and our own process hash.
913 * We definitely can draw the items related to the ending state.
914 */
b2743953 915
1d1df11d 916 if(likely(ltt_time_compare(hashed_process_data->next_good_time,
917 evtime) > 0))
10a1069a 918 {
1d1df11d 919 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
fd22065b 920 TimeWindow time_window =
921 lttvwindow_get_time_window(control_flow_data->tab);
922
923#ifdef EXTRA_CHECK
924 if(ltt_time_compare(evtime, time_window.start_time) == -1
925 || ltt_time_compare(evtime, time_window.end_time) == 1)
926 return;
927#endif //EXTRA_CHECK
d6fef890 928 Drawing_t *drawing = control_flow_data->drawing;
96947fcf 929 guint width = drawing->width;
b2743953 930 guint x;
931 convert_time_to_pixels(
932 time_window,
933 evtime,
934 width,
935 &x);
936
937 /* Draw collision indicator */
938 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1c736ed5 939 gdk_draw_point(hashed_process_data->pixmap,
b2743953 940 drawing->gc,
941 x,
1c736ed5 942 (hashed_process_data->height/2)-3);
b2743953 943 hashed_process_data->x.middle_marked = TRUE;
944 }
945 } else {
fd22065b 946 TimeWindow time_window =
947 lttvwindow_get_time_window(control_flow_data->tab);
948
949#ifdef EXTRA_CHECK
950 if(ltt_time_compare(evtime, time_window.start_time) == -1
951 || ltt_time_compare(evtime, time_window.end_time) == 1)
952 return;
953#endif //EXTRA_CHECK
d6fef890 954 Drawing_t *drawing = control_flow_data->drawing;
96947fcf 955 guint width = drawing->width;
10a1069a 956 guint x;
dbd243b1 957
10a1069a 958 convert_time_to_pixels(
a18124ff 959 time_window,
10a1069a 960 evtime,
961 width,
962 &x);
dbd243b1 963
23093869 964
4b7dc462 965 /* Jump over draw if we are at the same x position */
1d1df11d 966 if(unlikely(x == hashed_process_data->x.middle &&
967 hashed_process_data->x.middle_used))
10a1069a 968 {
1d1df11d 969 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
e72908ed 970 /* Draw collision indicator */
971 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1c736ed5 972 gdk_draw_point(hashed_process_data->pixmap,
e72908ed 973 drawing->gc,
974 x,
1c736ed5 975 (hashed_process_data->height/2)-3);
de4ea1ad 976 hashed_process_data->x.middle_marked = TRUE;
e72908ed 977 }
4b7dc462 978 /* jump */
979 } else {
980
981 DrawContext draw_context;
982 /* Now create the drawing context that will be used to draw
983 * items related to the last state. */
1c736ed5 984 draw_context.drawable = hashed_process_data->pixmap;
4b7dc462 985 draw_context.gc = drawing->gc;
986 draw_context.pango_layout = drawing->pango_layout;
9a1ec01b 987 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
4b7dc462 988 draw_context.drawinfo.end.x = x;
989
1c736ed5 990 draw_context.drawinfo.y.over = 1;
991 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
992 draw_context.drawinfo.y.under = hashed_process_data->height;
4b7dc462 993
994 draw_context.drawinfo.start.offset.over = 0;
995 draw_context.drawinfo.start.offset.middle = 0;
996 draw_context.drawinfo.start.offset.under = 0;
997 draw_context.drawinfo.end.offset.over = 0;
998 draw_context.drawinfo.end.offset.middle = 0;
999 draw_context.drawinfo.end.offset.under = 0;
1000
1001 {
1002 /* Draw the line */
9a1ec01b 1003 PropertiesLine prop_line = prepare_s_e_line(process);
4b7dc462 1004 draw_line((void*)&prop_line, (void*)&draw_context);
23093869 1005
4b7dc462 1006 }
1007 /* become the last x position */
9a1ec01b 1008 hashed_process_data->x.middle = x;
e72908ed 1009 hashed_process_data->x.middle_used = TRUE;
1010 hashed_process_data->x.middle_marked = FALSE;
b2743953 1011
1012 /* Calculate the next good time */
1013 convert_pixels_to_time(width, x+1, time_window,
1014 &hashed_process_data->next_good_time);
23093869 1015 }
1016 }
1017
1018 return 0;
1019}
1020
4a24fa1f 1021/* before_process_exit_hook
23093869 1022 *
4a24fa1f 1023 * Draw lines for process event.
1024 *
23093869 1025 * @param hook_data ControlFlowData structure of the viewer.
1026 * @param call_data Event context.
1027 *
1028 * This function adds items to be drawn in a queue for each process.
1029 *
1030 */
8869ac08 1031
1032
4a24fa1f 1033int before_process_exit_hook(void *hook_data, void *call_data)
1034{
2c82c4dc 1035 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
1036 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
4a24fa1f 1037
23093869 1038 ControlFlowData *control_flow_data = events_request->viewer_data;
1039
1040 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
1041
1042 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
23093869 1043
4a24fa1f 1044 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
1045
23093869 1046 LttEvent *e;
2c82c4dc 1047 e = ltt_tracefile_get_event(tfc->tf);
23093869 1048
1049 LttTime evtime = ltt_event_time(e);
23093869 1050
10a1069a 1051 /* Add process to process list (if not present) */
4a24fa1f 1052 //LttvProcessState *process = tfs->process;
1053 guint cpu = ltt_tracefile_num(tfc->tf);
1054 LttvProcessState *process = ts->running_process[cpu];
1055 guint pid = process->pid;
10a1069a 1056 LttTime birth;
1c736ed5 1057 guint pl_height = 0;
10a1069a 1058 HashedProcessData *hashed_process_data = NULL;
23093869 1059
5c230fc4 1060 ProcessList *process_list = control_flow_data->process_list;
4a24fa1f 1061
10a1069a 1062 g_assert(process != NULL);
23093869 1063
10a1069a 1064 birth = process->creation_time;
23093869 1065
4a24fa1f 1066 if(likely(process_list->current_hash_data[cpu] != NULL)) {
1067 hashed_process_data = process_list->current_hash_data[cpu];
40debf7b 1068 } else {
ac4e21cf 1069 hashed_process_data = processlist_get_process_data(process_list,
4a24fa1f 1070 pid,
1071 process->cpu,
1072 &birth,
1073 tfc->t_context->index);
1d1df11d 1074 if(unlikely(hashed_process_data == NULL))
40debf7b 1075 {
1076 g_assert(pid == 0 || pid != process->ppid);
1077 /* Process not present */
1c736ed5 1078 Drawing_t *drawing = control_flow_data->drawing;
40debf7b 1079 ProcessInfo *process_info;
1080 processlist_add(process_list,
1c736ed5 1081 drawing,
40debf7b 1082 pid,
4a24fa1f 1083 process->cpu,
40debf7b 1084 process->ppid,
1085 &birth,
1086 tfc->t_context->index,
4a24fa1f 1087 process->name,
40debf7b 1088 &pl_height,
1089 &process_info,
1090 &hashed_process_data);
4a24fa1f 1091 gtk_widget_set_size_request(drawing->drawing_area,
1092 -1,
1093 pl_height);
1094 gtk_widget_queue_draw(drawing->drawing_area);
40debf7b 1095 }
23093869 1096 }
40debf7b 1097
4a24fa1f 1098 /* Now, the process is in the state hash and our own process hash.
1099 * We definitely can draw the items related to the ending state.
1100 */
1101
1102 if(likely(ltt_time_compare(hashed_process_data->next_good_time,
1103 evtime) > 0))
b2743953 1104 {
4a24fa1f 1105 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
1106 TimeWindow time_window =
1107 lttvwindow_get_time_window(control_flow_data->tab);
1108
1109#ifdef EXTRA_CHECK
1110 if(ltt_time_compare(evtime, time_window.start_time) == -1
1111 || ltt_time_compare(evtime, time_window.end_time) == 1)
1112 return;
1113#endif //EXTRA_CHECK
1114 Drawing_t *drawing = control_flow_data->drawing;
1115 guint width = drawing->width;
1116 guint x;
1117 convert_time_to_pixels(
1118 time_window,
1119 evtime,
1120 width,
1121 &x);
1122
1123 /* Draw collision indicator */
1124 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1125 gdk_draw_point(hashed_process_data->pixmap,
1126 drawing->gc,
1127 x,
1128 (hashed_process_data->height/2)-3);
1129 hashed_process_data->x.middle_marked = TRUE;
1130 }
1131 } else {
fd22065b 1132 TimeWindow time_window =
1133 lttvwindow_get_time_window(control_flow_data->tab);
1134
1135#ifdef EXTRA_CHECK
1136 if(ltt_time_compare(evtime, time_window.start_time) == -1
1137 || ltt_time_compare(evtime, time_window.end_time) == 1)
1138 return;
1139#endif //EXTRA_CHECK
d6fef890 1140 Drawing_t *drawing = control_flow_data->drawing;
1141 guint width = drawing->width;
4a24fa1f 1142 guint x;
1143
2c82c4dc 1144 convert_time_to_pixels(
1145 time_window,
1146 evtime,
1147 width,
1148 &x);
1149
b2743953 1150
2c82c4dc 1151 /* Jump over draw if we are at the same x position */
1152 if(unlikely(x == hashed_process_data->x.middle &&
1153 hashed_process_data->x.middle_used))
1154 {
1155 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
b2743953 1156 /* Draw collision indicator */
1157 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1c736ed5 1158 gdk_draw_point(hashed_process_data->pixmap,
b2743953 1159 drawing->gc,
1160 x,
1c736ed5 1161 (hashed_process_data->height/2)-3);
b2743953 1162 hashed_process_data->x.middle_marked = TRUE;
1163 }
2c82c4dc 1164 /* jump */
b2743953 1165 } else {
2c82c4dc 1166 DrawContext draw_context;
fd22065b 1167
2c82c4dc 1168 /* Now create the drawing context that will be used to draw
1169 * items related to the last state. */
1170 draw_context.drawable = hashed_process_data->pixmap;
1171 draw_context.gc = drawing->gc;
1172 draw_context.pango_layout = drawing->pango_layout;
1173 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
1174 draw_context.drawinfo.end.x = x;
dbd243b1 1175
2c82c4dc 1176 draw_context.drawinfo.y.over = 1;
1177 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
1178 draw_context.drawinfo.y.under = hashed_process_data->height;
dbd243b1 1179
2c82c4dc 1180 draw_context.drawinfo.start.offset.over = 0;
1181 draw_context.drawinfo.start.offset.middle = 0;
1182 draw_context.drawinfo.start.offset.under = 0;
1183 draw_context.drawinfo.end.offset.over = 0;
1184 draw_context.drawinfo.end.offset.middle = 0;
1185 draw_context.drawinfo.end.offset.under = 0;
dbd243b1 1186
2c82c4dc 1187 {
1188 /* Draw the line */
1189 PropertiesLine prop_line = prepare_s_e_line(process);
1190 draw_line((void*)&prop_line, (void*)&draw_context);
dbd243b1 1191
2c82c4dc 1192 }
1193 /* become the last x position */
1194 hashed_process_data->x.middle = x;
1195 hashed_process_data->x.middle_used = TRUE;
1196 hashed_process_data->x.middle_marked = FALSE;
dbd243b1 1197
2c82c4dc 1198 /* Calculate the next good time */
1199 convert_pixels_to_time(width, x+1, time_window,
1200 &hashed_process_data->next_good_time);
1201 }
1202 }
1203
1204 return 0;
1205
1206}
1207
1208
1209
1210/* before_process_release_hook
1211 *
1212 * Draw lines for process event.
1213 *
1214 * @param hook_data ControlFlowData structure of the viewer.
1215 * @param call_data Event context.
1216 *
1217 * This function adds items to be drawn in a queue for each process.
1218 *
1219 */
1220
1221
1222int before_process_release_hook(void *hook_data, void *call_data)
1223{
1224 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
1225 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
1226
1227 ControlFlowData *control_flow_data = events_request->viewer_data;
1228
1229 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
1230
1231 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
1232
348c6ba8 1233 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
1234
2c82c4dc 1235 LttEvent *e;
1236 e = ltt_tracefile_get_event(tfc->tf);
1237
1238 LttTime evtime = ltt_event_time(e);
1239
1240
1241 guint pid;
1242 {
1243 pid = ltt_event_get_long_unsigned(e, thf->f1);
1244 }
1245
1246 /* Add process to process list (if not present) */
1247 /* Don't care about the process if it's not in the state hash already :
1248 * that means a process that has never done anything in the trace and
1249 * unknown suddently gets destroyed : no state meaningful to show. */
348c6ba8 1250 LttvProcessState *process = lttv_state_find_process(ts, ANY_CPU, pid);
2c82c4dc 1251
1252 if(process != NULL) {
1253 LttTime birth;
1254 guint pl_height = 0;
1255 HashedProcessData *hashed_process_data = NULL;
1256
1257 ProcessList *process_list = control_flow_data->process_list;
1258
1259 birth = process->creation_time;
1260
1261 /* Cannot use current process : this event happens on another process,
1262 * action done by the parent. */
1263 hashed_process_data = processlist_get_process_data(process_list,
1264 pid,
348c6ba8 1265 process->cpu,
2c82c4dc 1266 &birth,
1267 tfc->t_context->index);
1268 if(unlikely(hashed_process_data == NULL))
1269 {
1270 g_assert(pid == 0 || pid != process->ppid);
1271 /* Process not present */
1272 Drawing_t *drawing = control_flow_data->drawing;
2c82c4dc 1273 ProcessInfo *process_info;
1274 processlist_add(process_list,
1275 drawing,
1276 pid,
348c6ba8 1277 process->cpu,
2c82c4dc 1278 process->ppid,
1279 &birth,
1280 tfc->t_context->index,
f4b88a7d 1281 process->name,
2c82c4dc 1282 &pl_height,
1283 &process_info,
1284 &hashed_process_data);
1285 gtk_widget_set_size_request(drawing->drawing_area,
1286 -1,
1287 pl_height);
1288 gtk_widget_queue_draw(drawing->drawing_area);
1289 }
1290
1291 /* Now, the process is in the state hash and our own process hash.
1292 * We definitely can draw the items related to the ending state.
1293 */
1294
1295 if(likely(ltt_time_compare(hashed_process_data->next_good_time,
1296 evtime) > 0))
1297 {
1298 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
1299 TimeWindow time_window =
1300 lttvwindow_get_time_window(control_flow_data->tab);
1301
1302#ifdef EXTRA_CHECK
1303 if(ltt_time_compare(evtime, time_window.start_time) == -1
1304 || ltt_time_compare(evtime, time_window.end_time) == 1)
1305 return;
1306#endif //EXTRA_CHECK
1307 Drawing_t *drawing = control_flow_data->drawing;
1308 guint width = drawing->width;
1309 guint x;
1310 convert_time_to_pixels(
1311 time_window,
1312 evtime,
1313 width,
1314 &x);
1315
1316 /* Draw collision indicator */
1317 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1318 gdk_draw_point(hashed_process_data->pixmap,
1319 drawing->gc,
1320 x,
1321 (hashed_process_data->height/2)-3);
1322 hashed_process_data->x.middle_marked = TRUE;
1323 }
1324 } else {
1325 TimeWindow time_window =
1326 lttvwindow_get_time_window(control_flow_data->tab);
1327
1328#ifdef EXTRA_CHECK
1329 if(ltt_time_compare(evtime, time_window.start_time) == -1
4a24fa1f 1330 || ltt_time_compare(evtime, time_window.end_time) == 1)
1331 return;
2da61677 1332#endif //EXTRA_CHECK
4a24fa1f 1333 Drawing_t *drawing = control_flow_data->drawing;
1334 guint width = drawing->width;
1335 guint x;
1336
1337 convert_time_to_pixels(
1338 time_window,
1339 evtime,
1340 width,
1341 &x);
1342
2da61677 1343
4a24fa1f 1344 /* Jump over draw if we are at the same x position */
1345 if(unlikely(x == hashed_process_data->x.middle &&
1346 hashed_process_data->x.middle_used))
1347 {
1348 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
2da61677 1349 /* Draw collision indicator */
1350 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1351 gdk_draw_point(hashed_process_data->pixmap,
1352 drawing->gc,
1353 x,
1354 (hashed_process_data->height/2)-3);
1355 hashed_process_data->x.middle_marked = TRUE;
1356 }
4a24fa1f 1357 /* jump */
2da61677 1358 } else {
4a24fa1f 1359 DrawContext draw_context;
2da61677 1360
4a24fa1f 1361 /* Now create the drawing context that will be used to draw
1362 * items related to the last state. */
1363 draw_context.drawable = hashed_process_data->pixmap;
1364 draw_context.gc = drawing->gc;
1365 draw_context.pango_layout = drawing->pango_layout;
1366 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
1367 draw_context.drawinfo.end.x = x;
2da61677 1368
4a24fa1f 1369 draw_context.drawinfo.y.over = 1;
1370 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
1371 draw_context.drawinfo.y.under = hashed_process_data->height;
2da61677 1372
4a24fa1f 1373 draw_context.drawinfo.start.offset.over = 0;
1374 draw_context.drawinfo.start.offset.middle = 0;
1375 draw_context.drawinfo.start.offset.under = 0;
1376 draw_context.drawinfo.end.offset.over = 0;
1377 draw_context.drawinfo.end.offset.middle = 0;
1378 draw_context.drawinfo.end.offset.under = 0;
2da61677 1379
4a24fa1f 1380 {
1381 /* Draw the line */
1382 PropertiesLine prop_line = prepare_s_e_line(process);
1383 draw_line((void*)&prop_line, (void*)&draw_context);
2da61677 1384
2da61677 1385 }
4a24fa1f 1386 /* become the last x position */
1387 hashed_process_data->x.middle = x;
1388 hashed_process_data->x.middle_used = TRUE;
1389 hashed_process_data->x.middle_marked = FALSE;
1390
1391 /* Calculate the next good time */
1392 convert_pixels_to_time(width, x+1, time_window,
1393 &hashed_process_data->next_good_time);
2da61677 1394 }
1395 }
dbd243b1 1396 }
dbd243b1 1397
4a24fa1f 1398 return 0;
dbd243b1 1399}
1400
4a24fa1f 1401
2c82c4dc 1402
1403
1404
1405/* after_process_fork_hook
1406 *
1407 * Create the processlist entry for the child process. Put the last
1408 * position in x at the current time value.
1409 *
1410 * @param hook_data ControlFlowData structure of the viewer.
1411 * @param call_data Event context.
1412 *
1413 * This function adds items to be drawn in a queue for each process.
1414 *
1415 */
1416int after_process_fork_hook(void *hook_data, void *call_data)
1417{
1418 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
1419 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
1420 ControlFlowData *control_flow_data = events_request->viewer_data;
1421
1422 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
1423
1424 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
1425
348c6ba8 1426 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
1427
2c82c4dc 1428 LttEvent *e;
1429 e = ltt_tracefile_get_event(tfc->tf);
1430
1431 LttTime evtime = ltt_event_time(e);
1432
1433 guint child_pid;
1434 {
1435 child_pid = ltt_event_get_long_unsigned(e, thf->f2);
1436 }
1437
1438 /* Add process to process list (if not present) */
1439 LttvProcessState *process_child;
1440 LttTime birth;
1441 guint pl_height = 0;
1442 HashedProcessData *hashed_process_data_child = NULL;
1443
1444 ProcessList *process_list = control_flow_data->process_list;
1445
1446 /* Find child in the list... */
348c6ba8 1447 process_child = lttv_state_find_process(ts, ANY_CPU, child_pid);
2c82c4dc 1448 /* It should exist, because we are after the state update. */
1449 g_assert(process_child != NULL);
1450
1451 birth = process_child->creation_time;
1452
1453 /* Cannot use current process, because this action is done by the parent
1454 * on its child. */
1455 hashed_process_data_child = processlist_get_process_data(process_list,
1456 child_pid,
348c6ba8 1457 process_child->cpu,
2c82c4dc 1458 &birth,
1459 tfc->t_context->index);
1460 if(likely(hashed_process_data_child == NULL))
1461 {
1462 g_assert(child_pid == 0 || child_pid != process_child->ppid);
1463 /* Process not present */
1464 Drawing_t *drawing = control_flow_data->drawing;
2c82c4dc 1465 ProcessInfo *process_info;
1466 processlist_add(process_list,
1467 drawing,
1468 child_pid,
348c6ba8 1469 process_child->cpu,
2c82c4dc 1470 process_child->ppid,
1471 &birth,
1472 tfc->t_context->index,
f4b88a7d 1473 process_child->name,
2c82c4dc 1474 &pl_height,
1475 &process_info,
1476 &hashed_process_data_child);
1477 gtk_widget_set_size_request(drawing->drawing_area,
1478 -1,
1479 pl_height);
1480 gtk_widget_queue_draw(drawing->drawing_area);
1481 }
1482
1483
1484 if(likely(ltt_time_compare(hashed_process_data_child->next_good_time,
1485 evtime) <= 0))
1486 {
1487 TimeWindow time_window =
1488 lttvwindow_get_time_window(control_flow_data->tab);
1489
1490#ifdef EXTRA_CHECK
1491 if(ltt_time_compare(evtime, time_window.start_time) == -1
1492 || ltt_time_compare(evtime, time_window.end_time) == 1)
1493 return;
1494#endif //EXTRA_CHECK
1495 Drawing_t *drawing = control_flow_data->drawing;
1496 guint width = drawing->width;
1497 guint new_x;
1498 convert_time_to_pixels(
1499 time_window,
1500 evtime,
1501 width,
1502 &new_x);
1503
1504 if(likely(hashed_process_data_child->x.over != new_x)) {
1505 hashed_process_data_child->x.over = new_x;
1506 hashed_process_data_child->x.over_used = FALSE;
1507 hashed_process_data_child->x.over_marked = FALSE;
1508 }
1509 if(likely(hashed_process_data_child->x.middle != new_x)) {
1510 hashed_process_data_child->x.middle = new_x;
1511 hashed_process_data_child->x.middle_used = FALSE;
1512 hashed_process_data_child->x.middle_marked = FALSE;
1513 }
1514 if(likely(hashed_process_data_child->x.under != new_x)) {
1515 hashed_process_data_child->x.under = new_x;
1516 hashed_process_data_child->x.under_used = FALSE;
1517 hashed_process_data_child->x.under_marked = FALSE;
1518 }
1519 }
1520 return 0;
1521}
1522
1523
1524
1525/* after_process_exit_hook
1526 *
1527 * Create the processlist entry for the child process. Put the last
1528 * position in x at the current time value.
1529 *
1530 * @param hook_data ControlFlowData structure of the viewer.
1531 * @param call_data Event context.
1532 *
1533 * This function adds items to be drawn in a queue for each process.
1534 *
1535 */
1536int after_process_exit_hook(void *hook_data, void *call_data)
1537{
1538 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
1539 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
1540 ControlFlowData *control_flow_data = events_request->viewer_data;
1541
1542 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
1543
1544 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
1545
348c6ba8 1546 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
1547
2c82c4dc 1548 LttEvent *e;
1549 e = ltt_tracefile_get_event(tfc->tf);
1550
1551 LttTime evtime = ltt_event_time(e);
1552
1553 /* Add process to process list (if not present) */
348c6ba8 1554 //LttvProcessState *process = tfs->process;
1555 guint cpu = ltt_tracefile_num(tfc->tf);
1556 LttvProcessState *process = ts->running_process[cpu];
1557
1558 /* It should exist, because we are after the state update. */
1559 g_assert(process != NULL);
1560
2c82c4dc 1561 guint pid = process->pid;
1562 LttTime birth;
1563 guint pl_height = 0;
1564 HashedProcessData *hashed_process_data = NULL;
1565
1566 ProcessList *process_list = control_flow_data->process_list;
1567
2c82c4dc 1568 birth = process->creation_time;
1569
348c6ba8 1570 if(likely(process_list->current_hash_data[cpu] != NULL) ){
1571 hashed_process_data = process_list->current_hash_data[cpu];
2c82c4dc 1572 } else {
1573 hashed_process_data = processlist_get_process_data(process_list,
1574 pid,
348c6ba8 1575 process->cpu,
2c82c4dc 1576 &birth,
1577 tfc->t_context->index);
1578 if(unlikely(hashed_process_data == NULL))
1579 {
1580 g_assert(pid == 0 || pid != process->ppid);
1581 /* Process not present */
1582 Drawing_t *drawing = control_flow_data->drawing;
2c82c4dc 1583 ProcessInfo *process_info;
1584 processlist_add(process_list,
1585 drawing,
1586 pid,
348c6ba8 1587 process->cpu,
2c82c4dc 1588 process->ppid,
1589 &birth,
1590 tfc->t_context->index,
f4b88a7d 1591 process->name,
2c82c4dc 1592 &pl_height,
1593 &process_info,
1594 &hashed_process_data);
1595 gtk_widget_set_size_request(drawing->drawing_area,
1596 -1,
1597 pl_height);
1598 gtk_widget_queue_draw(drawing->drawing_area);
1599 }
1600
1601 /* Set the current process */
348c6ba8 1602 process_list->current_hash_data[process->cpu] =
2c82c4dc 1603 hashed_process_data;
1604 }
1605
1606 if(unlikely(ltt_time_compare(hashed_process_data->next_good_time,
1607 evtime) <= 0))
1608 {
1609 TimeWindow time_window =
1610 lttvwindow_get_time_window(control_flow_data->tab);
dbd243b1 1611
2c82c4dc 1612#ifdef EXTRA_CHECK
1613 if(ltt_time_compare(evtime, time_window.start_time) == -1
1614 || ltt_time_compare(evtime, time_window.end_time) == 1)
1615 return;
1616#endif //EXTRA_CHECK
1617 Drawing_t *drawing = control_flow_data->drawing;
1618 guint width = drawing->width;
1619 guint new_x;
1620 convert_time_to_pixels(
1621 time_window,
1622 evtime,
1623 width,
1624 &new_x);
1625 if(unlikely(hashed_process_data->x.middle != new_x)) {
1626 hashed_process_data->x.middle = new_x;
1627 hashed_process_data->x.middle_used = FALSE;
1628 hashed_process_data->x.middle_marked = FALSE;
1629 }
1630 }
dbd243b1 1631
2c82c4dc 1632 return 0;
1633}
dbd243b1 1634
1635
f4b88a7d 1636/* Get the filename of the process to print */
1637int after_fs_exec_hook(void *hook_data, void *call_data)
1638{
1639 LttvTraceHookByFacility *thf = (LttvTraceHookByFacility*)hook_data;
1640 EventsRequest *events_request = (EventsRequest*)thf->hook_data;
1641 ControlFlowData *control_flow_data = events_request->viewer_data;
1642
1643 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
1644
1645 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
1646
1647 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
1648
1649 guint cpu = ltt_tracefile_num(tfc->tf);
1650 LttvProcessState *process = ts->running_process[cpu];
1651 g_assert(process != NULL);
1652
1653 guint pid = process->pid;
1654
1655 /* Well, the process_out existed : we must get it in the process hash
1656 * or add it, and draw its items.
1657 */
1658 /* Add process to process list (if not present) */
1659 guint pl_height = 0;
1660 HashedProcessData *hashed_process_data = NULL;
1661 ProcessList *process_list = control_flow_data->process_list;
1662 LttTime birth = process->creation_time;
1663
1664 if(likely(process_list->current_hash_data[cpu] != NULL)) {
1665 hashed_process_data = process_list->current_hash_data[cpu];
1666 } else {
1667 hashed_process_data = processlist_get_process_data(process_list,
1668 pid,
1669 process->cpu,
1670 &birth,
1671 tfc->t_context->index);
1672 if(unlikely(hashed_process_data == NULL))
1673 {
1674 g_assert(pid == 0 || pid != process->ppid);
1675 ProcessInfo *process_info;
1676 /* Process not present */
1677 Drawing_t *drawing = control_flow_data->drawing;
1678 processlist_add(process_list,
1679 drawing,
1680 pid,
1681 process->cpu,
1682 process->ppid,
1683 &birth,
1684 tfc->t_context->index,
1685 process->name,
1686 &pl_height,
1687 &process_info,
1688 &hashed_process_data);
1689 gtk_widget_set_size_request(drawing->drawing_area,
1690 -1,
1691 pl_height);
1692 gtk_widget_queue_draw(drawing->drawing_area);
1693 }
1694 /* Set the current process */
1695 process_list->current_hash_data[process->cpu] =
1696 hashed_process_data;
1697 }
1698
1699 processlist_set_name(process_list, process->name, hashed_process_data);
1700
1701 return 0;
1702
1703}
1704
1705
1706
1707
1b238973 1708gint update_time_window_hook(void *hook_data, void *call_data)
f7afe191 1709{
a56a1ba4 1710 ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
a43d67ba 1711 Drawing_t *drawing = control_flow_data->drawing;
1c736ed5 1712 ProcessList *process_list = control_flow_data->process_list;
a43d67ba 1713
224446ce 1714 const TimeWindowNotifyData *time_window_nofify_data =
1715 ((const TimeWindowNotifyData *)call_data);
1716
14963be0 1717 TimeWindow *old_time_window =
224446ce 1718 time_window_nofify_data->old_time_window;
1719 TimeWindow *new_time_window =
1720 time_window_nofify_data->new_time_window;
a56a1ba4 1721
3cb8b205 1722 /* Update the ruler */
1723 drawing_update_ruler(control_flow_data->drawing,
1724 new_time_window);
1725
1726
a56a1ba4 1727 /* Two cases : zoom in/out or scrolling */
1728
1729 /* In order to make sure we can reuse the old drawing, the scale must
1730 * be the same and the new time interval being partly located in the
1731 * currently shown time interval. (reuse is only for scrolling)
1732 */
1733
2eef04b5 1734 g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
14963be0 1735 old_time_window->start_time.tv_sec,
1736 old_time_window->start_time.tv_nsec,
1737 old_time_window->time_width.tv_sec,
1738 old_time_window->time_width.tv_nsec);
a56a1ba4 1739
2eef04b5 1740 g_info("New time window HOOK : %lu, %lu to %lu, %lu",
14963be0 1741 new_time_window->start_time.tv_sec,
1742 new_time_window->start_time.tv_nsec,
1743 new_time_window->time_width.tv_sec,
1744 new_time_window->time_width.tv_nsec);
a56a1ba4 1745
14963be0 1746 if( new_time_window->time_width.tv_sec == old_time_window->time_width.tv_sec
1747 && new_time_window->time_width.tv_nsec == old_time_window->time_width.tv_nsec)
a56a1ba4 1748 {
1749 /* Same scale (scrolling) */
1750 g_info("scrolling");
14963be0 1751 LttTime *ns = &new_time_window->start_time;
20640e70 1752 LttTime *nw = &new_time_window->time_width;
14963be0 1753 LttTime *os = &old_time_window->start_time;
20640e70 1754 LttTime *ow = &old_time_window->time_width;
6f26fc38 1755 LttTime old_end = old_time_window->end_time;
1756 LttTime new_end = new_time_window->end_time;
a56a1ba4 1757 //if(ns<os+w<ns+w)
1758 //if(ns<os+w && os+w<ns+w)
1759 //if(ns<old_end && os<ns)
1760 if(ltt_time_compare(*ns, old_end) == -1
1761 && ltt_time_compare(*os, *ns) == -1)
1762 {
1763 g_info("scrolling near right");
1764 /* Scroll right, keep right part of the screen */
1765 guint x = 0;
51705146 1766 guint width = control_flow_data->drawing->width;
a56a1ba4 1767 convert_time_to_pixels(
a18124ff 1768 *old_time_window,
a56a1ba4 1769 *ns,
1770 width,
1771 &x);
1772
1773 /* Copy old data to new location */
1c736ed5 1774 copy_pixmap_region(process_list,
1775 NULL,
1776 control_flow_data->drawing->drawing_area->style->black_gc,
1777 NULL,
1778 x, 0,
1779 0, 0,
1780 control_flow_data->drawing->width-x+SAFETY, -1);
1781
6395d57c 1782 if(drawing->damage_begin == drawing->damage_end)
1783 drawing->damage_begin = control_flow_data->drawing->width-x;
1784 else
1785 drawing->damage_begin = 0;
1786
1787 drawing->damage_end = control_flow_data->drawing->width;
1788
a56a1ba4 1789 /* Clear the data request background, but not SAFETY */
1c736ed5 1790 rectangle_pixmap(process_list,
cfe526b1 1791 control_flow_data->drawing->drawing_area->style->black_gc,
a56a1ba4 1792 TRUE,
6395d57c 1793 drawing->damage_begin+SAFETY, 0,
1794 drawing->damage_end - drawing->damage_begin, // do not overlap
1c736ed5 1795 -1);
7abb23ad 1796 gtk_widget_queue_draw(drawing->drawing_area);
1797 //gtk_widget_queue_draw_area (drawing->drawing_area,
1798 // 0,0,
1799 // control_flow_data->drawing->width,
1800 // control_flow_data->drawing->height);
a43d67ba 1801
a56a1ba4 1802 /* Get new data for the rest. */
501d5405 1803 drawing_data_request(control_flow_data->drawing,
6395d57c 1804 drawing->damage_begin, 0,
1805 drawing->damage_end - drawing->damage_begin,
501d5405 1806 control_flow_data->drawing->height);
a56a1ba4 1807 } else {
1808 //if(ns<os<ns+w)
1809 //if(ns<os && os<ns+w)
1810 //if(ns<os && os<new_end)
1811 if(ltt_time_compare(*ns,*os) == -1
1812 && ltt_time_compare(*os,new_end) == -1)
1813 {
1814 g_info("scrolling near left");
1815 /* Scroll left, keep left part of the screen */
1816 guint x = 0;
51705146 1817 guint width = control_flow_data->drawing->width;
a56a1ba4 1818 convert_time_to_pixels(
a18124ff 1819 *new_time_window,
a56a1ba4 1820 *os,
1821 width,
1822 &x);
6395d57c 1823
a56a1ba4 1824 /* Copy old data to new location */
1c736ed5 1825 copy_pixmap_region (process_list,
1826 NULL,
cfe526b1 1827 control_flow_data->drawing->drawing_area->style->black_gc,
1c736ed5 1828 NULL,
a56a1ba4 1829 0, 0,
1830 x, 0,
1831 -1, -1);
1832
6395d57c 1833 if(drawing->damage_begin == drawing->damage_end)
1834 drawing->damage_end = x;
1835 else
1836 drawing->damage_end =
51705146 1837 control_flow_data->drawing->width;
6395d57c 1838
1839 drawing->damage_begin = 0;
1840
1c736ed5 1841 rectangle_pixmap (process_list,
cfe526b1 1842 control_flow_data->drawing->drawing_area->style->black_gc,
a56a1ba4 1843 TRUE,
6395d57c 1844 drawing->damage_begin, 0,
1845 drawing->damage_end - drawing->damage_begin, // do not overlap
1c736ed5 1846 -1);
a43d67ba 1847
7abb23ad 1848 gtk_widget_queue_draw(drawing->drawing_area);
1849 //gtk_widget_queue_draw_area (drawing->drawing_area,
1850 // 0,0,
1851 // control_flow_data->drawing->width,
1852 // control_flow_data->drawing->height);
a43d67ba 1853
6395d57c 1854
a56a1ba4 1855 /* Get new data for the rest. */
501d5405 1856 drawing_data_request(control_flow_data->drawing,
6395d57c 1857 drawing->damage_begin, 0,
1858 drawing->damage_end - drawing->damage_begin,
501d5405 1859 control_flow_data->drawing->height);
a56a1ba4 1860
a56a1ba4 1861 } else {
a43d67ba 1862 if(ltt_time_compare(*ns,*os) == 0)
1863 {
1864 g_info("not scrolling");
1865 } else {
1866 g_info("scrolling far");
1867 /* Cannot reuse any part of the screen : far jump */
1868
1869
1c736ed5 1870 rectangle_pixmap (process_list,
a43d67ba 1871 control_flow_data->drawing->drawing_area->style->black_gc,
1872 TRUE,
a56a1ba4 1873 0, 0,
a43d67ba 1874 control_flow_data->drawing->width+SAFETY, // do not overlap
1c736ed5 1875 -1);
a43d67ba 1876
7abb23ad 1877 //gtk_widget_queue_draw_area (drawing->drawing_area,
1878 // 0,0,
1879 // control_flow_data->drawing->width,
1880 // control_flow_data->drawing->height);
1881 gtk_widget_queue_draw(drawing->drawing_area);
a43d67ba 1882
6395d57c 1883 drawing->damage_begin = 0;
1884 drawing->damage_end = control_flow_data->drawing->width;
1885
a43d67ba 1886 drawing_data_request(control_flow_data->drawing,
a43d67ba 1887 0, 0,
1888 control_flow_data->drawing->width,
1889 control_flow_data->drawing->height);
1890
1891 }
a56a1ba4 1892 }
1893 }
1894 } else {
1895 /* Different scale (zoom) */
1896 g_info("zoom");
1897
1c736ed5 1898 rectangle_pixmap (process_list,
cfe526b1 1899 control_flow_data->drawing->drawing_area->style->black_gc,
a56a1ba4 1900 TRUE,
1901 0, 0,
501d5405 1902 control_flow_data->drawing->width+SAFETY, // do not overlap
1c736ed5 1903 -1);
a56a1ba4 1904
7abb23ad 1905 //gtk_widget_queue_draw_area (drawing->drawing_area,
1906 // 0,0,
1907 // control_flow_data->drawing->width,
1908 // control_flow_data->drawing->height);
1909 gtk_widget_queue_draw(drawing->drawing_area);
a56a1ba4 1910
6395d57c 1911 drawing->damage_begin = 0;
1912 drawing->damage_end = control_flow_data->drawing->width;
1913
501d5405 1914 drawing_data_request(control_flow_data->drawing,
a56a1ba4 1915 0, 0,
501d5405 1916 control_flow_data->drawing->width,
1917 control_flow_data->drawing->height);
a56a1ba4 1918 }
1919
15f77e3b 1920 /* Update directly when scrolling */
1921 gdk_window_process_updates(control_flow_data->drawing->drawing_area->window,
1922 TRUE);
3cb8b205 1923
a56a1ba4 1924 return 0;
f7afe191 1925}
1926
6395d57c 1927gint traceset_notify(void *hook_data, void *call_data)
1928{
1929 ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
1930 Drawing_t *drawing = control_flow_data->drawing;
6395d57c 1931
6cec4cd2 1932 if(unlikely(drawing->gc == NULL)) {
1933 return FALSE;
1934 }
1935 if(drawing->dotted_gc == NULL) {
1936 return FALSE;
1937 }
6395d57c 1938
b9a010a2 1939 drawing_clear(control_flow_data->drawing);
1940 processlist_clear(control_flow_data->process_list);
07390ec1 1941 gtk_widget_set_size_request(
1942 control_flow_data->drawing->drawing_area,
1943 -1, processlist_get_height(control_flow_data->process_list));
d9267eec 1944 redraw_notify(control_flow_data, NULL);
6395d57c 1945
d9267eec 1946 request_background_data(control_flow_data);
6395d57c 1947
1948 return FALSE;
1949}
1950
ca0f8a8e 1951gint redraw_notify(void *hook_data, void *call_data)
1952{
1953 ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
1954 Drawing_t *drawing = control_flow_data->drawing;
1955 GtkWidget *widget = drawing->drawing_area;
1956
1957 drawing->damage_begin = 0;
51705146 1958 drawing->damage_end = drawing->width;
ca0f8a8e 1959
49217bd4 1960 /* fun feature, to be separated someday... */
1961 drawing_clear(control_flow_data->drawing);
1962 processlist_clear(control_flow_data->process_list);
07390ec1 1963 gtk_widget_set_size_request(
1964 control_flow_data->drawing->drawing_area,
1965 -1, processlist_get_height(control_flow_data->process_list));
1c736ed5 1966 // Clear the images
1967 rectangle_pixmap (control_flow_data->process_list,
ca0f8a8e 1968 widget->style->black_gc,
1969 TRUE,
1970 0, 0,
f3b7430d 1971 drawing->alloc_width,
1c736ed5 1972 -1);
ca0f8a8e 1973
f3b7430d 1974 gtk_widget_queue_draw(drawing->drawing_area);
4a24fa1f 1975
ca0f8a8e 1976 if(drawing->damage_begin < drawing->damage_end)
1977 {
1978 drawing_data_request(drawing,
ca0f8a8e 1979 drawing->damage_begin,
1980 0,
1981 drawing->damage_end-drawing->damage_begin,
51705146 1982 drawing->height);
ca0f8a8e 1983 }
1984
7abb23ad 1985 //gtk_widget_queue_draw_area(drawing->drawing_area,
1986 // 0,0,
1987 // drawing->width,
1988 // drawing->height);
ca0f8a8e 1989 return FALSE;
1990
1991}
1992
1993
1994gint continue_notify(void *hook_data, void *call_data)
a43d67ba 1995{
1996 ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
ca0f8a8e 1997 Drawing_t *drawing = control_flow_data->drawing;
a43d67ba 1998
6395d57c 1999 //g_assert(widget->allocation.width == drawing->damage_end);
ca0f8a8e 2000
2001 if(drawing->damage_begin < drawing->damage_end)
2002 {
2003 drawing_data_request(drawing,
ca0f8a8e 2004 drawing->damage_begin,
2005 0,
2006 drawing->damage_end-drawing->damage_begin,
51705146 2007 drawing->height);
ca0f8a8e 2008 }
2009
2010 return FALSE;
2011}
2012
2013
1b238973 2014gint update_current_time_hook(void *hook_data, void *call_data)
f7afe191 2015{
14963be0 2016 ControlFlowData *control_flow_data = (ControlFlowData*)hook_data;
a43d67ba 2017 Drawing_t *drawing = control_flow_data->drawing;
a56a1ba4 2018
224446ce 2019 LttTime current_time = *((LttTime*)call_data);
a56a1ba4 2020
ca0f8a8e 2021 TimeWindow time_window =
2022 lttvwindow_get_time_window(control_flow_data->tab);
a56a1ba4 2023
ca0f8a8e 2024 LttTime time_begin = time_window.start_time;
2025 LttTime width = time_window.time_width;
90ef7e4a 2026 LttTime half_width;
2027 {
2028 guint64 time_ll = ltt_time_to_uint64(width);
2029 time_ll = time_ll >> 1; /* divide by two */
2030 half_width = ltt_time_from_uint64(time_ll);
2031 }
a56a1ba4 2032 LttTime time_end = ltt_time_add(time_begin, width);
2033
2034 LttvTracesetContext * tsc =
ca0f8a8e 2035 lttvwindow_get_traceset_context(control_flow_data->tab);
a56a1ba4 2036
ca0f8a8e 2037 LttTime trace_start = tsc->time_span.start_time;
2038 LttTime trace_end = tsc->time_span.end_time;
a56a1ba4 2039
2eef04b5 2040 g_info("New current time HOOK : %lu, %lu", current_time.tv_sec,
224446ce 2041 current_time.tv_nsec);
a56a1ba4 2042
2043
2044
2045 /* If current time is inside time interval, just move the highlight
2046 * bar */
2047
2048 /* Else, we have to change the time interval. We have to tell it
2049 * to the main window. */
2050 /* The time interval change will take care of placing the current
2051 * time at the center of the visible area, or nearest possible if we are
2052 * at one end of the trace. */
2053
2054
dbc0ef8a 2055 if(ltt_time_compare(current_time, time_begin) < 0)
a56a1ba4 2056 {
224446ce 2057 TimeWindow new_time_window;
2058
2059 if(ltt_time_compare(current_time,
dbc0ef8a 2060 ltt_time_add(trace_start,half_width)) < 0)
a56a1ba4 2061 time_begin = trace_start;
2062 else
224446ce 2063 time_begin = ltt_time_sub(current_time,half_width);
a56a1ba4 2064
224446ce 2065 new_time_window.start_time = time_begin;
2066 new_time_window.time_width = width;
a18124ff 2067 new_time_window.time_width_double = ltt_time_to_double(width);
6f26fc38 2068 new_time_window.end_time = ltt_time_add(time_begin, width);
a56a1ba4 2069
e800cf84 2070 lttvwindow_report_time_window(control_flow_data->tab, new_time_window);
a56a1ba4 2071 }
dbc0ef8a 2072 else if(ltt_time_compare(current_time, time_end) > 0)
a56a1ba4 2073 {
224446ce 2074 TimeWindow new_time_window;
2075
dbc0ef8a 2076 if(ltt_time_compare(current_time, ltt_time_sub(trace_end, half_width)) > 0)
a56a1ba4 2077 time_begin = ltt_time_sub(trace_end,width);
2078 else
224446ce 2079 time_begin = ltt_time_sub(current_time,half_width);
a56a1ba4 2080
224446ce 2081 new_time_window.start_time = time_begin;
2082 new_time_window.time_width = width;
a18124ff 2083 new_time_window.time_width_double = ltt_time_to_double(width);
6f26fc38 2084 new_time_window.end_time = ltt_time_add(time_begin, width);
a56a1ba4 2085
e800cf84 2086 lttvwindow_report_time_window(control_flow_data->tab, new_time_window);
a56a1ba4 2087
2088 }
7abb23ad 2089 gtk_widget_queue_draw(control_flow_data->drawing->drawing_area);
a56a1ba4 2090
15f77e3b 2091 /* Update directly when scrolling */
2092 gdk_window_process_updates(control_flow_data->drawing->drawing_area->window,
2093 TRUE);
2094
a56a1ba4 2095 return 0;
f7afe191 2096}
2097
8b90e648 2098typedef struct _ClosureData {
ca0f8a8e 2099 EventsRequest *events_request;
d0cd7f09 2100 LttvTracesetState *tss;
b9a010a2 2101 LttTime end_time;
bc8d270b 2102 guint x_end;
8b90e648 2103} ClosureData;
a56a1ba4 2104
8b90e648 2105
e800cf84 2106void draw_closure(gpointer key, gpointer value, gpointer user_data)
2107{
a56a1ba4 2108 ProcessInfo *process_info = (ProcessInfo*)key;
2109 HashedProcessData *hashed_process_data = (HashedProcessData*)value;
2110 ClosureData *closure_data = (ClosureData*)user_data;
2111
e800cf84 2112 EventsRequest *events_request = closure_data->events_request;
2113 ControlFlowData *control_flow_data = events_request->viewer_data;
a56a1ba4 2114
e800cf84 2115 LttvTracesetState *tss = closure_data->tss;
d6fef890 2116 LttvTracesetContext *tsc = (LttvTracesetContext*)tss;
a56a1ba4 2117
e800cf84 2118 LttTime evtime = closure_data->end_time;
d0cd7f09 2119
e800cf84 2120 {
2121 /* For the process */
2122 /* First, check if the current process is in the state computation
2123 * process list. If it is there, that means we must add it right now and
2124 * draw items from the beginning of the read for it. If it is not
2125 * present, it's a new process and it was not present : it will
2126 * be added after the state update. */
31b6868d 2127#ifdef EXTRA_CHECK
e800cf84 2128 g_assert(lttv_traceset_number(tsc->ts) > 0);
31b6868d 2129#endif //EXTRA_CHECK
2c82c4dc 2130 LttvTraceContext *tc = tsc->traces[process_info->trace_num];
348c6ba8 2131 LttvTraceState *ts = (LttvTraceState*)tc;
2c82c4dc 2132
348c6ba8 2133#if 0
2c82c4dc 2134 //FIXME : optimize data structures.
2135 LttvTracefileState *tfs;
2136 LttvTracefileContext *tfc;
2137 guint i;
2138 for(i=0;i<tc->tracefiles->len;i++) {
2139 tfc = g_array_index(tc->tracefiles, LttvTracefileContext*, i);
2140 if(ltt_tracefile_name(tfc->tf) == LTT_NAME_CPU
2141 && ltt_tracefile_num(tfc->tf) == process_info->cpu)
2142 break;
2143
2144 }
2145 g_assert(i<tc->tracefiles->len);
2146 tfs = LTTV_TRACEFILE_STATE(tfc);
348c6ba8 2147#endif //0
2c82c4dc 2148 // LttvTracefileState *tfs =
2149 // (LttvTracefileState*)tsc->traces[process_info->trace_num]->
2150 // tracefiles[process_info->cpu];
2da61677 2151
e800cf84 2152 LttvProcessState *process;
348c6ba8 2153 process = lttv_state_find_process(ts, process_info->cpu,
e025a729 2154 process_info->pid);
a56a1ba4 2155
1d1df11d 2156 if(unlikely(process != NULL)) {
e800cf84 2157
2158 /* Only draw for processes that are currently in the trace states */
ad2e83ba 2159
5c230fc4 2160 ProcessList *process_list = control_flow_data->process_list;
1d1df11d 2161#ifdef EXTRA_CHECK
e800cf84 2162 /* Should be alike when background info is ready */
2163 if(control_flow_data->background_info_waiting==0)
2164 g_assert(ltt_time_compare(process->creation_time,
2165 process_info->birth) == 0);
1d1df11d 2166#endif //EXTRA_CHECK
e800cf84 2167
2168 /* Now, the process is in the state hash and our own process hash.
2169 * We definitely can draw the items related to the ending state.
2170 */
2171
1d1df11d 2172 if(unlikely(ltt_time_compare(hashed_process_data->next_good_time,
2173 evtime) <= 0))
e800cf84 2174 {
fd22065b 2175 TimeWindow time_window =
2176 lttvwindow_get_time_window(control_flow_data->tab);
2177
2178#ifdef EXTRA_CHECK
2179 if(ltt_time_compare(evtime, time_window.start_time) == -1
2180 || ltt_time_compare(evtime, time_window.end_time) == 1)
2181 return;
2182#endif //EXTRA_CHECK
d6fef890 2183 Drawing_t *drawing = control_flow_data->drawing;
96947fcf 2184 guint width = drawing->width;
a56a1ba4 2185
bc8d270b 2186 guint x = closure_data->x_end;
8b90e648 2187
4b7dc462 2188 DrawContext draw_context;
2189
e800cf84 2190 /* Now create the drawing context that will be used to draw
2191 * items related to the last state. */
1c736ed5 2192 draw_context.drawable = hashed_process_data->pixmap;
e800cf84 2193 draw_context.gc = drawing->gc;
2194 draw_context.pango_layout = drawing->pango_layout;
e800cf84 2195 draw_context.drawinfo.end.x = x;
2196
1c736ed5 2197 draw_context.drawinfo.y.over = 1;
2198 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
2199 draw_context.drawinfo.y.under = hashed_process_data->height;
e800cf84 2200
2201 draw_context.drawinfo.start.offset.over = 0;
2202 draw_context.drawinfo.start.offset.middle = 0;
2203 draw_context.drawinfo.start.offset.under = 0;
2204 draw_context.drawinfo.end.offset.over = 0;
2205 draw_context.drawinfo.end.offset.middle = 0;
2206 draw_context.drawinfo.end.offset.under = 0;
9a1ec01b 2207#if 0
4b7dc462 2208 /* Jump over draw if we are at the same x position */
2209 if(x == hashed_process_data->x.over)
e800cf84 2210 {
4b7dc462 2211 /* jump */
2212 } else {
23093869 2213 draw_context.drawinfo.start.x = hashed_process_data->x.over;
2214 /* Draw the line */
2215 PropertiesLine prop_line = prepare_execmode_line(process);
2216 draw_line((void*)&prop_line, (void*)&draw_context);
2217
4b7dc462 2218 hashed_process_data->x.over = x;
23093869 2219 }
9a1ec01b 2220#endif //0
4b7dc462 2221
1d1df11d 2222 if(unlikely(x == hashed_process_data->x.middle &&
2223 hashed_process_data->x.middle_used)) {
b2743953 2224#if 0 /* do not mark closure : not missing information */
e72908ed 2225 if(hashed_process_data->x.middle_marked == FALSE) {
2226 /* Draw collision indicator */
2227 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
2228 gdk_draw_point(drawing->pixmap,
2229 drawing->gc,
2230 x,
2c6618bc 2231 y+(height/2)-3);
de4ea1ad 2232 hashed_process_data->x.middle_marked = TRUE;
e72908ed 2233 }
b2743953 2234#endif //0
4b7dc462 2235 /* Jump */
2236 } else {
23093869 2237 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
e800cf84 2238 /* Draw the line */
9a1ec01b 2239 PropertiesLine prop_line = prepare_s_e_line(process);
e800cf84 2240 draw_line((void*)&prop_line, (void*)&draw_context);
2241
4b7dc462 2242 /* become the last x position */
1d1df11d 2243 if(likely(x != hashed_process_data->x.middle)) {
e72908ed 2244 hashed_process_data->x.middle = x;
2245 /* but don't use the pixel */
2246 hashed_process_data->x.middle_used = FALSE;
b2743953 2247
2248 /* Calculate the next good time */
2249 convert_pixels_to_time(width, x+1, time_window,
2250 &hashed_process_data->next_good_time);
e72908ed 2251 }
e800cf84 2252 }
e800cf84 2253 }
2254 }
2255 }
2256 return;
8b90e648 2257}
2258
b9a010a2 2259int before_chunk(void *hook_data, void *call_data)
2260{
2261 EventsRequest *events_request = (EventsRequest*)hook_data;
16b9cadb 2262 LttvTracesetState *tss = (LttvTracesetState*)call_data;
7c0125e0 2263 ControlFlowData *cfd = (ControlFlowData*)events_request->viewer_data;
cd3892fe 2264#if 0
7c0125e0 2265 /* Desactivate sort */
2266 gtk_tree_sortable_set_sort_column_id(
2267 GTK_TREE_SORTABLE(cfd->process_list->list_store),
2268 TRACE_COLUMN,
2269 GTK_SORT_ASCENDING);
cd3892fe 2270#endif //0
b9a010a2 2271 drawing_chunk_begin(events_request, tss);
2272
2273 return 0;
2274}
2275
2276int before_request(void *hook_data, void *call_data)
ca0f8a8e 2277{
2278 EventsRequest *events_request = (EventsRequest*)hook_data;
16b9cadb 2279 LttvTracesetState *tss = (LttvTracesetState*)call_data;
7c0125e0 2280
ca0f8a8e 2281 drawing_data_request_begin(events_request, tss);
2282
2283 return 0;
2284}
2285
2286
8b90e648 2287/*
b9a010a2 2288 * after request is necessary in addition of after chunk in order to draw
2289 * lines until the end of the screen. after chunk just draws lines until
2290 * the last event.
2291 *
8b90e648 2292 * for each process
a56a1ba4 2293 * draw closing line
b9a010a2 2294 * expose
8b90e648 2295 */
b9a010a2 2296int after_request(void *hook_data, void *call_data)
8b90e648 2297{
ca0f8a8e 2298 EventsRequest *events_request = (EventsRequest*)hook_data;
2299 ControlFlowData *control_flow_data = events_request->viewer_data;
16b9cadb 2300 LttvTracesetState *tss = (LttvTracesetState*)call_data;
a56a1ba4 2301
5c230fc4 2302 ProcessList *process_list = control_flow_data->process_list;
b9a010a2 2303 LttTime end_time = events_request->end_time;
2304
2305 ClosureData closure_data;
2306 closure_data.events_request = (EventsRequest*)hook_data;
2307 closure_data.tss = tss;
2308 closure_data.end_time = end_time;
2309
bc8d270b 2310 TimeWindow time_window =
2311 lttvwindow_get_time_window(control_flow_data->tab);
2312 guint width = control_flow_data->drawing->width;
2313 convert_time_to_pixels(
2314 time_window,
2315 end_time,
2316 width,
2317 &closure_data.x_end);
2318
2319
b9a010a2 2320 /* Draw last items */
2321 g_hash_table_foreach(process_list->process_hash, draw_closure,
2322 (void*)&closure_data);
7c0125e0 2323
b9a010a2 2324
2325 /* Request expose */
2326 drawing_request_expose(events_request, tss, end_time);
2327 return 0;
2328}
2329
2330/*
2331 * for each process
2332 * draw closing line
e800cf84 2333 * expose
b9a010a2 2334 */
2335int after_chunk(void *hook_data, void *call_data)
2336{
2337 EventsRequest *events_request = (EventsRequest*)hook_data;
2338 ControlFlowData *control_flow_data = events_request->viewer_data;
16b9cadb 2339 LttvTracesetState *tss = (LttvTracesetState*)call_data;
2340 LttvTracesetContext *tsc = (LttvTracesetContext*)call_data;
b9a010a2 2341 LttvTracefileContext *tfc = lttv_traceset_context_get_current_tfc(tsc);
2342 LttTime end_time;
2343
5c230fc4 2344 ProcessList *process_list = control_flow_data->process_list;
b9a010a2 2345
40debf7b 2346 g_free(process_list->current_hash_data);
2347 process_list->current_hash_data = NULL;
2348
e800cf84 2349 if(tfc != NULL)
2350 end_time = LTT_TIME_MIN(tfc->timestamp, events_request->end_time);
0c5dbe3b 2351 else /* end of traceset, or position now out of request : end */
2352 end_time = events_request->end_time;
2353
a56a1ba4 2354 ClosureData closure_data;
ca0f8a8e 2355 closure_data.events_request = (EventsRequest*)hook_data;
2356 closure_data.tss = tss;
b9a010a2 2357 closure_data.end_time = end_time;
a56a1ba4 2358
bc8d270b 2359 TimeWindow time_window =
2360 lttvwindow_get_time_window(control_flow_data->tab);
2361 guint width = control_flow_data->drawing->width;
2362 convert_time_to_pixels(
2363 time_window,
2364 end_time,
2365 width,
2366 &closure_data.x_end);
2367
b9a010a2 2368 /* Draw last items */
14963be0 2369 g_hash_table_foreach(process_list->process_hash, draw_closure,
a56a1ba4 2370 (void*)&closure_data);
cd3892fe 2371#if 0
7c0125e0 2372 /* Reactivate sort */
2373 gtk_tree_sortable_set_sort_column_id(
2374 GTK_TREE_SORTABLE(control_flow_data->process_list->list_store),
2375 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
2376 GTK_SORT_ASCENDING);
2377
2378 update_index_to_pixmap(control_flow_data->process_list);
cd3892fe 2379 /* Request a full expose : drawing scrambled */
2380 gtk_widget_queue_draw(control_flow_data->drawing->drawing_area);
2381#endif //0
2382 /* Request expose (updates damages zone also) */
b9a010a2 2383 drawing_request_expose(events_request, tss, end_time);
ca0f8a8e 2384
2385 return 0;
8b90e648 2386}
2387
This page took 0.180353 seconds and 4 git commands to generate.