update compat
[lttv.git] / ltt / branches / poly / lttv / modules / gui / resourceview / processlist.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#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>
58a9b31b 29#
9e01e6d4 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)
58a9b31b 36//#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
9e01e6d4 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
fb93b151 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}
9e01e6d4 60
58a9b31b 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//}
9e01e6d4 86
58a9b31b 87static guint resource_list_hash_fct(gconstpointer key)
9e01e6d4 88{
58a9b31b 89 gchar *name = g_quark_to_string(((const ResourceInfo*)key)->name);
90 return g_str_hash(name);
9e01e6d4 91}
92
58a9b31b 93static gboolean resource_list_equ_fct(gconstpointer a, gconstpointer b)
9e01e6d4 94{
58a9b31b 95 const ResourceInfo *pa = (const ResourceInfo*)a;
96 const ResourceInfo *pb = (const ResourceInfo*)b;
9e01e6d4 97
98 gboolean ret = TRUE;
99
58a9b31b 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))
9e01e6d4 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
58a9b31b 142static void update_index_to_pixmap_each(ResourceInfo *key,
143 HashedResourceData *value,
9e01e6d4 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
58a9b31b 167static void update_pixmap_size_each(ResourceInfo *key,
168 HashedResourceData *value,
9e01e6d4 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
58a9b31b 198static void copy_pixmap_region_each(ResourceInfo *key,
199 HashedResourceData *value,
9e01e6d4 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
9e01e6d4 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
58a9b31b 238static void rectangle_pixmap_each(ResourceInfo *key,
239 HashedResourceData *value,
9e01e6d4 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 }
9e01e6d4 297}
298
9e01e6d4 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 */
a39f4c3c 311 process_list->list_store = gtk_list_store_new ( N_COLUMNS, G_TYPE_STRING);
9e01e6d4 312
313
314 process_list->process_list_widget =
315 gtk_tree_view_new_with_model
316 (GTK_TREE_MODEL (process_list->list_store));
317
318 g_object_unref (G_OBJECT (process_list->list_store));
319
fb93b151 320 gtk_tree_sortable_set_default_sort_func(
321 GTK_TREE_SORTABLE(process_list->list_store),
322 resource_sort_func,
323 NULL,
324 NULL);
325
326
327 gtk_tree_sortable_set_sort_column_id(
328 GTK_TREE_SORTABLE(process_list->list_store),
329 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
330 GTK_SORT_ASCENDING);
9e01e6d4 331
332
333 process_list->process_hash = g_hash_table_new_full(
58a9b31b 334 resource_list_hash_fct, resource_list_equ_fct,
9e01e6d4 335 destroy_hash_key, destroy_hash_data
336 );
337
338
339 gtk_tree_view_set_headers_visible(
340 GTK_TREE_VIEW(process_list->process_list_widget), TRUE);
341
342 /* Create a column, associating the "text" attribute of the
343 * cell_renderer to the first column of the model */
344 /* Columns alignment : 0.0 : Left 0.5 : Center 1.0 : Right */
345 renderer = gtk_cell_renderer_text_new ();
346 process_list->renderer = renderer;
347
348 gint vertical_separator;
349 gtk_widget_style_get (GTK_WIDGET (process_list->process_list_widget),
350 "vertical-separator", &vertical_separator,
351 NULL);
352 gtk_cell_renderer_get_size(renderer,
353 GTK_WIDGET(process_list->process_list_widget),
354 NULL,
355 NULL,
356 NULL,
357 NULL,
358 &process_list->cell_height);
359
360#if GTK_CHECK_VERSION(2,4,15)
361 guint ypad;
362 g_object_get(G_OBJECT(renderer), "ypad", &ypad, NULL);
363
364 process_list->cell_height += ypad;
365#endif
366 process_list->cell_height += vertical_separator;
367
368
c4e6f4dc 369 column = gtk_tree_view_column_new_with_attributes ( "Resource",
9e01e6d4 370 renderer,
371 "text",
58a9b31b 372 NAME_COLUMN,
9e01e6d4 373 NULL);
374 gtk_tree_view_column_set_alignment (column, 0.0);
375 gtk_tree_view_column_set_fixed_width (column, 45);
376 gtk_tree_view_append_column (
377 GTK_TREE_VIEW (process_list->process_list_widget), column);
378
379 process_list->button = column->button;
380
c4e6f4dc 381// column = gtk_tree_view_column_new_with_attributes ( "Brand",
382// renderer,
383// "text",
384// BRAND_COLUMN,
385// NULL);
386// gtk_tree_view_column_set_alignment (column, 0.0);
387// gtk_tree_view_column_set_fixed_width (column, 45);
388// gtk_tree_view_append_column (
389// GTK_TREE_VIEW (process_list->process_list_widget), column);
390//
391// column = gtk_tree_view_column_new_with_attributes ( "PID",
392// renderer,
393// "text",
394// PID_COLUMN,
395// NULL);
396// gtk_tree_view_append_column (
397// GTK_TREE_VIEW (process_list->process_list_widget), column);
398//
399// column = gtk_tree_view_column_new_with_attributes ( "TGID",
400// renderer,
401// "text",
402// TGID_COLUMN,
403// NULL);
404// gtk_tree_view_append_column (
405// GTK_TREE_VIEW (process_list->process_list_widget), column);
406//
407// column = gtk_tree_view_column_new_with_attributes ( "PPID",
408// renderer,
409// "text",
410// PPID_COLUMN,
411// NULL);
412// gtk_tree_view_append_column (
413// GTK_TREE_VIEW (process_list->process_list_widget), column);
414//
415// column = gtk_tree_view_column_new_with_attributes ( "CPU",
416// renderer,
417// "text",
418// CPU_COLUMN,
419// NULL);
420// gtk_tree_view_append_column (
421// GTK_TREE_VIEW (process_list->process_list_widget), column);
422//
423// column = gtk_tree_view_column_new_with_attributes ( "Birth sec",
424// renderer,
425// "text",
426// BIRTH_S_COLUMN,
427// NULL);
428// gtk_tree_view_append_column (
429// GTK_TREE_VIEW (process_list->process_list_widget), column);
430//
431// //gtk_tree_view_column_set_visible(column, 0);
432// //
433// column = gtk_tree_view_column_new_with_attributes ( "Birth nsec",
434// renderer,
435// "text",
436// BIRTH_NS_COLUMN,
437// NULL);
438// gtk_tree_view_append_column (
439// GTK_TREE_VIEW (process_list->process_list_widget), column);
440//
441// column = gtk_tree_view_column_new_with_attributes ( "TRACE",
442// renderer,
443// "text",
444// TRACE_COLUMN,
445// NULL);
446// gtk_tree_view_append_column (
447// GTK_TREE_VIEW (process_list->process_list_widget), column);
9e01e6d4 448
449
450 //gtk_tree_view_column_set_visible(column, 0);
451
452 g_object_set_data_full(
453 G_OBJECT(process_list->process_list_widget),
454 "process_list_Data",
455 process_list,
456 (GDestroyNotify)processlist_destroy);
457
458 process_list->index_to_pixmap = g_ptr_array_sized_new(ALLOCATE_PROCESSES);
459
460 return process_list;
461}
462
463void processlist_destroy(ProcessList *process_list)
464{
465 g_debug("processlist_destroy %p", process_list);
466 g_hash_table_destroy(process_list->process_hash);
467 process_list->process_hash = NULL;
468 g_ptr_array_free(process_list->index_to_pixmap, TRUE);
469
470 g_free(process_list);
471 g_debug("processlist_destroy end");
472}
473
58a9b31b 474static gboolean remove_hash_item(ResourceInfo *process_info,
475 HashedResourceData *hashed_process_data,
9e01e6d4 476 ProcessList *process_list)
477{
478 GtkTreeIter iter;
479
480 iter = hashed_process_data->y_iter;
481
482 gtk_list_store_remove (process_list->list_store, &iter);
483 gdk_pixmap_unref(hashed_process_data->pixmap);
484
58a9b31b 485// TODO pmf: check this; might be needed
486// if(likely(process_list->current_hash_data != NULL)) {
487// if(likely(hashed_process_data ==
488// process_list->current_hash_data[process_info->trace_num][process_info->cpu]))
489// process_list->current_hash_data[process_info->trace_num][process_info->cpu] = NULL;
490// }
9e01e6d4 491 return TRUE; /* remove the element from the hash table */
492}
493
494void processlist_clear(ProcessList *process_list)
495{
496 g_info("processlist_clear %p", process_list);
497
498 g_hash_table_foreach_remove(process_list->process_hash,
499 (GHRFunc)remove_hash_item,
500 (gpointer)process_list);
501 process_list->number_of_process = 0;
502 update_index_to_pixmap(process_list);
503}
504
505
506GtkWidget *processlist_get_widget(ProcessList *process_list)
507{
508 return process_list->process_list_widget;
509}
510
511
512void destroy_hash_key(gpointer key)
513{
514 g_free(key);
515}
516
517void destroy_hash_data(gpointer data)
518{
519 g_free(data);
520}
521
522
58a9b31b 523//void processlist_set_name(ProcessList *process_list,
524// GQuark name,
525// HashedResourceData *hashed_process_data)
526//{
527// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
528// PROCESS_COLUMN, g_quark_to_string(name),
529// -1);
530//}
531//
532//void processlist_set_brand(ProcessList *process_list,
533// GQuark brand,
534// HashedResourceData *hashed_process_data)
535//{
536// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
537// BRAND_COLUMN, g_quark_to_string(brand),
538// -1);
539//}
540//
541//void processlist_set_tgid(ProcessList *process_list,
542// guint tgid,
543// HashedResourceData *hashed_process_data)
544//{
545// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
546// TGID_COLUMN, tgid,
547// -1);
548//}
549//
550//void processlist_set_ppid(ProcessList *process_list,
551// guint ppid,
552// HashedResourceData *hashed_process_data)
553//{
554// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
555// PPID_COLUMN, ppid,
556// -1);
557//}
9e01e6d4 558
c4e6f4dc 559int resourcelist_add( ProcessList *process_list,
9e01e6d4 560 Drawing_t *drawing,
58a9b31b 561 guint trace_num,
9e01e6d4 562 GQuark name,
44ffb95f 563 guint type,
564 guint id,
9e01e6d4 565 guint *height,
58a9b31b 566 ResourceInfo **pm_resource_info,
567 HashedResourceData **pm_hashed_resource_data)
9e01e6d4 568{
58a9b31b 569 ResourceInfo *Resource_Info = g_new(ResourceInfo, 1);
570 HashedResourceData *hashed_resource_data = g_new(HashedResourceData, 1);
c4e6f4dc 571 *pm_hashed_resource_data = hashed_resource_data;
572 *pm_resource_info = Resource_Info;
58a9b31b 573
574 Resource_Info->name = name;
9e01e6d4 575
c4e6f4dc 576// Process_Info->pid = pid;
577// Process_Info->tgid = tgid;
578// if(pid == 0)
579// Process_Info->cpu = cpu;
580// else
581// Process_Info->cpu = 0;
582// Process_Info->ppid = ppid;
583// Process_Info->birth = *birth;
58a9b31b 584 Resource_Info->trace_num = trace_num;
44ffb95f 585 Resource_Info->type = type;
586 Resource_Info->id = id;
9e01e6d4 587
588 /* When we create it from before state update, we are sure that the
589 * last event occured before the beginning of the global area.
590 *
591 * If it is created after state update, this value (0) will be
592 * overriden by the new state before anything is drawn.
c4e6f4dc 593 *
594 * There are 3 potential lines for the each process: one in the middle,
595 * one under it and one over it. The {over,middle,under} fields tell us
596 * the x pixel on the pixmap where we are. The _used fields tell us
597 * whether that pixel was used. The _marked field tells us if we marked a
598 * conflict point.
9e01e6d4 599 */
c4e6f4dc 600 hashed_resource_data->x.over = 0;
601 hashed_resource_data->x.over_used = FALSE;
602 hashed_resource_data->x.over_marked = FALSE;
603 hashed_resource_data->x.middle = 0; // last
604 hashed_resource_data->x.middle_used = FALSE;
605 hashed_resource_data->x.middle_marked = FALSE;
606 hashed_resource_data->x.under = 0;
607 hashed_resource_data->x.under_used = FALSE;
608 hashed_resource_data->x.under_marked = FALSE;
609 hashed_resource_data->next_good_time = ltt_time_zero;
9e01e6d4 610
611 /* Add a new row to the model */
612 gtk_list_store_append ( process_list->list_store,
58a9b31b 613 &hashed_resource_data->y_iter);
9e01e6d4 614
58a9b31b 615 gtk_list_store_set ( process_list->list_store, &hashed_resource_data->y_iter,
616 NAME_COLUMN, g_quark_to_string(name),
9e01e6d4 617 -1);
9e01e6d4 618
619 g_hash_table_insert(process_list->process_hash,
58a9b31b 620 (gpointer)Resource_Info,
621 (gpointer)hashed_resource_data);
9e01e6d4 622
c4e6f4dc 623 process_list->number_of_process++; // of resources
9e01e6d4 624
58a9b31b 625 hashed_resource_data->height = process_list->cell_height;
9e01e6d4 626
58a9b31b 627 g_assert(hashed_resource_data->height != 0);
9e01e6d4 628
58a9b31b 629 *height = hashed_resource_data->height * process_list->number_of_process;
9e01e6d4 630
58a9b31b 631 hashed_resource_data->pixmap =
9e01e6d4 632 gdk_pixmap_new(drawing->drawing_area->window,
633 drawing->alloc_width,
58a9b31b 634 hashed_resource_data->height,
9e01e6d4 635 -1);
636
c4e6f4dc 637 // Clear the image with black background
58a9b31b 638 gdk_draw_rectangle (hashed_resource_data->pixmap,
9e01e6d4 639 drawing->drawing_area->style->black_gc,
640 TRUE,
641 0, 0,
642 drawing->alloc_width,
58a9b31b 643 hashed_resource_data->height);
9e01e6d4 644
645 update_index_to_pixmap(process_list);
646
9e01e6d4 647 return 0;
648}
c4e6f4dc 649//int processlist_add( ProcessList *process_list,
650// Drawing_t *drawing,
651// guint pid,
652// guint tgid,
653// guint cpu,
654// guint ppid,
655// LttTime *birth,
656// guint trace_num,
657// GQuark name,
658// GQuark brand,
659// guint *height,
58a9b31b 660// ResourceInfo **pm_process_info,
661// HashedResourceData **pm_hashed_process_data)
c4e6f4dc 662//{
58a9b31b 663// ResourceInfo *Process_Info = g_new(ResourceInfo, 1);
664// HashedResourceData *hashed_process_data = g_new(HashedResourceData, 1);
c4e6f4dc 665// *pm_hashed_process_data = hashed_process_data;
666// *pm_process_info = Process_Info;
667//
668// Process_Info->pid = pid;
669// Process_Info->tgid = tgid;
670// if(pid == 0)
671// Process_Info->cpu = cpu;
672// else
673// Process_Info->cpu = 0;
674// Process_Info->ppid = ppid;
675// Process_Info->birth = *birth;
676// Process_Info->trace_num = trace_num;
677//
678// /* When we create it from before state update, we are sure that the
679// * last event occured before the beginning of the global area.
680// *
681// * If it is created after state update, this value (0) will be
682// * overriden by the new state before anything is drawn.
683// */
684// hashed_process_data->x.over = 0;
685// hashed_process_data->x.over_used = FALSE;
686// hashed_process_data->x.over_marked = FALSE;
687// hashed_process_data->x.middle = 0;
688// hashed_process_data->x.middle_used = FALSE;
689// hashed_process_data->x.middle_marked = FALSE;
690// hashed_process_data->x.under = 0;
691// hashed_process_data->x.under_used = FALSE;
692// hashed_process_data->x.under_marked = FALSE;
693// hashed_process_data->next_good_time = ltt_time_zero;
694//
695// /* Add a new row to the model */
696// gtk_list_store_append ( process_list->list_store,
697// &hashed_process_data->y_iter);
698//
699// gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
700// PROCESS_COLUMN, g_quark_to_string(name),
701// BRAND_COLUMN, g_quark_to_string(brand),
702// PID_COLUMN, pid,
703// TGID_COLUMN, tgid,
704// PPID_COLUMN, ppid,
705// CPU_COLUMN, cpu,
706// BIRTH_S_COLUMN, birth->tv_sec,
707// BIRTH_NS_COLUMN, birth->tv_nsec,
708// TRACE_COLUMN, trace_num,
709// -1);
710// //gtk_tree_view_set_model(GTK_TREE_VIEW(process_list->process_list_widget),
711// // GTK_TREE_MODEL(process_list->list_store));
712// //gtk_container_resize_children(GTK_CONTAINER(process_list->process_list_widget));
713//
714// g_hash_table_insert(process_list->process_hash,
715// (gpointer)Process_Info,
716// (gpointer)hashed_process_data);
717//
718// process_list->number_of_process++;
719//
720// hashed_process_data->height = process_list->cell_height;
721//
722// g_assert(hashed_process_data->height != 0);
723//
724// *height = hashed_process_data->height * process_list->number_of_process;
725//
726// hashed_process_data->pixmap =
727// gdk_pixmap_new(drawing->drawing_area->window,
728// drawing->alloc_width,
729// hashed_process_data->height,
730// -1);
731//
732// // Clear the image
733// gdk_draw_rectangle (hashed_process_data->pixmap,
734// drawing->drawing_area->style->black_gc,
735// TRUE,
736// 0, 0,
737// drawing->alloc_width,
738// hashed_process_data->height);
739//
740// update_index_to_pixmap(process_list);
741//
742//
743// return 0;
744//}
9e01e6d4 745
58a9b31b 746// TODO pmf: make this work once again
747//int processlist_remove( ProcessList *process_list,
748// guint pid,
749// guint cpu,
750// LttTime *birth,
751// guint trace_num)
752//{
753// ResourceInfo process_info;
754// HashedResourceData *hashed_process_data;
755// GtkTreeIter iter;
756//
757// process_info.pid = pid;
758// if(pid == 0)
759// process_info.cpu = cpu;
760// else
761// process_info.cpu = 0;
762// process_info.birth = *birth;
763// process_info.trace_num = trace_num;
764//
765//
766// hashed_process_data =
767// (HashedResourceData*)g_hash_table_lookup(
768// process_list->process_hash,
769// &process_info);
770// if(likely(hashed_process_data != NULL))
771// {
772// iter = hashed_process_data->y_iter;
773//
774// gtk_list_store_remove (process_list->list_store, &iter);
775//
776// g_hash_table_remove(process_list->process_hash,
777// &process_info);
778//
779// if(likely(process_list->current_hash_data != NULL)) {
780// if(likely(hashed_process_data == process_list->current_hash_data[trace_num][cpu])) {
781// process_list->current_hash_data[trace_num][cpu] = NULL;
782// }
783// }
784//
785// gdk_pixmap_unref(hashed_process_data->pixmap);
786//
787// update_index_to_pixmap(process_list);
788//
789// process_list->number_of_process--;
790//
791// return 0;
792// } else {
793// return 1;
794// }
795//}
9e01e6d4 796
797
798#if 0
799static inline guint get_cpu_number_from_name(GQuark name)
800{
801 const gchar *string;
802 char *begin;
803 guint cpu;
804
805 string = g_quark_to_string(name);
806
807 begin = strrchr(string, '/');
808 begin++;
809
810 g_assert(begin != '\0');
811
812 cpu = strtoul(begin, NULL, 10);
813
814 return cpu;
815}
816#endif //0
This page took 0.055464 seconds and 4 git commands to generate.