update compat
[lttv.git] / tags / LinuxTraceToolkitViewer-0.10.0-pre-115102007 / lttv / modules / gui / resourceview / processlist.c
CommitLineData
0bc7c2cd 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#ifdef HAVE_CONFIG_H
20#include <config.h>
21#endif
22
23#include <gtk/gtk.h>
24#include <gdk/gdk.h>
25#include <glib.h>
26#include <string.h>
27#include <stdlib.h>
28#include <math.h>
29#
30
31#include "processlist.h"
32#include "drawing.h"
33#include "drawitem.h"
34
35#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
36//#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
37
38/* Preallocated Size of the index_to_pixmap array */
39#define ALLOCATE_PROCESSES 1000
40
41/*****************************************************************************
42 * Methods to synchronize process list *
43 *****************************************************************************/
44
45
46gint resource_sort_func ( GtkTreeModel *model,
47 GtkTreeIter *it_a,
48 GtkTreeIter *it_b,
49 gpointer user_data)
50{
51 gchar *a_name;
52 gchar *b_name;
53
54 gtk_tree_model_get(model, it_a, NAME_COLUMN, &a_name, -1);
55
56 gtk_tree_model_get(model, it_b, NAME_COLUMN, &b_name, -1);
57
58 return strcmp(a_name, b_name);
59}
60
61//static guint process_list_hash_fct(gconstpointer key)
62//{
63// guint pid = ((const ResourceInfo*)key)->pid;
64// return ((pid>>8 ^ pid>>4 ^ pid>>2 ^ pid) ^ ((const ResourceInfo*)key)->cpu);
65//}
66//
67///* If hash is good, should be different */
68//static gboolean process_list_equ_fct(gconstpointer a, gconstpointer b)
69//{
70// const ResourceInfo *pa = (const ResourceInfo*)a;
71// const ResourceInfo *pb = (const ResourceInfo*)b;
72//
73// gboolean ret = TRUE;
74//
75// if(likely(pa->pid != pb->pid))
76// ret = FALSE;
77// if(likely((pa->pid == 0 && (pa->cpu != pb->cpu))))
78// ret = FALSE;
79// if(unlikely(ltt_time_compare(pa->birth, pb->birth) != 0))
80// ret = FALSE;
81// if(unlikely(pa->trace_num != pb->trace_num))
82// ret = FALSE;
83//
84// return ret;
85//}
86
87static guint resource_list_hash_fct(gconstpointer key)
88{
89 gchar *name = g_quark_to_string(((const ResourceInfo*)key)->name);
90 return g_str_hash(name);
91}
92
93static gboolean resource_list_equ_fct(gconstpointer a, gconstpointer b)
94{
95 const ResourceInfo *pa = (const ResourceInfo*)a;
96 const ResourceInfo *pb = (const ResourceInfo*)b;
97
98 gboolean ret = TRUE;
99
100 /* TODO pmf: add some else's here to make it faster */
101 /* TODO pmf: this is highly inefficient */
102
103 if(likely(strcmp(g_quark_to_string(pa->name), g_quark_to_string(pb->name)) != 0))
104 ret = FALSE;
105 if(unlikely(pa->trace_num != pb->trace_num))
106 ret = FALSE;
107
108 return ret;
109}
110
111void destroy_hash_key(gpointer key);
112
113void destroy_hash_data(gpointer data);
114
115
116gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data)
117{
118 ControlFlowData *control_flow_data =
119 (ControlFlowData*)g_object_get_data(
120 G_OBJECT(widget),
121 "control_flow_data");
122 Drawing_t *drawing = control_flow_data->drawing;
123 unsigned int cell_height =
124 get_cell_height(GTK_TREE_VIEW(control_flow_data->process_list->process_list_widget));
125
126 switch(event->direction) {
127 case GDK_SCROLL_UP:
128 gtk_adjustment_set_value(control_flow_data->v_adjust,
129 gtk_adjustment_get_value(control_flow_data->v_adjust) - cell_height);
130 break;
131 case GDK_SCROLL_DOWN:
132 gtk_adjustment_set_value(control_flow_data->v_adjust,
133 gtk_adjustment_get_value(control_flow_data->v_adjust) + cell_height);
134 break;
135 default:
136 g_error("should only scroll up and down.");
137 }
138 return TRUE;
139}
140
141
142static void update_index_to_pixmap_each(ResourceInfo *key,
143 HashedResourceData *value,
144 ProcessList *process_list)
145{
146 guint array_index = processlist_get_index_from_data(process_list, value);
147
148 g_assert(array_index < process_list->index_to_pixmap->len);
149
150 GdkPixmap **pixmap =
151 (GdkPixmap**)&g_ptr_array_index(process_list->index_to_pixmap, array_index);
152
153 *pixmap = value->pixmap;
154}
155
156
157void update_index_to_pixmap(ProcessList *process_list)
158{
159 g_ptr_array_set_size(process_list->index_to_pixmap,
160 g_hash_table_size(process_list->process_hash));
161 g_hash_table_foreach(process_list->process_hash,
162 (GHFunc)update_index_to_pixmap_each,
163 process_list);
164}
165
166
167static void update_pixmap_size_each(ResourceInfo *key,
168 HashedResourceData *value,
169 guint width)
170{
171 GdkPixmap *old_pixmap = value->pixmap;
172
173 value->pixmap =
174 gdk_pixmap_new(old_pixmap,
175 width,
176 value->height,
177 -1);
178
179 gdk_pixmap_unref(old_pixmap);
180}
181
182
183void update_pixmap_size(ProcessList *process_list, guint width)
184{
185 g_hash_table_foreach(process_list->process_hash,
186 (GHFunc)update_pixmap_size_each,
187 (gpointer)width);
188}
189
190
191typedef struct _CopyPixmap {
192 GdkDrawable *dest;
193 GdkGC *gc;
194 GdkDrawable *src;
195 gint xsrc, ysrc, xdest, ydest, width, height;
196} CopyPixmap;
197
198static void copy_pixmap_region_each(ResourceInfo *key,
199 HashedResourceData *value,
200 CopyPixmap *cp)
201{
202 GdkPixmap *src = cp->src;
203 GdkPixmap *dest = cp->dest;
204
205 if(dest == NULL)
206 dest = value->pixmap;
207 if(src == NULL)
208 src = value->pixmap;
209
210 gdk_draw_drawable (dest,
211 cp->gc,
212 src,
213 cp->xsrc, cp->ysrc,
214 cp->xdest, cp->ydest,
215 cp->width, cp->height);
216}
217
218void copy_pixmap_region(ProcessList *process_list, GdkDrawable *dest,
219 GdkGC *gc, GdkDrawable *src,
220 gint xsrc, gint ysrc,
221 gint xdest, gint ydest, gint width, gint height)
222{
223 CopyPixmap cp = { dest, gc, src, xsrc, ysrc, xdest, ydest, width, height };
224
225 g_hash_table_foreach(process_list->process_hash,
226 (GHFunc)copy_pixmap_region_each,
227 &cp);
228}
229
230
231
232typedef struct _RectanglePixmap {
233 gboolean filled;
234 gint x, y, width, height;
235 GdkGC *gc;
236} RectanglePixmap;
237
238static void rectangle_pixmap_each(ResourceInfo *key,
239 HashedResourceData *value,
240 RectanglePixmap *rp)
241{
242 if(rp->height == -1)
243 rp->height = value->height;
244
245 gdk_draw_rectangle (value->pixmap,
246 rp->gc,
247 rp->filled,
248 rp->x, rp->y,
249 rp->width, rp->height);
250}
251
252
253
254
255void rectangle_pixmap(ProcessList *process_list, GdkGC *gc,
256 gboolean filled, gint x, gint y, gint width, gint height)
257{
258 RectanglePixmap rp = { filled, x, y, width, height, gc };
259
260 g_hash_table_foreach(process_list->process_hash,
261 (GHFunc)rectangle_pixmap_each,
262 &rp);
263}
264
265
266/* Renders each pixmaps into on big drawable */
267void copy_pixmap_to_screen(ProcessList *process_list,
268 GdkDrawable *dest,
269 GdkGC *gc,
270 gint x, gint y,
271 gint width, gint height)
272{
273 if(process_list->index_to_pixmap->len == 0) return;
274 guint cell_height = process_list->cell_height;
275
276 /* Get indexes */
277 gint begin = floor(y/(double)cell_height);
278 gint end = MIN(ceil((y+height)/(double)cell_height),
279 process_list->index_to_pixmap->len);
280 gint i;
281
282 for(i=begin; i<end; i++) {
283 g_assert(i<process_list->index_to_pixmap->len);
284 /* Render the pixmap to the screen */
285 GdkPixmap *pixmap =
286 //(GdkPixmap*)g_ptr_array_index(process_list->index_to_pixmap, i);
287 GDK_PIXMAP(g_ptr_array_index(process_list->index_to_pixmap, i));
288
289 gdk_draw_drawable (dest,
290 gc,
291 pixmap,
292 x, 0,
293 x, i*cell_height,
294 width, cell_height);
295
296 }
297}
298
299ProcessList *processlist_construct(void)
300{
301 GtkTreeViewColumn *column;
302 GtkCellRenderer *renderer;
303
304 ProcessList* process_list = g_new(ProcessList,1);
305
306 process_list->number_of_process = 0;
307
308 process_list->current_hash_data = NULL;
309
310 /* Create the Process list */
311 process_list->list_store = gtk_list_store_new ( N_COLUMNS,
312 G_TYPE_STRING,
313 G_TYPE_STRING,
314 G_TYPE_UINT,
315 G_TYPE_UINT,
316 G_TYPE_UINT,
317 G_TYPE_UINT,
318 G_TYPE_ULONG,
319 G_TYPE_ULONG,
320 G_TYPE_UINT);
321
322
323 process_list->process_list_widget =
324 gtk_tree_view_new_with_model
325 (GTK_TREE_MODEL (process_list->list_store));
326
327 g_object_unref (G_OBJECT (process_list->list_store));
328
329 gtk_tree_sortable_set_default_sort_func(
330 GTK_TREE_SORTABLE(process_list->list_store),
331 resource_sort_func,
332 NULL,
333 NULL);
334
335
336 gtk_tree_sortable_set_sort_column_id(
337 GTK_TREE_SORTABLE(process_list->list_store),
338 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
339 GTK_SORT_ASCENDING);
340
341
342 process_list->process_hash = g_hash_table_new_full(
343 resource_list_hash_fct, resource_list_equ_fct,
344 destroy_hash_key, destroy_hash_data
345 );
346
347
348 gtk_tree_view_set_headers_visible(
349 GTK_TREE_VIEW(process_list->process_list_widget), TRUE);
350
351 /* Create a column, associating the "text" attribute of the
352 * cell_renderer to the first column of the model */
353 /* Columns alignment : 0.0 : Left 0.5 : Center 1.0 : Right */
354 renderer = gtk_cell_renderer_text_new ();
355 process_list->renderer = renderer;
356
357 gint vertical_separator;
358 gtk_widget_style_get (GTK_WIDGET (process_list->process_list_widget),
359 "vertical-separator", &vertical_separator,
360 NULL);
361 gtk_cell_renderer_get_size(renderer,
362 GTK_WIDGET(process_list->process_list_widget),
363 NULL,
364 NULL,
365 NULL,
366 NULL,
367 &process_list->cell_height);
368
369#if GTK_CHECK_VERSION(2,4,15)
370 guint ypad;
371 g_object_get(G_OBJECT(renderer), "ypad", &ypad, NULL);
372
373 process_list->cell_height += ypad;
374#endif
375 process_list->cell_height += vertical_separator;
376
377
378 column = gtk_tree_view_column_new_with_attributes ( "Resource",
379 renderer,
380 "text",
381 NAME_COLUMN,
382 NULL);
383 gtk_tree_view_column_set_alignment (column, 0.0);
384 gtk_tree_view_column_set_fixed_width (column, 45);
385 gtk_tree_view_append_column (
386 GTK_TREE_VIEW (process_list->process_list_widget), column);
387
388 process_list->button = column->button;
389
390// column = gtk_tree_view_column_new_with_attributes ( "Brand",
391// renderer,
392// "text",
393// BRAND_COLUMN,
394// NULL);
395// gtk_tree_view_column_set_alignment (column, 0.0);
396// gtk_tree_view_column_set_fixed_width (column, 45);
397// gtk_tree_view_append_column (
398// GTK_TREE_VIEW (process_list->process_list_widget), column);
399//
400// column = gtk_tree_view_column_new_with_attributes ( "PID",
401// renderer,
402// "text",
403// PID_COLUMN,
404// NULL);
405// gtk_tree_view_append_column (
406// GTK_TREE_VIEW (process_list->process_list_widget), column);
407//
408// column = gtk_tree_view_column_new_with_attributes ( "TGID",
409// renderer,
410// "text",
411// TGID_COLUMN,
412// NULL);
413// gtk_tree_view_append_column (
414// GTK_TREE_VIEW (process_list->process_list_widget), column);
415//
416// column = gtk_tree_view_column_new_with_attributes ( "PPID",
417// renderer,
418// "text",
419// PPID_COLUMN,
420// NULL);
421// gtk_tree_view_append_column (
422// GTK_TREE_VIEW (process_list->process_list_widget), column);
423//
424// column = gtk_tree_view_column_new_with_attributes ( "CPU",
425// renderer,
426// "text",
427// CPU_COLUMN,
428// NULL);
429// gtk_tree_view_append_column (
430// GTK_TREE_VIEW (process_list->process_list_widget), column);
431//
432// column = gtk_tree_view_column_new_with_attributes ( "Birth sec",
433// renderer,
434// "text",
435// BIRTH_S_COLUMN,
436// NULL);
437// gtk_tree_view_append_column (
438// GTK_TREE_VIEW (process_list->process_list_widget), column);
439//
440// //gtk_tree_view_column_set_visible(column, 0);
441// //
442// column = gtk_tree_view_column_new_with_attributes ( "Birth nsec",
443// renderer,
444// "text",
445// BIRTH_NS_COLUMN,
446// NULL);
447// gtk_tree_view_append_column (
448// GTK_TREE_VIEW (process_list->process_list_widget), column);
449//
450// column = gtk_tree_view_column_new_with_attributes ( "TRACE",
451// renderer,
452// "text",
453// TRACE_COLUMN,
454// NULL);
455// gtk_tree_view_append_column (
456// GTK_TREE_VIEW (process_list->process_list_widget), column);
457
458
459 //gtk_tree_view_column_set_visible(column, 0);
460
461 g_object_set_data_full(
462 G_OBJECT(process_list->process_list_widget),
463 "process_list_Data",
464 process_list,
465 (GDestroyNotify)processlist_destroy);
466
467 process_list->index_to_pixmap = g_ptr_array_sized_new(ALLOCATE_PROCESSES);
468
469 return process_list;
470}
471
472void processlist_destroy(ProcessList *process_list)
473{
474 g_debug("processlist_destroy %p", process_list);
475 g_hash_table_destroy(process_list->process_hash);
476 process_list->process_hash = NULL;
477 g_ptr_array_free(process_list->index_to_pixmap, TRUE);
478
479 g_free(process_list);
480 g_debug("processlist_destroy end");
481}
482
483static gboolean remove_hash_item(ResourceInfo *process_info,
484 HashedResourceData *hashed_process_data,
485 ProcessList *process_list)
486{
487 GtkTreeIter iter;
488
489 iter = hashed_process_data->y_iter;
490
491 gtk_list_store_remove (process_list->list_store, &iter);
492 gdk_pixmap_unref(hashed_process_data->pixmap);
493
494// TODO pmf: check this; might be needed
495// if(likely(process_list->current_hash_data != NULL)) {
496// if(likely(hashed_process_data ==
497// process_list->current_hash_data[process_info->trace_num][process_info->cpu]))
498// process_list->current_hash_data[process_info->trace_num][process_info->cpu] = NULL;
499// }
500 return TRUE; /* remove the element from the hash table */
501}
502
503void processlist_clear(ProcessList *process_list)
504{
505 g_info("processlist_clear %p", process_list);
506
507 g_hash_table_foreach_remove(process_list->process_hash,
508 (GHRFunc)remove_hash_item,
509 (gpointer)process_list);
510 process_list->number_of_process = 0;
511 update_index_to_pixmap(process_list);
512}
513
514
515GtkWidget *processlist_get_widget(ProcessList *process_list)
516{
517 return process_list->process_list_widget;
518}
519
520
521void destroy_hash_key(gpointer key)
522{
523 g_free(key);
524}
525
526void destroy_hash_data(gpointer data)
527{
528 g_free(data);
529}
530
531
532//void processlist_set_name(ProcessList *process_list,
533// GQuark name,
534// HashedResourceData *hashed_process_data)
535//{
536// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
537// PROCESS_COLUMN, g_quark_to_string(name),
538// -1);
539//}
540//
541//void processlist_set_brand(ProcessList *process_list,
542// GQuark brand,
543// HashedResourceData *hashed_process_data)
544//{
545// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
546// BRAND_COLUMN, g_quark_to_string(brand),
547// -1);
548//}
549//
550//void processlist_set_tgid(ProcessList *process_list,
551// guint tgid,
552// HashedResourceData *hashed_process_data)
553//{
554// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
555// TGID_COLUMN, tgid,
556// -1);
557//}
558//
559//void processlist_set_ppid(ProcessList *process_list,
560// guint ppid,
561// HashedResourceData *hashed_process_data)
562//{
563// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
564// PPID_COLUMN, ppid,
565// -1);
566//}
567
568int resourcelist_add( ProcessList *process_list,
569 Drawing_t *drawing,
570 guint trace_num,
571 GQuark name,
572 guint type,
573 guint id,
574 guint *height,
575 ResourceInfo **pm_resource_info,
576 HashedResourceData **pm_hashed_resource_data)
577{
578 ResourceInfo *Resource_Info = g_new(ResourceInfo, 1);
579 HashedResourceData *hashed_resource_data = g_new(HashedResourceData, 1);
580 *pm_hashed_resource_data = hashed_resource_data;
581 *pm_resource_info = Resource_Info;
582
583 Resource_Info->name = name;
584
585// Process_Info->pid = pid;
586// Process_Info->tgid = tgid;
587// if(pid == 0)
588// Process_Info->cpu = cpu;
589// else
590// Process_Info->cpu = 0;
591// Process_Info->ppid = ppid;
592// Process_Info->birth = *birth;
593 Resource_Info->trace_num = trace_num;
594 Resource_Info->type = type;
595 Resource_Info->id = id;
596
597 /* When we create it from before state update, we are sure that the
598 * last event occured before the beginning of the global area.
599 *
600 * If it is created after state update, this value (0) will be
601 * overriden by the new state before anything is drawn.
602 *
603 * There are 3 potential lines for the each process: one in the middle,
604 * one under it and one over it. The {over,middle,under} fields tell us
605 * the x pixel on the pixmap where we are. The _used fields tell us
606 * whether that pixel was used. The _marked field tells us if we marked a
607 * conflict point.
608 */
609 hashed_resource_data->x.over = 0;
610 hashed_resource_data->x.over_used = FALSE;
611 hashed_resource_data->x.over_marked = FALSE;
612 hashed_resource_data->x.middle = 0; // last
613 hashed_resource_data->x.middle_used = FALSE;
614 hashed_resource_data->x.middle_marked = FALSE;
615 hashed_resource_data->x.under = 0;
616 hashed_resource_data->x.under_used = FALSE;
617 hashed_resource_data->x.under_marked = FALSE;
618 hashed_resource_data->next_good_time = ltt_time_zero;
619
620 /* Add a new row to the model */
621 gtk_list_store_append ( process_list->list_store,
622 &hashed_resource_data->y_iter);
623
624 gtk_list_store_set ( process_list->list_store, &hashed_resource_data->y_iter,
625 NAME_COLUMN, g_quark_to_string(name),
626 -1);
627
628 g_hash_table_insert(process_list->process_hash,
629 (gpointer)Resource_Info,
630 (gpointer)hashed_resource_data);
631
632 process_list->number_of_process++; // of resources
633
634 hashed_resource_data->height = process_list->cell_height;
635
636 g_assert(hashed_resource_data->height != 0);
637
638 *height = hashed_resource_data->height * process_list->number_of_process;
639
640 hashed_resource_data->pixmap =
641 gdk_pixmap_new(drawing->drawing_area->window,
642 drawing->alloc_width,
643 hashed_resource_data->height,
644 -1);
645
646 // Clear the image with black background
647 gdk_draw_rectangle (hashed_resource_data->pixmap,
648 drawing->drawing_area->style->black_gc,
649 TRUE,
650 0, 0,
651 drawing->alloc_width,
652 hashed_resource_data->height);
653
654 update_index_to_pixmap(process_list);
655
656 return 0;
657}
658//int processlist_add( ProcessList *process_list,
659// Drawing_t *drawing,
660// guint pid,
661// guint tgid,
662// guint cpu,
663// guint ppid,
664// LttTime *birth,
665// guint trace_num,
666// GQuark name,
667// GQuark brand,
668// guint *height,
669// ResourceInfo **pm_process_info,
670// HashedResourceData **pm_hashed_process_data)
671//{
672// ResourceInfo *Process_Info = g_new(ResourceInfo, 1);
673// HashedResourceData *hashed_process_data = g_new(HashedResourceData, 1);
674// *pm_hashed_process_data = hashed_process_data;
675// *pm_process_info = Process_Info;
676//
677// Process_Info->pid = pid;
678// Process_Info->tgid = tgid;
679// if(pid == 0)
680// Process_Info->cpu = cpu;
681// else
682// Process_Info->cpu = 0;
683// Process_Info->ppid = ppid;
684// Process_Info->birth = *birth;
685// Process_Info->trace_num = trace_num;
686//
687// /* When we create it from before state update, we are sure that the
688// * last event occured before the beginning of the global area.
689// *
690// * If it is created after state update, this value (0) will be
691// * overriden by the new state before anything is drawn.
692// */
693// hashed_process_data->x.over = 0;
694// hashed_process_data->x.over_used = FALSE;
695// hashed_process_data->x.over_marked = FALSE;
696// hashed_process_data->x.middle = 0;
697// hashed_process_data->x.middle_used = FALSE;
698// hashed_process_data->x.middle_marked = FALSE;
699// hashed_process_data->x.under = 0;
700// hashed_process_data->x.under_used = FALSE;
701// hashed_process_data->x.under_marked = FALSE;
702// hashed_process_data->next_good_time = ltt_time_zero;
703//
704// /* Add a new row to the model */
705// gtk_list_store_append ( process_list->list_store,
706// &hashed_process_data->y_iter);
707//
708// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
709// PROCESS_COLUMN, g_quark_to_string(name),
710// BRAND_COLUMN, g_quark_to_string(brand),
711// PID_COLUMN, pid,
712// TGID_COLUMN, tgid,
713// PPID_COLUMN, ppid,
714// CPU_COLUMN, cpu,
715// BIRTH_S_COLUMN, birth->tv_sec,
716// BIRTH_NS_COLUMN, birth->tv_nsec,
717// TRACE_COLUMN, trace_num,
718// -1);
719// //gtk_tree_view_set_model(GTK_TREE_VIEW(process_list->process_list_widget),
720// // GTK_TREE_MODEL(process_list->list_store));
721// //gtk_container_resize_children(GTK_CONTAINER(process_list->process_list_widget));
722//
723// g_hash_table_insert(process_list->process_hash,
724// (gpointer)Process_Info,
725// (gpointer)hashed_process_data);
726//
727// process_list->number_of_process++;
728//
729// hashed_process_data->height = process_list->cell_height;
730//
731// g_assert(hashed_process_data->height != 0);
732//
733// *height = hashed_process_data->height * process_list->number_of_process;
734//
735// hashed_process_data->pixmap =
736// gdk_pixmap_new(drawing->drawing_area->window,
737// drawing->alloc_width,
738// hashed_process_data->height,
739// -1);
740//
741// // Clear the image
742// gdk_draw_rectangle (hashed_process_data->pixmap,
743// drawing->drawing_area->style->black_gc,
744// TRUE,
745// 0, 0,
746// drawing->alloc_width,
747// hashed_process_data->height);
748//
749// update_index_to_pixmap(process_list);
750//
751//
752// return 0;
753//}
754
755// TODO pmf: make this work once again
756//int processlist_remove( ProcessList *process_list,
757// guint pid,
758// guint cpu,
759// LttTime *birth,
760// guint trace_num)
761//{
762// ResourceInfo process_info;
763// HashedResourceData *hashed_process_data;
764// GtkTreeIter iter;
765//
766// process_info.pid = pid;
767// if(pid == 0)
768// process_info.cpu = cpu;
769// else
770// process_info.cpu = 0;
771// process_info.birth = *birth;
772// process_info.trace_num = trace_num;
773//
774//
775// hashed_process_data =
776// (HashedResourceData*)g_hash_table_lookup(
777// process_list->process_hash,
778// &process_info);
779// if(likely(hashed_process_data != NULL))
780// {
781// iter = hashed_process_data->y_iter;
782//
783// gtk_list_store_remove (process_list->list_store, &iter);
784//
785// g_hash_table_remove(process_list->process_hash,
786// &process_info);
787//
788// if(likely(process_list->current_hash_data != NULL)) {
789// if(likely(hashed_process_data == process_list->current_hash_data[trace_num][cpu])) {
790// process_list->current_hash_data[trace_num][cpu] = NULL;
791// }
792// }
793//
794// gdk_pixmap_unref(hashed_process_data->pixmap);
795//
796// update_index_to_pixmap(process_list);
797//
798// process_list->number_of_process--;
799//
800// return 0;
801// } else {
802// return 1;
803// }
804//}
805
806
807#if 0
808static inline guint get_cpu_number_from_name(GQuark name)
809{
810 const gchar *string;
811 char *begin;
812 guint cpu;
813
814 string = g_quark_to_string(name);
815
816 begin = strrchr(string, '/');
817 begin++;
818
819 g_assert(begin != '\0');
820
821 cpu = strtoul(begin, NULL, 10);
822
823 return cpu;
824}
825#endif //0
This page took 0.05606 seconds and 4 git commands to generate.