resourceview: fix warnings
[lttv.git] / ltt / branches / poly / lttv / modules / gui / resourceview / eventhooks.c
CommitLineData
9e01e6d4 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
20/*****************************************************************************
21 * Hooks to be called by the main window *
22 *****************************************************************************/
23
24
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 *
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.
31 *
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.
34 *
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
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
48#ifdef HAVE_CONFIG_H
49#include <config.h>
50#endif
51
52//#define PANGO_ENABLE_BACKEND
53#include <gtk/gtk.h>
54#include <gdk/gdk.h>
55#include <glib.h>
56#include <assert.h>
57#include <string.h>
58#include <stdio.h>
59
60//#include <pango/pango.h>
61
62#include <ltt/event.h>
63#include <ltt/time.h>
9e01e6d4 64#include <ltt/trace.h>
65
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>
72
73
74#include "eventhooks.h"
75#include "cfv.h"
76#include "processlist.h"
77#include "drawing.h"
78
79
80#define MAX_PATH_LEN 256
81#define STATE_LINE_WIDTH 4
82#define COLLISION_POSITION(height) (((height - STATE_LINE_WIDTH)/2) -3)
83
84extern GSList *g_legend_list;
85
86
87/* Action to do when background computation completed.
88 *
89 * Wait for all the awaited computations to be over.
90 */
91
92static gint background_ready(void *hook_data, void *call_data)
93{
67f72973 94 ControlFlowData *resourceview_data = (ControlFlowData *)hook_data;
9e01e6d4 95 LttvTrace *trace = (LttvTrace*)call_data;
96
67f72973 97 resourceview_data->background_info_waiting--;
9e01e6d4 98
67f72973 99 if(resourceview_data->background_info_waiting == 0) {
9e01e6d4 100 g_message("control flow viewer : background computation data ready.");
101
67f72973 102 drawing_clear(resourceview_data->drawing);
103 processlist_clear(resourceview_data->process_list);
9e01e6d4 104 gtk_widget_set_size_request(
67f72973 105 resourceview_data->drawing->drawing_area,
106 -1, processlist_get_height(resourceview_data->process_list));
107 redraw_notify(resourceview_data, NULL);
9e01e6d4 108 }
109
110 return 0;
111}
112
113
114/* Request background computation. Verify if it is in progress or ready first.
115 * Only for each trace in the tab's traceset.
116 */
67f72973 117static void request_background_data(ControlFlowData *resourceview_data)
9e01e6d4 118{
119 LttvTracesetContext * tsc =
67f72973 120 lttvwindow_get_traceset_context(resourceview_data->tab);
9e01e6d4 121 gint num_traces = lttv_traceset_number(tsc->ts);
122 gint i;
123 LttvTrace *trace;
124 LttvTraceState *tstate;
125
126 LttvHooks *background_ready_hook =
127 lttv_hooks_new();
67f72973 128 lttv_hooks_add(background_ready_hook, background_ready, resourceview_data,
9e01e6d4 129 LTTV_PRIO_DEFAULT);
67f72973 130 resourceview_data->background_info_waiting = 0;
9e01e6d4 131
132 for(i=0;i<num_traces;i++) {
133 trace = lttv_traceset_get(tsc->ts, i);
134 tstate = LTTV_TRACE_STATE(tsc->traces[i]);
135
136 if(lttvwindowtraces_get_ready(g_quark_from_string("state"),trace)==FALSE
137 && !tstate->has_precomputed_states) {
138
139 if(lttvwindowtraces_get_in_progress(g_quark_from_string("state"),
140 trace) == FALSE) {
141 /* We first remove requests that could have been done for the same
142 * information. Happens when two viewers ask for it before servicing
143 * starts.
144 */
145 if(!lttvwindowtraces_background_request_find(trace, "state"))
146 lttvwindowtraces_background_request_queue(
67f72973 147 main_window_get_widget(resourceview_data->tab), trace, "state");
148 lttvwindowtraces_background_notify_queue(resourceview_data,
9e01e6d4 149 trace,
150 ltt_time_infinite,
151 NULL,
152 background_ready_hook);
67f72973 153 resourceview_data->background_info_waiting++;
9e01e6d4 154 } else { /* in progress */
155
67f72973 156 lttvwindowtraces_background_notify_current(resourceview_data,
9e01e6d4 157 trace,
158 ltt_time_infinite,
159 NULL,
160 background_ready_hook);
67f72973 161 resourceview_data->background_info_waiting++;
9e01e6d4 162 }
163 } else {
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.
167 */
168 }
9e01e6d4 169 }
170
171 lttv_hooks_destroy(background_ready_hook);
172}
173
174
9e01e6d4 175/**
176 * Event Viewer's constructor hook
177 *
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.
182 */
183GtkWidget *
58a9b31b 184h_resourceview(LttvPlugin *plugin)
9e01e6d4 185{
186 LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin);
187 Tab *tab = ptab->tab;
188 g_info("h_guicontrolflow, %p", tab);
67f72973 189 ControlFlowData *resourceview_data = resourceview(ptab);
9e01e6d4 190
67f72973 191 resourceview_data->tab = tab;
9e01e6d4 192
193 // Unreg done in the GuiControlFlow_Destructor
194 lttvwindow_register_traceset_notify(tab,
195 traceset_notify,
67f72973 196 resourceview_data);
9e01e6d4 197
198 lttvwindow_register_time_window_notify(tab,
199 update_time_window_hook,
67f72973 200 resourceview_data);
9e01e6d4 201 lttvwindow_register_current_time_notify(tab,
202 update_current_time_hook,
67f72973 203 resourceview_data);
9e01e6d4 204 lttvwindow_register_redraw_notify(tab,
205 redraw_notify,
67f72973 206 resourceview_data);
9e01e6d4 207 lttvwindow_register_continue_notify(tab,
208 continue_notify,
67f72973 209 resourceview_data);
210 request_background_data(resourceview_data);
9e01e6d4 211
212
67f72973 213 return guicontrolflow_get_widget(resourceview_data) ;
9e01e6d4 214
215}
216
217void legend_destructor(GtkWindow *legend)
218{
219 g_legend_list = g_slist_remove(g_legend_list, legend);
220}
221
222/* Create a popup legend */
223GtkWidget *
224h_legend(LttvPlugin *plugin)
225{
226 LttvPluginTab *ptab = LTTV_PLUGIN_TAB(plugin);
227 Tab *tab = ptab->tab;
228 g_info("h_legend, %p", tab);
229
230 GtkWindow *legend = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
231
232 g_legend_list = g_slist_append(
233 g_legend_list,
234 legend);
235
236 g_object_set_data_full(
237 G_OBJECT(legend),
238 "legend",
239 legend,
240 (GDestroyNotify)legend_destructor);
241
242 gtk_window_set_title(legend, "Control Flow View Legend");
243
244 GtkWidget *pixmap = create_pixmap(GTK_WIDGET(legend), "lttv-color-list.png");
245
9e01e6d4 246 gtk_container_add(GTK_CONTAINER(legend), GTK_WIDGET(pixmap));
247
248 gtk_widget_show(GTK_WIDGET(pixmap));
249 gtk_widget_show(GTK_WIDGET(legend));
250
251
252 return NULL; /* This is a popup window */
253}
254
255
256int event_selected_hook(void *hook_data, void *call_data)
257{
67f72973 258 ControlFlowData *resourceview_data = (ControlFlowData*) hook_data;
9e01e6d4 259 guint *event_number = (guint*) call_data;
260
261 g_debug("DEBUG : event selected by main window : %u", *event_number);
262
263 return 0;
264}
265
d3d99fde 266static void cpu_set_line_color(PropertiesLine *prop_line, LttvCPUState *s)
598026ba 267{
1b171947 268 GQuark present_state;
269
270 if(s->mode_stack->len == 0)
271 present_state = LTTV_CPU_UNKNOWN;
272 else
273 present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
d3d99fde 274
201fcc15 275 if(present_state == LTTV_CPU_IDLE) {
598026ba 276 prop_line->color = drawing_colors_cpu[COL_CPU_IDLE];
277 }
278 else if(present_state == LTTV_CPU_BUSY) {
279 prop_line->color = drawing_colors_cpu[COL_CPU_BUSY];
280 }
281 else if(present_state == LTTV_CPU_IRQ) {
282 prop_line->color = drawing_colors_cpu[COL_CPU_IRQ];
283 }
d3d99fde 284 else if(present_state == LTTV_CPU_TRAP) {
285 prop_line->color = drawing_colors_cpu[COL_CPU_TRAP];
201fcc15 286 } else {
287 prop_line->color = drawing_colors_cpu[COL_CPU_UNKNOWN];
d3d99fde 288 }
598026ba 289}
9e01e6d4 290
8743690d 291static void irq_set_line_color(PropertiesLine *prop_line, LttvIRQState *s)
292{
1b171947 293 GQuark present_state;
294 if(s->mode_stack->len == 0)
295 present_state = LTTV_IRQ_UNKNOWN;
296 else
297 present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
8743690d 298
1b171947 299 if(present_state == LTTV_IRQ_IDLE) {
8743690d 300 prop_line->color = drawing_colors_irq[COL_IRQ_IDLE];
301 }
302 else if(present_state == LTTV_IRQ_BUSY) {
303 prop_line->color = drawing_colors_irq[COL_IRQ_BUSY];
304 }
1b171947 305 else {
306 prop_line->color = drawing_colors_irq[COL_IRQ_UNKNOWN];
307 }
8743690d 308}
309
20d16f82 310static void bdev_set_line_color(PropertiesLine *prop_line, LttvBdevState *s)
311{
1b171947 312 GQuark present_state;
23e59a12 313 if(s == 0 || s->mode_stack->len == 0)
1b171947 314 present_state = LTTV_BDEV_UNKNOWN;
315 else
316 present_state = ((GQuark*)s->mode_stack->data)[s->mode_stack->len-1];
20d16f82 317
1b171947 318 if(present_state == LTTV_BDEV_IDLE) {
20d16f82 319 prop_line->color = drawing_colors_bdev[COL_BDEV_IDLE];
320 }
321 else if(present_state == LTTV_BDEV_BUSY_READING) {
322 prop_line->color = drawing_colors_bdev[COL_BDEV_BUSY_READING];
323 }
324 else if(present_state == LTTV_BDEV_BUSY_WRITING) {
325 prop_line->color = drawing_colors_bdev[COL_BDEV_BUSY_WRITING];
326 }
1b171947 327 else {
328 prop_line->color = drawing_colors_bdev[COL_BDEV_UNKNOWN];
329 }
20d16f82 330}
331
9e01e6d4 332/* before_schedchange_hook
333 *
334 * This function basically draw lines and icons. Two types of lines are drawn :
335 * one small (3 pixels?) representing the state of the process and the second
336 * type is thicker (10 pixels?) representing on which CPU a process is running
337 * (and this only in running state).
338 *
339 * Extremums of the lines :
340 * x_min : time of the last event context for this process kept in memory.
341 * x_max : time of the current event.
342 * y : middle of the process in the process list. The process is found in the
343 * list, therefore is it's position in pixels.
344 *
345 * The choice of lines'color is defined by the context of the last event for this
346 * process.
347 */
348
349
350int before_schedchange_hook(void *hook_data, void *call_data)
351{
dd455fb8 352 LttvTraceHook *th = (LttvTraceHook*)hook_data;
353 EventsRequest *events_request = (EventsRequest*)th->hook_data;
67f72973 354 ControlFlowData *resourceview_data = events_request->viewer_data;
9e01e6d4 355
356 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
357
358 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
359 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
360
361 LttEvent *e;
362 e = ltt_tracefile_get_event(tfc->tf);
363 gint target_pid_saved = tfc->target_pid;
364
365 LttTime evtime = ltt_event_time(e);
67f72973 366 LttvFilter *filter = resourceview_data->filter;
58a9b31b 367
9e01e6d4 368 /* we are in a schedchange, before the state update. We must draw the
369 * items corresponding to the state before it changes : now is the right
370 * time to do it.
371 */
372
373 guint pid_out;
374 guint pid_in;
ca5c76ed 375 pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
376 pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1));
67f72973 377// TODO: can't we reenable this? pmf
44ffb95f 378// if(pid_in != 0 && pid_out != 0) {
379// /* not a transition to/from idle */
380// return 0;
381// }
c4e6f4dc 382
9e01e6d4 383 tfc->target_pid = pid_out;
58a9b31b 384
67f72973 385 guint cpu = tfs->cpu;
9e01e6d4 386
67f72973 387 guint trace_num = ts->parent.index;
388 /* Add process to process list (if not present) */
389 guint pl_height = 0;
390 HashedResourceData *hashed_process_data = NULL;
391 ProcessList *process_list = resourceview_data->process_list;
9e01e6d4 392
67f72973 393 hashed_process_data = resourcelist_obtain_cpu(resourceview_data, trace_num, cpu);
394
395 /* Now, the process is in the state hash and our own process hash.
396 * We definitely can draw the items related to the ending state.
397 */
398
399 if(ltt_time_compare(hashed_process_data->next_good_time,
400 evtime) > 0)
401 {
402 if(hashed_process_data->x.middle_marked == FALSE) {
403
404 TimeWindow time_window =
405 lttvwindow_get_time_window(resourceview_data->tab);
9e01e6d4 406#ifdef EXTRA_CHECK
67f72973 407 if(ltt_time_compare(evtime, time_window.start_time) == -1
408 || ltt_time_compare(evtime, time_window.end_time) == 1)
409 return;
9e01e6d4 410#endif //EXTRA_CHECK
67f72973 411 Drawing_t *drawing = resourceview_data->drawing;
412 guint width = drawing->width;
413 guint x;
414 convert_time_to_pixels(
415 time_window,
416 evtime,
417 width,
418 &x);
419
420 /* Draw collision indicator */
421 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
422 gdk_draw_point(hashed_process_data->pixmap,
423 drawing->gc,
424 x,
425 COLLISION_POSITION(hashed_process_data->height));
426 hashed_process_data->x.middle_marked = TRUE;
427 }
428 } else {
429 TimeWindow time_window =
430 lttvwindow_get_time_window(resourceview_data->tab);
9e01e6d4 431#ifdef EXTRA_CHECK
67f72973 432 if(ltt_time_compare(evtime, time_window.start_time) == -1
9e01e6d4 433 || ltt_time_compare(evtime, time_window.end_time) == 1)
67f72973 434 return;
9e01e6d4 435#endif //EXTRA_CHECK
67f72973 436 Drawing_t *drawing = resourceview_data->drawing;
437 guint width = drawing->width;
438 guint x;
439 convert_time_to_pixels(
440 time_window,
441 evtime,
442 width,
443 &x);
9e01e6d4 444
67f72973 445 /* Jump over draw if we are at the same x position */
446 if(x == hashed_process_data->x.middle &&
447 hashed_process_data->x.middle_used)
448 {
449 if(hashed_process_data->x.middle_marked == FALSE) {
450 /* Draw collision indicator */
451 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
452 gdk_draw_point(hashed_process_data->pixmap,
453 drawing->gc,
454 x,
455 COLLISION_POSITION(hashed_process_data->height));
456 hashed_process_data->x.middle_marked = TRUE;
58a9b31b 457 }
67f72973 458 /* jump */
459 } else {
460 DrawContext draw_context;
9e01e6d4 461
67f72973 462 /* Now create the drawing context that will be used to draw
463 * items related to the last state. */
464 draw_context.drawable = hashed_process_data->pixmap;
465 draw_context.gc = drawing->gc;
466 draw_context.pango_layout = drawing->pango_layout;
467 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
468 draw_context.drawinfo.end.x = x;
9e01e6d4 469
67f72973 470 draw_context.drawinfo.y.over = 1;
471 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
472 draw_context.drawinfo.y.under = hashed_process_data->height;
9e01e6d4 473
67f72973 474 draw_context.drawinfo.start.offset.over = 0;
475 draw_context.drawinfo.start.offset.middle = 0;
476 draw_context.drawinfo.start.offset.under = 0;
477 draw_context.drawinfo.end.offset.over = 0;
478 draw_context.drawinfo.end.offset.middle = 0;
479 draw_context.drawinfo.end.offset.under = 0;
9e01e6d4 480
67f72973 481 {
482 /* Draw the line */
483 //PropertiesLine prop_line = prepare_s_e_line(process);
484 PropertiesLine prop_line;
485 prop_line.line_width = STATE_LINE_WIDTH;
486 prop_line.style = GDK_LINE_SOLID;
487 prop_line.y = MIDDLE;
488 cpu_set_line_color(&prop_line, tfs->cpu_state);
489 draw_line((void*)&prop_line, (void*)&draw_context);
9e01e6d4 490
67f72973 491 }
492 /* become the last x position */
493 hashed_process_data->x.middle = x;
494 hashed_process_data->x.middle_used = TRUE;
495 hashed_process_data->x.middle_marked = FALSE;
9e01e6d4 496
67f72973 497 /* Calculate the next good time */
498 convert_pixels_to_time(width, x+1, time_window,
499 &hashed_process_data->next_good_time);
500 }
9e01e6d4 501 }
502
67f72973 503 return 0;
9e01e6d4 504}
505
58a9b31b 506/* after_schedchange_hook
507 *
508 * The draw after hook is called by the reading API to have a
509 * particular event drawn on the screen.
510 * @param hook_data ControlFlowData structure of the viewer.
511 * @param call_data Event context.
512 *
513 * This function adds items to be drawn in a queue for each process.
514 *
515 */
516int after_schedchange_hook(void *hook_data, void *call_data)
9e01e6d4 517{
dd455fb8 518 LttvTraceHook *th = (LttvTraceHook*)hook_data;
519 EventsRequest *events_request = (EventsRequest*)th->hook_data;
67f72973 520 ControlFlowData *resourceview_data = events_request->viewer_data;
44ffb95f 521 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
44ffb95f 522 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
44ffb95f 523 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
44ffb95f 524 LttEvent *e;
67f72973 525
44ffb95f 526 e = ltt_tracefile_get_event(tfc->tf);
527
67f72973 528 LttvFilter *filter = resourceview_data->filter;
44ffb95f 529 if(filter != NULL && filter->head != NULL)
530 if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
531 tfc->t_context->t,tfc,NULL,NULL))
532 return FALSE;
533
534 LttTime evtime = ltt_event_time(e);
535
44ffb95f 536 /* Add process to process list (if not present) */
537 LttvProcessState *process_in;
538 LttTime birth;
539 guint pl_height = 0;
540 HashedResourceData *hashed_process_data_in = NULL;
541
67f72973 542 ProcessList *process_list = resourceview_data->process_list;
44ffb95f 543
544 guint pid_in;
545 {
546 guint pid_out;
ca5c76ed 547 pid_out = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
548 pid_in = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1));
44ffb95f 549 }
550
551
552 /* Find process pid_in in the list... */
553 //process_in = lttv_state_find_process(ts, ANY_CPU, pid_in);
554 //process_in = tfs->process;
555 guint cpu = tfs->cpu;
44ffb95f 556 guint trace_num = ts->parent.index;
557 process_in = ts->running_process[cpu];
558 /* It should exist, because we are after the state update. */
559#ifdef EXTRA_CHECK
560 g_assert(process_in != NULL);
561#endif //EXTRA_CHECK
562 birth = process_in->creation_time;
563
67f72973 564 //hashed_process_data_in = processlist_get_process_data(process_list, cpuq, trace_num);
565 hashed_process_data_in = resourcelist_obtain_cpu(resourceview_data, trace_num, cpu);
566
44ffb95f 567 /* Set the current process */
568 process_list->current_hash_data[trace_num][process_in->cpu] =
569 hashed_process_data_in;
570
571 if(ltt_time_compare(hashed_process_data_in->next_good_time,
572 evtime) <= 0)
573 {
574 TimeWindow time_window =
67f72973 575 lttvwindow_get_time_window(resourceview_data->tab);
44ffb95f 576
577#ifdef EXTRA_CHECK
578 if(ltt_time_compare(evtime, time_window.start_time) == -1
579 || ltt_time_compare(evtime, time_window.end_time) == 1)
580 return;
581#endif //EXTRA_CHECK
67f72973 582 Drawing_t *drawing = resourceview_data->drawing;
44ffb95f 583 guint width = drawing->width;
584 guint new_x;
585
586 convert_time_to_pixels(
587 time_window,
588 evtime,
589 width,
590 &new_x);
591
592 if(hashed_process_data_in->x.middle != new_x) {
593 hashed_process_data_in->x.middle = new_x;
594 hashed_process_data_in->x.middle_used = FALSE;
595 hashed_process_data_in->x.middle_marked = FALSE;
596 }
597 }
58a9b31b 598 return 0;
599}
9e01e6d4 600
58a9b31b 601/* before_execmode_hook
602 *
603 * This function basically draw lines and icons. Two types of lines are drawn :
604 * one small (3 pixels?) representing the state of the process and the second
605 * type is thicker (10 pixels?) representing on which CPU a process is running
606 * (and this only in running state).
607 *
608 * Extremums of the lines :
609 * x_min : time of the last event context for this process kept in memory.
610 * x_max : time of the current event.
611 * y : middle of the process in the process list. The process is found in the
612 * list, therefore is it's position in pixels.
613 *
614 * The choice of lines'color is defined by the context of the last event for this
615 * process.
616 */
9e01e6d4 617
598026ba 618int before_execmode_hook(void *hook_data, void *call_data)
619{
dd455fb8 620 LttvTraceHook *th = (LttvTraceHook*)hook_data;
621 EventsRequest *events_request = (EventsRequest*)th->hook_data;
67f72973 622 ControlFlowData *resourceview_data = events_request->viewer_data;
598026ba 623
624 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
625
626 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
627 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
628
629 LttEvent *e;
630 e = ltt_tracefile_get_event(tfc->tf);
631
632 LttTime evtime = ltt_event_time(e);
633
8743690d 634 before_execmode_hook_irq(hook_data, call_data);
635
598026ba 636 /* we are in a execmode, before the state update. We must draw the
637 * items corresponding to the state before it changes : now is the right
638 * time to do it.
639 */
640 /* For the pid */
598026ba 641 guint cpu = tfs->cpu;
67f72973 642
598026ba 643 guint trace_num = ts->parent.index;
644 LttvProcessState *process = ts->running_process[cpu];
645 g_assert(process != NULL);
646
598026ba 647 /* Well, the process_out existed : we must get it in the process hash
648 * or add it, and draw its items.
649 */
650 /* Add process to process list (if not present) */
651 guint pl_height = 0;
652 HashedResourceData *hashed_process_data = NULL;
67f72973 653 ProcessList *process_list = resourceview_data->process_list;
654
598026ba 655 LttTime birth = process->creation_time;
656
657 if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) {
658 hashed_process_data = process_list->current_hash_data[trace_num][cpu];
659 } else {
67f72973 660 hashed_process_data = resourcelist_obtain_cpu(resourceview_data, trace_num, cpu);
661
598026ba 662 /* Set the current process */
663 process_list->current_hash_data[trace_num][process->cpu] =
664 hashed_process_data;
665 }
666
667 /* Now, the process is in the state hash and our own process hash.
668 * We definitely can draw the items related to the ending state.
669 */
670
671 if(likely(ltt_time_compare(hashed_process_data->next_good_time,
672 evtime) > 0))
673 {
674 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
675 TimeWindow time_window =
67f72973 676 lttvwindow_get_time_window(resourceview_data->tab);
598026ba 677
678#ifdef EXTRA_CHECK
679 if(ltt_time_compare(evtime, time_window.start_time) == -1
680 || ltt_time_compare(evtime, time_window.end_time) == 1)
681 return;
682#endif //EXTRA_CHECK
67f72973 683 Drawing_t *drawing = resourceview_data->drawing;
598026ba 684 guint width = drawing->width;
685 guint x;
686 convert_time_to_pixels(
687 time_window,
688 evtime,
689 width,
690 &x);
691
692 /* Draw collision indicator */
693 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
694 gdk_draw_point(hashed_process_data->pixmap,
695 drawing->gc,
696 x,
697 COLLISION_POSITION(hashed_process_data->height));
698 hashed_process_data->x.middle_marked = TRUE;
699 }
d3d99fde 700 }
701 else {
598026ba 702 TimeWindow time_window =
67f72973 703 lttvwindow_get_time_window(resourceview_data->tab);
598026ba 704
705#ifdef EXTRA_CHECK
706 if(ltt_time_compare(evtime, time_window.start_time) == -1
707 || ltt_time_compare(evtime, time_window.end_time) == 1)
708 return;
709#endif //EXTRA_CHECK
67f72973 710 Drawing_t *drawing = resourceview_data->drawing;
598026ba 711 guint width = drawing->width;
712 guint x;
713
714 convert_time_to_pixels(
715 time_window,
716 evtime,
717 width,
718 &x);
719
720
721 /* Jump over draw if we are at the same x position */
722 if(unlikely(x == hashed_process_data->x.middle &&
723 hashed_process_data->x.middle_used))
724 {
725 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
726 /* Draw collision indicator */
727 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
728 gdk_draw_point(hashed_process_data->pixmap,
729 drawing->gc,
730 x,
731 COLLISION_POSITION(hashed_process_data->height));
732 hashed_process_data->x.middle_marked = TRUE;
733 }
734 /* jump */
d3d99fde 735 }
736 else {
598026ba 737
738 DrawContext draw_context;
739 /* Now create the drawing context that will be used to draw
740 * items related to the last state. */
741 draw_context.drawable = hashed_process_data->pixmap;
742 draw_context.gc = drawing->gc;
743 draw_context.pango_layout = drawing->pango_layout;
744 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
745 draw_context.drawinfo.end.x = x;
746
747 draw_context.drawinfo.y.over = 1;
748 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
749 draw_context.drawinfo.y.under = hashed_process_data->height;
750
751 draw_context.drawinfo.start.offset.over = 0;
752 draw_context.drawinfo.start.offset.middle = 0;
753 draw_context.drawinfo.start.offset.under = 0;
754 draw_context.drawinfo.end.offset.over = 0;
755 draw_context.drawinfo.end.offset.middle = 0;
756 draw_context.drawinfo.end.offset.under = 0;
757
758 {
759 /* Draw the line */
760 PropertiesLine prop_line;
d3d99fde 761 prop_line.line_width = STATE_LINE_WIDTH;
762 prop_line.style = GDK_LINE_SOLID;
763 prop_line.y = MIDDLE;
764 cpu_set_line_color(&prop_line, tfs->cpu_state);
598026ba 765 draw_line((void*)&prop_line, (void*)&draw_context);
766 }
767 /* become the last x position */
768 hashed_process_data->x.middle = x;
769 hashed_process_data->x.middle_used = TRUE;
770 hashed_process_data->x.middle_marked = FALSE;
771
772 /* Calculate the next good time */
773 convert_pixels_to_time(width, x+1, time_window,
774 &hashed_process_data->next_good_time);
775 }
776 }
777
778 return 0;
779}
9e01e6d4 780
8743690d 781int before_execmode_hook_irq(void *hook_data, void *call_data)
782{
dd455fb8 783 LttvTraceHook *th = (LttvTraceHook*)hook_data;
784 EventsRequest *events_request = (EventsRequest*)th->hook_data;
67f72973 785 ControlFlowData *resourceview_data = events_request->viewer_data;
8743690d 786
787 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
788
789 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
790 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
791
792 LttEvent *e;
793 e = ltt_tracefile_get_event(tfc->tf);
794
795 LttTime evtime = ltt_event_time(e);
796
ca5c76ed 797 LttTrace *trace = tfc->t_context->t;
798
8743690d 799 /* we are in a execmode, before the state update. We must draw the
800 * items corresponding to the state before it changes : now is the right
801 * time to do it.
802 */
803 /* For the pid */
804
805 guint64 irq;
806 guint cpu = tfs->cpu;
807
ca5c76ed 808 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)));
809 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)));
810 if(ev_id_entry == e->event_id) {
811 irq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
8743690d 812 }
ca5c76ed 813 else if(ev_id_exit == e->event_id) {
8743690d 814 irq = ts->cpu_states[cpu].last_irq;
815 }
816 else {
817 return 0;
818 }
819
8743690d 820 guint trace_num = ts->parent.index;
821
8743690d 822 /* Well, the process_out existed : we must get it in the process hash
823 * or add it, and draw its items.
824 */
825 /* Add process to process list (if not present) */
826 guint pl_height = 0;
827 HashedResourceData *hashed_process_data = NULL;
67f72973 828 ProcessList *process_list = resourceview_data->process_list;
829
830 hashed_process_data = resourcelist_obtain_irq(resourceview_data, trace_num, irq);
8743690d 831
832 /* Now, the process is in the state hash and our own process hash.
833 * We definitely can draw the items related to the ending state.
834 */
835
836 if(likely(ltt_time_compare(hashed_process_data->next_good_time,
837 evtime) > 0))
838 {
839 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
840 TimeWindow time_window =
67f72973 841 lttvwindow_get_time_window(resourceview_data->tab);
8743690d 842
843#ifdef EXTRA_CHECK
844 if(ltt_time_compare(evtime, time_window.start_time) == -1
845 || ltt_time_compare(evtime, time_window.end_time) == 1)
846 return;
847#endif //EXTRA_CHECK
67f72973 848 Drawing_t *drawing = resourceview_data->drawing;
8743690d 849 guint width = drawing->width;
850 guint x;
851 convert_time_to_pixels(
852 time_window,
853 evtime,
854 width,
855 &x);
856
857 /* Draw collision indicator */
858 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
859 gdk_draw_point(hashed_process_data->pixmap,
860 drawing->gc,
861 x,
862 COLLISION_POSITION(hashed_process_data->height));
863 hashed_process_data->x.middle_marked = TRUE;
864 }
865 }
866 else {
867 TimeWindow time_window =
67f72973 868 lttvwindow_get_time_window(resourceview_data->tab);
8743690d 869
870#ifdef EXTRA_CHECK
871 if(ltt_time_compare(evtime, time_window.start_time) == -1
872 || ltt_time_compare(evtime, time_window.end_time) == 1)
873 return;
874#endif //EXTRA_CHECK
67f72973 875 Drawing_t *drawing = resourceview_data->drawing;
8743690d 876 guint width = drawing->width;
877 guint x;
878
879 convert_time_to_pixels(
880 time_window,
881 evtime,
882 width,
883 &x);
884
885
886 /* Jump over draw if we are at the same x position */
887 if(unlikely(x == hashed_process_data->x.middle &&
888 hashed_process_data->x.middle_used))
889 {
890 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
891 /* Draw collision indicator */
892 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
893 gdk_draw_point(hashed_process_data->pixmap,
894 drawing->gc,
895 x,
896 COLLISION_POSITION(hashed_process_data->height));
897 hashed_process_data->x.middle_marked = TRUE;
898 }
899 /* jump */
900 }
901 else {
902
903 DrawContext draw_context;
904 /* Now create the drawing context that will be used to draw
905 * items related to the last state. */
906 draw_context.drawable = hashed_process_data->pixmap;
907 draw_context.gc = drawing->gc;
908 draw_context.pango_layout = drawing->pango_layout;
909 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
910 draw_context.drawinfo.end.x = x;
911
912 draw_context.drawinfo.y.over = 1;
913 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
914 draw_context.drawinfo.y.under = hashed_process_data->height;
915
916 draw_context.drawinfo.start.offset.over = 0;
917 draw_context.drawinfo.start.offset.middle = 0;
918 draw_context.drawinfo.start.offset.under = 0;
919 draw_context.drawinfo.end.offset.over = 0;
920 draw_context.drawinfo.end.offset.middle = 0;
921 draw_context.drawinfo.end.offset.under = 0;
922
923 {
924 /* Draw the line */
925 PropertiesLine prop_line;
926 prop_line.line_width = STATE_LINE_WIDTH;
927 prop_line.style = GDK_LINE_SOLID;
928 prop_line.y = MIDDLE;
929 irq_set_line_color(&prop_line, &ts->irq_states[irq]);
930 draw_line((void*)&prop_line, (void*)&draw_context);
931 }
932 /* become the last x position */
933 hashed_process_data->x.middle = x;
934 hashed_process_data->x.middle_used = TRUE;
935 hashed_process_data->x.middle_marked = FALSE;
936
937 /* Calculate the next good time */
938 convert_pixels_to_time(width, x+1, time_window,
939 &hashed_process_data->next_good_time);
940 }
941 }
942
943 return 0;
944}
945
20d16f82 946int before_bdev_event_hook(void *hook_data, void *call_data)
947{
dd455fb8 948 LttvTraceHook *th = (LttvTraceHook*)hook_data;
949 EventsRequest *events_request = (EventsRequest*)th->hook_data;
67f72973 950 ControlFlowData *resourceview_data = events_request->viewer_data;
20d16f82 951
952 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
953
954 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
955 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
956
957 LttEvent *e;
958 e = ltt_tracefile_get_event(tfc->tf);
959
960 LttTime evtime = ltt_event_time(e);
961
20d16f82 962 /* we are in a execmode, before the state update. We must draw the
963 * items corresponding to the state before it changes : now is the right
964 * time to do it.
965 */
966 /* For the pid */
967
968 guint cpu = tfs->cpu;
ca5c76ed 969 guint8 major = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
970 guint8 minor = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 1));
971 guint oper = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 2));
20d16f82 972 gint devcode_gint = MKDEV(major,minor);
973
20d16f82 974 guint trace_num = ts->parent.index;
975
976 LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint);
23e59a12 977 /* the result of the lookup might be NULL. that's ok, the rest of the function
978 should understand it was not found and that its state is unknown */
20d16f82 979
20d16f82 980 /* Well, the process_out existed : we must get it in the process hash
981 * or add it, and draw its items.
982 */
983 /* Add process to process list (if not present) */
984 guint pl_height = 0;
985 HashedResourceData *hashed_process_data = NULL;
67f72973 986 ProcessList *process_list = resourceview_data->process_list;
20d16f82 987// LttTime birth = process->creation_time;
988
989// if(likely(process_list->current_hash_data[trace_num][cpu] != NULL)) {
990// hashed_process_data = process_list->current_hash_data[trace_num][cpu];
991// } else {
67f72973 992 hashed_process_data = resourcelist_obtain_bdev(resourceview_data, trace_num, devcode_gint);
993 ////hashed_process_data = processlist_get_process_data(process_list, resourceq, trace_num);
20d16f82 994// hashed_process_data = processlist_get_process_data(process_list,
995// pid,
996// process->cpu,
997// &birth,
998// trace_num);
67f72973 999//
20d16f82 1000 /* Set the current process */
1001// process_list->current_hash_data[trace_num][process->cpu] =
1002// hashed_process_data;
1003// }
1004
1005 /* Now, the process is in the state hash and our own process hash.
1006 * We definitely can draw the items related to the ending state.
1007 */
1008
1009 if(likely(ltt_time_compare(hashed_process_data->next_good_time,
1010 evtime) > 0))
1011 {
1012 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
1013 TimeWindow time_window =
67f72973 1014 lttvwindow_get_time_window(resourceview_data->tab);
20d16f82 1015
1016#ifdef EXTRA_CHECK
1017 if(ltt_time_compare(evtime, time_window.start_time) == -1
1018 || ltt_time_compare(evtime, time_window.end_time) == 1)
1019 return;
1020#endif //EXTRA_CHECK
67f72973 1021 Drawing_t *drawing = resourceview_data->drawing;
20d16f82 1022 guint width = drawing->width;
1023 guint x;
1024 convert_time_to_pixels(
1025 time_window,
1026 evtime,
1027 width,
1028 &x);
1029
1030 /* Draw collision indicator */
1031 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1032 gdk_draw_point(hashed_process_data->pixmap,
1033 drawing->gc,
1034 x,
1035 COLLISION_POSITION(hashed_process_data->height));
1036 hashed_process_data->x.middle_marked = TRUE;
1037 }
1038 }
1039 else {
1040 TimeWindow time_window =
67f72973 1041 lttvwindow_get_time_window(resourceview_data->tab);
20d16f82 1042
1043#ifdef EXTRA_CHECK
1044 if(ltt_time_compare(evtime, time_window.start_time) == -1
1045 || ltt_time_compare(evtime, time_window.end_time) == 1)
1046 return;
1047#endif //EXTRA_CHECK
67f72973 1048 Drawing_t *drawing = resourceview_data->drawing;
20d16f82 1049 guint width = drawing->width;
1050 guint x;
1051
1052 convert_time_to_pixels(
1053 time_window,
1054 evtime,
1055 width,
1056 &x);
1057
1058
1059 /* Jump over draw if we are at the same x position */
1060 if(unlikely(x == hashed_process_data->x.middle &&
1061 hashed_process_data->x.middle_used))
1062 {
1063 if(unlikely(hashed_process_data->x.middle_marked == FALSE)) {
1064 /* Draw collision indicator */
1065 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1066 gdk_draw_point(hashed_process_data->pixmap,
1067 drawing->gc,
1068 x,
1069 COLLISION_POSITION(hashed_process_data->height));
1070 hashed_process_data->x.middle_marked = TRUE;
1071 }
1072 /* jump */
1073 }
1074 else {
1075
1076 DrawContext draw_context;
1077 /* Now create the drawing context that will be used to draw
1078 * items related to the last state. */
1079 draw_context.drawable = hashed_process_data->pixmap;
1080 draw_context.gc = drawing->gc;
1081 draw_context.pango_layout = drawing->pango_layout;
1082 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
1083 draw_context.drawinfo.end.x = x;
1084
1085 draw_context.drawinfo.y.over = 1;
1086 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
1087 draw_context.drawinfo.y.under = hashed_process_data->height;
1088
1089 draw_context.drawinfo.start.offset.over = 0;
1090 draw_context.drawinfo.start.offset.middle = 0;
1091 draw_context.drawinfo.start.offset.under = 0;
1092 draw_context.drawinfo.end.offset.over = 0;
1093 draw_context.drawinfo.end.offset.middle = 0;
1094 draw_context.drawinfo.end.offset.under = 0;
1095
1096 {
1097 /* Draw the line */
1098 PropertiesLine prop_line;
1099 prop_line.line_width = STATE_LINE_WIDTH;
1100 prop_line.style = GDK_LINE_SOLID;
1101 prop_line.y = MIDDLE;
1102 bdev_set_line_color(&prop_line, bdev);
1103 draw_line((void*)&prop_line, (void*)&draw_context);
1104 }
1105 /* become the last x position */
1106 hashed_process_data->x.middle = x;
1107 hashed_process_data->x.middle_used = TRUE;
1108 hashed_process_data->x.middle_marked = FALSE;
1109
1110 /* Calculate the next good time */
1111 convert_pixels_to_time(width, x+1, time_window,
1112 &hashed_process_data->next_good_time);
1113 }
1114 }
1115
1116 return 0;
1117}
1118
9e01e6d4 1119gint update_time_window_hook(void *hook_data, void *call_data)
1120{
67f72973 1121 ControlFlowData *resourceview_data = (ControlFlowData*) hook_data;
1122 Drawing_t *drawing = resourceview_data->drawing;
1123 ProcessList *process_list = resourceview_data->process_list;
9e01e6d4 1124
1125 const TimeWindowNotifyData *time_window_nofify_data =
1126 ((const TimeWindowNotifyData *)call_data);
1127
1128 TimeWindow *old_time_window =
1129 time_window_nofify_data->old_time_window;
1130 TimeWindow *new_time_window =
1131 time_window_nofify_data->new_time_window;
1132
1133 /* Update the ruler */
67f72973 1134 drawing_update_ruler(resourceview_data->drawing,
9e01e6d4 1135 new_time_window);
1136
1137
1138 /* Two cases : zoom in/out or scrolling */
1139
1140 /* In order to make sure we can reuse the old drawing, the scale must
1141 * be the same and the new time interval being partly located in the
1142 * currently shown time interval. (reuse is only for scrolling)
1143 */
1144
1145 g_info("Old time window HOOK : %lu, %lu to %lu, %lu",
1146 old_time_window->start_time.tv_sec,
1147 old_time_window->start_time.tv_nsec,
1148 old_time_window->time_width.tv_sec,
1149 old_time_window->time_width.tv_nsec);
1150
1151 g_info("New time window HOOK : %lu, %lu to %lu, %lu",
1152 new_time_window->start_time.tv_sec,
1153 new_time_window->start_time.tv_nsec,
1154 new_time_window->time_width.tv_sec,
1155 new_time_window->time_width.tv_nsec);
1156
1157 if( new_time_window->time_width.tv_sec == old_time_window->time_width.tv_sec
1158 && new_time_window->time_width.tv_nsec == old_time_window->time_width.tv_nsec)
1159 {
1160 /* Same scale (scrolling) */
1161 g_info("scrolling");
1162 LttTime *ns = &new_time_window->start_time;
1163 LttTime *nw = &new_time_window->time_width;
1164 LttTime *os = &old_time_window->start_time;
1165 LttTime *ow = &old_time_window->time_width;
1166 LttTime old_end = old_time_window->end_time;
1167 LttTime new_end = new_time_window->end_time;
1168 //if(ns<os+w<ns+w)
1169 //if(ns<os+w && os+w<ns+w)
1170 //if(ns<old_end && os<ns)
1171 if(ltt_time_compare(*ns, old_end) == -1
1172 && ltt_time_compare(*os, *ns) == -1)
1173 {
1174 g_info("scrolling near right");
1175 /* Scroll right, keep right part of the screen */
1176 guint x = 0;
67f72973 1177 guint width = resourceview_data->drawing->width;
9e01e6d4 1178 convert_time_to_pixels(
1179 *old_time_window,
1180 *ns,
1181 width,
1182 &x);
1183
1184 /* Copy old data to new location */
1185 copy_pixmap_region(process_list,
1186 NULL,
67f72973 1187 resourceview_data->drawing->drawing_area->style->black_gc,
9e01e6d4 1188 NULL,
1189 x, 0,
1190 0, 0,
67f72973 1191 resourceview_data->drawing->width-x+SAFETY, -1);
9e01e6d4 1192
1193 if(drawing->damage_begin == drawing->damage_end)
67f72973 1194 drawing->damage_begin = resourceview_data->drawing->width-x;
9e01e6d4 1195 else
1196 drawing->damage_begin = 0;
1197
67f72973 1198 drawing->damage_end = resourceview_data->drawing->width;
9e01e6d4 1199
1200 /* Clear the data request background, but not SAFETY */
1201 rectangle_pixmap(process_list,
67f72973 1202 resourceview_data->drawing->drawing_area->style->black_gc,
9e01e6d4 1203 TRUE,
1204 drawing->damage_begin+SAFETY, 0,
1205 drawing->damage_end - drawing->damage_begin, // do not overlap
1206 -1);
1207 gtk_widget_queue_draw(drawing->drawing_area);
9e01e6d4 1208
1209 /* Get new data for the rest. */
67f72973 1210 drawing_data_request(resourceview_data->drawing,
9e01e6d4 1211 drawing->damage_begin, 0,
1212 drawing->damage_end - drawing->damage_begin,
67f72973 1213 resourceview_data->drawing->height);
9e01e6d4 1214 } else {
9e01e6d4 1215 if(ltt_time_compare(*ns,*os) == -1
1216 && ltt_time_compare(*os,new_end) == -1)
1217 {
1218 g_info("scrolling near left");
1219 /* Scroll left, keep left part of the screen */
1220 guint x = 0;
67f72973 1221 guint width = resourceview_data->drawing->width;
9e01e6d4 1222 convert_time_to_pixels(
1223 *new_time_window,
1224 *os,
1225 width,
1226 &x);
1227
1228 /* Copy old data to new location */
1229 copy_pixmap_region (process_list,
1230 NULL,
67f72973 1231 resourceview_data->drawing->drawing_area->style->black_gc,
9e01e6d4 1232 NULL,
1233 0, 0,
1234 x, 0,
1235 -1, -1);
1236
1237 if(drawing->damage_begin == drawing->damage_end)
1238 drawing->damage_end = x;
1239 else
1240 drawing->damage_end =
67f72973 1241 resourceview_data->drawing->width;
9e01e6d4 1242
1243 drawing->damage_begin = 0;
1244
1245 rectangle_pixmap (process_list,
67f72973 1246 resourceview_data->drawing->drawing_area->style->black_gc,
9e01e6d4 1247 TRUE,
1248 drawing->damage_begin, 0,
1249 drawing->damage_end - drawing->damage_begin, // do not overlap
1250 -1);
1251
1252 gtk_widget_queue_draw(drawing->drawing_area);
9e01e6d4 1253
1254 /* Get new data for the rest. */
67f72973 1255 drawing_data_request(resourceview_data->drawing,
9e01e6d4 1256 drawing->damage_begin, 0,
1257 drawing->damage_end - drawing->damage_begin,
67f72973 1258 resourceview_data->drawing->height);
9e01e6d4 1259
1260 } else {
1261 if(ltt_time_compare(*ns,*os) == 0)
1262 {
1263 g_info("not scrolling");
1264 } else {
1265 g_info("scrolling far");
1266 /* Cannot reuse any part of the screen : far jump */
1267
1268
1269 rectangle_pixmap (process_list,
67f72973 1270 resourceview_data->drawing->drawing_area->style->black_gc,
9e01e6d4 1271 TRUE,
1272 0, 0,
67f72973 1273 resourceview_data->drawing->width+SAFETY, // do not overlap
9e01e6d4 1274 -1);
1275
9e01e6d4 1276 gtk_widget_queue_draw(drawing->drawing_area);
1277
1278 drawing->damage_begin = 0;
67f72973 1279 drawing->damage_end = resourceview_data->drawing->width;
9e01e6d4 1280
67f72973 1281 drawing_data_request(resourceview_data->drawing,
9e01e6d4 1282 0, 0,
67f72973 1283 resourceview_data->drawing->width,
1284 resourceview_data->drawing->height);
9e01e6d4 1285
1286 }
1287 }
1288 }
1289 } else {
1290 /* Different scale (zoom) */
1291 g_info("zoom");
1292
1293 rectangle_pixmap (process_list,
67f72973 1294 resourceview_data->drawing->drawing_area->style->black_gc,
9e01e6d4 1295 TRUE,
1296 0, 0,
67f72973 1297 resourceview_data->drawing->width+SAFETY, // do not overlap
9e01e6d4 1298 -1);
1299
9e01e6d4 1300 gtk_widget_queue_draw(drawing->drawing_area);
1301
1302 drawing->damage_begin = 0;
67f72973 1303 drawing->damage_end = resourceview_data->drawing->width;
9e01e6d4 1304
67f72973 1305 drawing_data_request(resourceview_data->drawing,
9e01e6d4 1306 0, 0,
67f72973 1307 resourceview_data->drawing->width,
1308 resourceview_data->drawing->height);
9e01e6d4 1309 }
1310
1311 /* Update directly when scrolling */
67f72973 1312 gdk_window_process_updates(resourceview_data->drawing->drawing_area->window,
9e01e6d4 1313 TRUE);
1314
1315 return 0;
1316}
1317
1318gint traceset_notify(void *hook_data, void *call_data)
1319{
67f72973 1320 ControlFlowData *resourceview_data = (ControlFlowData*) hook_data;
1321 Drawing_t *drawing = resourceview_data->drawing;
9e01e6d4 1322
1323 if(unlikely(drawing->gc == NULL)) {
1324 return FALSE;
1325 }
1326 if(drawing->dotted_gc == NULL) {
1327 return FALSE;
1328 }
1329
67f72973 1330 drawing_clear(resourceview_data->drawing);
1331 processlist_clear(resourceview_data->process_list);
9e01e6d4 1332 gtk_widget_set_size_request(
67f72973 1333 resourceview_data->drawing->drawing_area,
1334 -1, processlist_get_height(resourceview_data->process_list));
1335 redraw_notify(resourceview_data, NULL);
9e01e6d4 1336
67f72973 1337 request_background_data(resourceview_data);
9e01e6d4 1338
1339 return FALSE;
1340}
1341
1342gint redraw_notify(void *hook_data, void *call_data)
1343{
67f72973 1344 ControlFlowData *resourceview_data = (ControlFlowData*) hook_data;
1345 Drawing_t *drawing = resourceview_data->drawing;
9e01e6d4 1346 GtkWidget *widget = drawing->drawing_area;
1347
1348 drawing->damage_begin = 0;
1349 drawing->damage_end = drawing->width;
1350
1351 /* fun feature, to be separated someday... */
67f72973 1352 drawing_clear(resourceview_data->drawing);
1353 processlist_clear(resourceview_data->process_list);
9e01e6d4 1354 gtk_widget_set_size_request(
67f72973 1355 resourceview_data->drawing->drawing_area,
1356 -1, processlist_get_height(resourceview_data->process_list));
9e01e6d4 1357 // Clear the images
67f72973 1358 rectangle_pixmap (resourceview_data->process_list,
9e01e6d4 1359 widget->style->black_gc,
1360 TRUE,
1361 0, 0,
1362 drawing->alloc_width,
1363 -1);
1364
1365 gtk_widget_queue_draw(drawing->drawing_area);
1366
1367 if(drawing->damage_begin < drawing->damage_end)
1368 {
1369 drawing_data_request(drawing,
1370 drawing->damage_begin,
1371 0,
1372 drawing->damage_end-drawing->damage_begin,
1373 drawing->height);
1374 }
1375
9e01e6d4 1376 return FALSE;
1377
1378}
1379
1380
1381gint continue_notify(void *hook_data, void *call_data)
1382{
67f72973 1383 ControlFlowData *resourceview_data = (ControlFlowData*) hook_data;
1384 Drawing_t *drawing = resourceview_data->drawing;
9e01e6d4 1385
1386 if(drawing->damage_begin < drawing->damage_end)
1387 {
1388 drawing_data_request(drawing,
1389 drawing->damage_begin,
1390 0,
1391 drawing->damage_end-drawing->damage_begin,
1392 drawing->height);
1393 }
1394
1395 return FALSE;
1396}
1397
1398
1399gint update_current_time_hook(void *hook_data, void *call_data)
1400{
67f72973 1401 ControlFlowData *resourceview_data = (ControlFlowData*)hook_data;
1402 Drawing_t *drawing = resourceview_data->drawing;
9e01e6d4 1403
1404 LttTime current_time = *((LttTime*)call_data);
1405
1406 TimeWindow time_window =
67f72973 1407 lttvwindow_get_time_window(resourceview_data->tab);
9e01e6d4 1408
1409 LttTime time_begin = time_window.start_time;
1410 LttTime width = time_window.time_width;
1411 LttTime half_width;
1412 {
1413 guint64 time_ll = ltt_time_to_uint64(width);
1414 time_ll = time_ll >> 1; /* divide by two */
1415 half_width = ltt_time_from_uint64(time_ll);
1416 }
1417 LttTime time_end = ltt_time_add(time_begin, width);
1418
1419 LttvTracesetContext * tsc =
67f72973 1420 lttvwindow_get_traceset_context(resourceview_data->tab);
9e01e6d4 1421
1422 LttTime trace_start = tsc->time_span.start_time;
1423 LttTime trace_end = tsc->time_span.end_time;
1424
1425 g_info("New current time HOOK : %lu, %lu", current_time.tv_sec,
1426 current_time.tv_nsec);
9e01e6d4 1427
1428 /* If current time is inside time interval, just move the highlight
1429 * bar */
1430
1431 /* Else, we have to change the time interval. We have to tell it
1432 * to the main window. */
1433 /* The time interval change will take care of placing the current
1434 * time at the center of the visible area, or nearest possible if we are
1435 * at one end of the trace. */
1436
1437
1438 if(ltt_time_compare(current_time, time_begin) < 0)
1439 {
1440 TimeWindow new_time_window;
1441
1442 if(ltt_time_compare(current_time,
1443 ltt_time_add(trace_start,half_width)) < 0)
1444 time_begin = trace_start;
1445 else
1446 time_begin = ltt_time_sub(current_time,half_width);
1447
1448 new_time_window.start_time = time_begin;
1449 new_time_window.time_width = width;
1450 new_time_window.time_width_double = ltt_time_to_double(width);
1451 new_time_window.end_time = ltt_time_add(time_begin, width);
1452
67f72973 1453 lttvwindow_report_time_window(resourceview_data->tab, new_time_window);
9e01e6d4 1454 }
1455 else if(ltt_time_compare(current_time, time_end) > 0)
1456 {
1457 TimeWindow new_time_window;
1458
1459 if(ltt_time_compare(current_time, ltt_time_sub(trace_end, half_width)) > 0)
1460 time_begin = ltt_time_sub(trace_end,width);
1461 else
1462 time_begin = ltt_time_sub(current_time,half_width);
1463
1464 new_time_window.start_time = time_begin;
1465 new_time_window.time_width = width;
1466 new_time_window.time_width_double = ltt_time_to_double(width);
1467 new_time_window.end_time = ltt_time_add(time_begin, width);
1468
67f72973 1469 lttvwindow_report_time_window(resourceview_data->tab, new_time_window);
9e01e6d4 1470
1471 }
67f72973 1472 gtk_widget_queue_draw(resourceview_data->drawing->drawing_area);
9e01e6d4 1473
1474 /* Update directly when scrolling */
67f72973 1475 gdk_window_process_updates(resourceview_data->drawing->drawing_area->window,
9e01e6d4 1476 TRUE);
1477
1478 return 0;
1479}
1480
1481typedef struct _ClosureData {
1482 EventsRequest *events_request;
1483 LttvTracesetState *tss;
1484 LttTime end_time;
1485 guint x_end;
1486} ClosureData;
1487
58a9b31b 1488/* Draw line until end of the screen */
9e01e6d4 1489
1490void draw_closure(gpointer key, gpointer value, gpointer user_data)
1491{
67f72973 1492 ResourceUniqueNumeric *process_info = (ResourceUniqueNumeric*)key;
44ffb95f 1493 HashedResourceData *hashed_process_data = (HashedResourceData*)value;
1494 ClosureData *closure_data = (ClosureData*)user_data;
1495
1496 EventsRequest *events_request = closure_data->events_request;
67f72973 1497 ControlFlowData *resourceview_data = events_request->viewer_data;
44ffb95f 1498
1499 LttvTracesetState *tss = closure_data->tss;
1500 LttvTracesetContext *tsc = (LttvTracesetContext*)tss;
1501
1502 LttTime evtime = closure_data->end_time;
1503
1504 gboolean dodraw = TRUE;
1505
67f72973 1506 if(hashed_process_data->type == RV_RESOURCE_MACHINE)
1507 return;
1508
44ffb95f 1509 {
1510 /* For the process */
1511 /* First, check if the current process is in the state computation
1512 * process list. If it is there, that means we must add it right now and
1513 * draw items from the beginning of the read for it. If it is not
1514 * present, it's a new process and it was not present : it will
1515 * be added after the state update. */
1516#ifdef EXTRA_CHECK
1517 g_assert(lttv_traceset_number(tsc->ts) > 0);
1518#endif //EXTRA_CHECK
1519 LttvTraceContext *tc = tsc->traces[process_info->trace_num];
1520 LttvTraceState *ts = (LttvTraceState*)tc;
1521
67f72973 1522 /* Only draw for processes that are currently in the trace states */
44ffb95f 1523
67f72973 1524 ProcessList *process_list = resourceview_data->process_list;
44ffb95f 1525#ifdef EXTRA_CHECK
67f72973 1526 /* Should be alike when background info is ready */
1527 if(resourceview_data->background_info_waiting==0)
44ffb95f 1528 g_assert(ltt_time_compare(process->creation_time,
1529 process_info->birth) == 0);
1530#endif //EXTRA_CHECK
1531
67f72973 1532 /* Now, the process is in the state hash and our own process hash.
1533 * We definitely can draw the items related to the ending state.
1534 */
1535
1536 if(unlikely(ltt_time_compare(hashed_process_data->next_good_time,
1537 evtime) <= 0))
1538 {
1539 TimeWindow time_window =
1540 lttvwindow_get_time_window(resourceview_data->tab);
44ffb95f 1541
1542#ifdef EXTRA_CHECK
67f72973 1543 if(ltt_time_compare(evtime, time_window.start_time) == -1
1544 || ltt_time_compare(evtime, time_window.end_time) == 1)
1545 return;
44ffb95f 1546#endif //EXTRA_CHECK
67f72973 1547 Drawing_t *drawing = resourceview_data->drawing;
1548 guint width = drawing->width;
1549
1550 guint x = closure_data->x_end;
1551
1552 DrawContext draw_context;
1553
1554 /* Now create the drawing context that will be used to draw
1555 * items related to the last state. */
1556 draw_context.drawable = hashed_process_data->pixmap;
1557 draw_context.gc = drawing->gc;
1558 draw_context.pango_layout = drawing->pango_layout;
1559 draw_context.drawinfo.end.x = x;
1560
1561 draw_context.drawinfo.y.over = 1;
1562 draw_context.drawinfo.y.middle = (hashed_process_data->height/2);
1563 draw_context.drawinfo.y.under = hashed_process_data->height;
1564
1565 draw_context.drawinfo.start.offset.over = 0;
1566 draw_context.drawinfo.start.offset.middle = 0;
1567 draw_context.drawinfo.start.offset.under = 0;
1568 draw_context.drawinfo.end.offset.over = 0;
1569 draw_context.drawinfo.end.offset.middle = 0;
1570 draw_context.drawinfo.end.offset.under = 0;
44ffb95f 1571#if 0
67f72973 1572 /* Jump over draw if we are at the same x position */
1573 if(x == hashed_process_data->x.over)
1574 {
1575 /* jump */
1576 } else {
1577 draw_context.drawinfo.start.x = hashed_process_data->x.over;
1578 /* Draw the line */
1579 PropertiesLine prop_line = prepare_execmode_line(process);
1580 draw_line((void*)&prop_line, (void*)&draw_context);
44ffb95f 1581
67f72973 1582 hashed_process_data->x.over = x;
1583 }
44ffb95f 1584#endif //0
1585
67f72973 1586 if(unlikely(x == hashed_process_data->x.middle &&
1587 hashed_process_data->x.middle_used)) {
44ffb95f 1588#if 0 /* do not mark closure : not missing information */
67f72973 1589 if(hashed_process_data->x.middle_marked == FALSE) {
1590 /* Draw collision indicator */
1591 gdk_gc_set_foreground(drawing->gc, &drawing_colors[COL_WHITE]);
1592 gdk_draw_point(drawing->pixmap,
1593 drawing->gc,
1594 x,
1595 y+(height/2)-3);
1596 hashed_process_data->x.middle_marked = TRUE;
1597 }
44ffb95f 1598#endif //0
67f72973 1599 /* Jump */
1600 } else {
1601 draw_context.drawinfo.start.x = hashed_process_data->x.middle;
1602 /* Draw the line */
1603 if(dodraw) {
1604 PropertiesLine prop_line;
1605 prop_line.line_width = STATE_LINE_WIDTH;
1606 prop_line.style = GDK_LINE_SOLID;
1607 prop_line.y = MIDDLE;
1608 if(hashed_process_data->type == RV_RESOURCE_CPU)
1609 cpu_set_line_color(&prop_line, &ts->cpu_states[process_info->id]);
1610 else if(hashed_process_data->type == RV_RESOURCE_IRQ)
1611 irq_set_line_color(&prop_line, &ts->irq_states[process_info->id]);
1612 else if(hashed_process_data->type == RV_RESOURCE_BDEV) {
1613 gint devcode_gint = process_info->id;
1614 LttvBdevState *bdev = g_hash_table_lookup(ts->bdev_states, &devcode_gint);
1615 // the lookup may return null; bdev_set_line_color must act appropriately
1616 bdev_set_line_color(&prop_line, bdev);
44ffb95f 1617 }
67f72973 1618
1619 draw_line((void*)&prop_line, (void*)&draw_context);
1620 }
44ffb95f 1621
67f72973 1622 /* become the last x position */
1623 if(likely(x != hashed_process_data->x.middle)) {
1624 hashed_process_data->x.middle = x;
1625 /* but don't use the pixel */
1626 hashed_process_data->x.middle_used = FALSE;
44ffb95f 1627
67f72973 1628 /* Calculate the next good time */
1629 convert_pixels_to_time(width, x+1, time_window,
1630 &hashed_process_data->next_good_time);
44ffb95f 1631 }
1632 }
67f72973 1633 }
44ffb95f 1634 }
9e01e6d4 1635}
1636
1637int before_chunk(void *hook_data, void *call_data)
1638{
1639 EventsRequest *events_request = (EventsRequest*)hook_data;
1640 LttvTracesetState *tss = (LttvTracesetState*)call_data;
1641 ControlFlowData *cfd = (ControlFlowData*)events_request->viewer_data;
1642#if 0
67f72973 1643 /* Deactivate sort */
9e01e6d4 1644 gtk_tree_sortable_set_sort_column_id(
1645 GTK_TREE_SORTABLE(cfd->process_list->list_store),
1646 TRACE_COLUMN,
1647 GTK_SORT_ASCENDING);
1648#endif //0
1649 drawing_chunk_begin(events_request, tss);
1650
1651 return 0;
1652}
1653
1654int before_request(void *hook_data, void *call_data)
1655{
1656 EventsRequest *events_request = (EventsRequest*)hook_data;
1657 LttvTracesetState *tss = (LttvTracesetState*)call_data;
1658
1659 drawing_data_request_begin(events_request, tss);
1660
1661 return 0;
1662}
1663
1664
1665/*
1666 * after request is necessary in addition of after chunk in order to draw
1667 * lines until the end of the screen. after chunk just draws lines until
1668 * the last event.
1669 *
1670 * for each process
1671 * draw closing line
1672 * expose
1673 */
1674int after_request(void *hook_data, void *call_data)
1675{
67f72973 1676 guint i;
1677 EventsRequest *events_request = (EventsRequest*)hook_data;
1678 ControlFlowData *resourceview_data = events_request->viewer_data;
1679 LttvTracesetState *tss = (LttvTracesetState*)call_data;
1680
1681 ProcessList *process_list = resourceview_data->process_list;
1682 LttTime end_time = events_request->end_time;
1683
1684 ClosureData closure_data;
1685 closure_data.events_request = (EventsRequest*)hook_data;
1686 closure_data.tss = tss;
1687 closure_data.end_time = end_time;
1688
1689 TimeWindow time_window =
1690 lttvwindow_get_time_window(resourceview_data->tab);
1691 guint width = resourceview_data->drawing->width;
1692 convert_time_to_pixels(
1693 time_window,
1694 end_time,
1695 width,
1696 &closure_data.x_end);
1697
1698
1699 /* Draw last items */
1700 for(i=0; i<RV_RESOURCE_COUNT; i++) {
1701 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data, i), draw_closure,
1702 (void*)&closure_data);
1703 }
1704
1705 /* Request expose */
1706 drawing_request_expose(events_request, tss, end_time);
9e01e6d4 1707 return 0;
1708}
1709
1710/*
1711 * for each process
1712 * draw closing line
1713 * expose
1714 */
1715int after_chunk(void *hook_data, void *call_data)
1716{
1717 EventsRequest *events_request = (EventsRequest*)hook_data;
67f72973 1718 ControlFlowData *resourceview_data = events_request->viewer_data;
9e01e6d4 1719 LttvTracesetState *tss = (LttvTracesetState*)call_data;
1720 LttvTracesetContext *tsc = (LttvTracesetContext*)call_data;
1721 LttvTracefileContext *tfc = lttv_traceset_context_get_current_tfc(tsc);
1722 LttTime end_time;
1723
67f72973 1724 ProcessList *process_list = resourceview_data->process_list;
9e01e6d4 1725 guint i;
1726 LttvTraceset *traceset = tsc->ts;
1727 guint nb_trace = lttv_traceset_number(traceset);
1728
1729 /* Only execute when called for the first trace's events request */
1730 if(!process_list->current_hash_data) return;
1731
1732 for(i = 0 ; i < nb_trace ; i++) {
1733 g_free(process_list->current_hash_data[i]);
1734 }
1735 g_free(process_list->current_hash_data);
1736 process_list->current_hash_data = NULL;
1737
1738 if(tfc != NULL)
1739 end_time = LTT_TIME_MIN(tfc->timestamp, events_request->end_time);
1740 else /* end of traceset, or position now out of request : end */
1741 end_time = events_request->end_time;
1742
1743 ClosureData closure_data;
1744 closure_data.events_request = (EventsRequest*)hook_data;
1745 closure_data.tss = tss;
1746 closure_data.end_time = end_time;
1747
1748 TimeWindow time_window =
67f72973 1749 lttvwindow_get_time_window(resourceview_data->tab);
1750 guint width = resourceview_data->drawing->width;
9e01e6d4 1751 convert_time_to_pixels(
1752 time_window,
1753 end_time,
1754 width,
1755 &closure_data.x_end);
1756
1757 /* Draw last items */
67f72973 1758 for(i=0; i<RV_RESOURCE_COUNT; i++) {
1759 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data, i), draw_closure,
9e01e6d4 1760 (void*)&closure_data);
67f72973 1761 }
9e01e6d4 1762#if 0
1763 /* Reactivate sort */
1764 gtk_tree_sortable_set_sort_column_id(
67f72973 1765 GTK_TREE_SORTABLE(resourceview_data->process_list->list_store),
9e01e6d4 1766 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
1767 GTK_SORT_ASCENDING);
1768
67f72973 1769 update_index_to_pixmap(resourceview_data->process_list);
9e01e6d4 1770 /* Request a full expose : drawing scrambled */
67f72973 1771 gtk_widget_queue_draw(resourceview_data->drawing->drawing_area);
9e01e6d4 1772#endif //0
1773 /* Request expose (updates damages zone also) */
1774 drawing_request_expose(events_request, tss, end_time);
1775
1776 return 0;
1777}
1778
1779/* after_statedump_end
1780 *
1781 * @param hook_data ControlFlowData structure of the viewer.
1782 * @param call_data Event context.
1783 *
1784 * This function adds items to be drawn in a queue for each process.
1785 *
1786 */
1787int before_statedump_end(void *hook_data, void *call_data)
1788{
67f72973 1789 gint i;
1790
dd455fb8 1791 LttvTraceHook *th = (LttvTraceHook*)hook_data;
1792 EventsRequest *events_request = (EventsRequest*)th->hook_data;
67f72973 1793 ControlFlowData *resourceview_data = events_request->viewer_data;
9e01e6d4 1794
1795 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
1796
1797 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
1798
1799 LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
1800
1801 LttvTracesetState *tss = (LttvTracesetState*)tfc->t_context->ts_context;
67f72973 1802 ProcessList *process_list = resourceview_data->process_list;
9e01e6d4 1803
1804 LttEvent *e;
1805 e = ltt_tracefile_get_event(tfc->tf);
1806
67f72973 1807 LttvFilter *filter = resourceview_data->filter;
9e01e6d4 1808 if(filter != NULL && filter->head != NULL)
1809 if(!lttv_filter_tree_parse(filter->head,e,tfc->tf,
1810 tfc->t_context->t,tfc,NULL,NULL))
1811 return FALSE;
1812
1813 LttTime evtime = ltt_event_time(e);
1814
1815 ClosureData closure_data;
1816 closure_data.events_request = events_request;
1817 closure_data.tss = tss;
1818 closure_data.end_time = evtime;
1819
1820 TimeWindow time_window =
67f72973 1821 lttvwindow_get_time_window(resourceview_data->tab);
1822 guint width = resourceview_data->drawing->width;
9e01e6d4 1823 convert_time_to_pixels(
1824 time_window,
1825 evtime,
1826 width,
1827 &closure_data.x_end);
1828
1829 /* Draw last items */
67f72973 1830
1831 for(i=0; i<RV_RESOURCE_COUNT; i++) {
1832 g_hash_table_foreach(resourcelist_get_resource_hash_table(resourceview_data, i), draw_closure,
9e01e6d4 1833 (void*)&closure_data);
67f72973 1834 }
9e01e6d4 1835#if 0
1836 /* Reactivate sort */
1837 gtk_tree_sortable_set_sort_column_id(
67f72973 1838 GTK_TREE_SORTABLE(resourceview_data->process_list->list_store),
9e01e6d4 1839 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
1840 GTK_SORT_ASCENDING);
1841
67f72973 1842 update_index_to_pixmap(resourceview_data->process_list);
9e01e6d4 1843 /* Request a full expose : drawing scrambled */
67f72973 1844 gtk_widget_queue_draw(resourceview_data->drawing->drawing_area);
9e01e6d4 1845#endif //0
1846 /* Request expose (updates damages zone also) */
1847 drawing_request_expose(events_request, tss, evtime);
1848
1849 return 0;
1850}
This page took 0.111753 seconds and 4 git commands to generate.