update compat
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / processlist.c
CommitLineData
ce0214a6 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
f0d936c0 18
4e4d11b3 19#ifdef HAVE_CONFIG_H
20#include <config.h>
21#endif
22
fa2c4dbe 23#include <gtk/gtk.h>
24#include <glib.h>
a95bc95a 25#include <string.h>
26#include <stdlib.h>
1c736ed5 27#include <math.h>
d66666fe 28
29#include "processlist.h"
1c736ed5 30#include "drawing.h"
d66666fe 31#include "drawitem.h"
fa2c4dbe 32
ca0f8a8e 33#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
34#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
35
1c736ed5 36/* Preallocated Size of the index_to_pixmap array */
37#define ALLOCATE_PROCESSES 1000
ca0f8a8e 38
f0d936c0 39/*****************************************************************************
40 * Methods to synchronize process list *
41 *****************************************************************************/
42
f0d936c0 43
a56a1ba4 44gint process_sort_func ( GtkTreeModel *model,
45 GtkTreeIter *it_a,
46 GtkTreeIter *it_b,
47 gpointer user_data)
fa2c4dbe 48{
117986b7 49 gchar *a_name;
50 guint a_pid, a_ppid, a_cpu;
51 gulong a_birth_s, a_birth_ns;
52 gulong a_trace;
53
54 gchar *b_name;
55 guint b_pid, b_ppid, b_cpu;
56 gulong b_birth_s, b_birth_ns;
57 gulong b_trace;
58
59 gtk_tree_model_get(model,
60 it_a,
61 0, &a_name,
62 1, &a_pid,
63 2, &a_ppid,
64 3, &a_cpu,
65 4, &a_birth_s,
66 5, &a_birth_ns,
67 6, &a_trace,
68 -1);
69
70 gtk_tree_model_get(model,
71 it_b,
72 0, &b_name,
73 1, &b_pid,
74 2, &b_ppid,
75 3, &b_cpu,
76 4, &b_birth_s,
77 5, &b_birth_ns,
78 6, &b_trace,
79 -1);
a56a1ba4 80
a56a1ba4 81
82 /* Order by PID */
117986b7 83 if(a_pid == 0 && b_pid == 0) {
84 /* If 0, order by CPU */
85 if(a_cpu > b_cpu) return 1;
18e29396 86 if(a_cpu < b_cpu) return -1;
a56a1ba4 87
117986b7 88 } else { /* if not 0, order by pid */
a56a1ba4 89
117986b7 90 if(a_pid > b_pid) return 1;
18e29396 91 if(a_pid < b_pid) return -1;
a56a1ba4 92 }
93
a56a1ba4 94 /* Order by birth second */
a56a1ba4 95
117986b7 96 if(a_birth_s > b_birth_s) return 1;
18e29396 97 if(a_birth_s < b_birth_s) return -1;
117986b7 98
a56a1ba4 99
100 /* Order by birth nanosecond */
117986b7 101 if(a_birth_ns > b_birth_ns) return 1;
18e29396 102 if(a_birth_ns < b_birth_ns) return -1;
a56a1ba4 103
d0cd7f09 104 /* Order by trace_num */
117986b7 105 if(a_trace > b_trace) return 1;
18e29396 106 if(a_trace < b_trace) return -1;
d0cd7f09 107
a56a1ba4 108 return 0;
fa2c4dbe 109
110}
111
7893f726 112static guint process_list_hash_fct(gconstpointer key)
fa2c4dbe 113{
2eef04b5 114 guint pid = ((const ProcessInfo*)key)->pid;
115 return ((pid>>8 ^ pid>>4 ^ pid>>2 ^ pid) ^ ((const ProcessInfo*)key)->cpu);
fa2c4dbe 116}
117
1d1df11d 118/* If hash is good, should be different */
7893f726 119static gboolean process_list_equ_fct(gconstpointer a, gconstpointer b)
fa2c4dbe 120{
a95bc95a 121 const ProcessInfo *pa = (const ProcessInfo*)a;
122 const ProcessInfo *pb = (const ProcessInfo*)b;
7893f726 123
1d1df11d 124 gboolean ret = TRUE;
125
126 if(likely(pa->pid != pb->pid))
127 ret = FALSE;
348c6ba8 128 if(likely((pa->pid == 0 && (pa->cpu != pb->cpu))))
1d1df11d 129 ret = FALSE;
348c6ba8 130 if(unlikely(ltt_time_compare(pa->birth, pb->birth) != 0))
1d1df11d 131 ret = FALSE;
348c6ba8 132 if(unlikely(pa->trace_num != pb->trace_num))
1d1df11d 133 ret = FALSE;
134
135 return ret;
fa2c4dbe 136}
137
4c69e0cc 138void destroy_hash_key(gpointer key);
fa2c4dbe 139
4c69e0cc 140void destroy_hash_data(gpointer data);
fa2c4dbe 141
142
1c736ed5 143static void update_index_to_pixmap_each(ProcessInfo *key,
144 HashedProcessData *value,
145 ProcessList *process_list)
146{
147 guint array_index = processlist_get_index_from_data(process_list, value);
148
149 g_assert(array_index < process_list->index_to_pixmap->len);
150
151 GdkPixmap **pixmap =
152 (GdkPixmap**)&g_ptr_array_index(process_list->index_to_pixmap, array_index);
153
154 *pixmap = value->pixmap;
155}
156
157
7c0125e0 158void update_index_to_pixmap(ProcessList *process_list)
1c736ed5 159{
160 g_ptr_array_set_size(process_list->index_to_pixmap,
161 g_hash_table_size(process_list->process_hash));
162 g_hash_table_foreach(process_list->process_hash,
163 (GHFunc)update_index_to_pixmap_each,
164 process_list);
165}
166
167
168static void update_pixmap_size_each(ProcessInfo *key,
169 HashedProcessData *value,
170 guint width)
171{
172 GdkPixmap *old_pixmap = value->pixmap;
173
174 value->pixmap =
175 gdk_pixmap_new(old_pixmap,
176 width,
177 value->height,
178 -1);
179
180 gdk_pixmap_unref(old_pixmap);
181}
182
183
184void update_pixmap_size(ProcessList *process_list, guint width)
185{
186 g_hash_table_foreach(process_list->process_hash,
187 (GHFunc)update_pixmap_size_each,
188 (gpointer)width);
189}
190
191
192typedef struct _CopyPixmap {
193 GdkDrawable *dest;
194 GdkGC *gc;
195 GdkDrawable *src;
196 gint xsrc, ysrc, xdest, ydest, width, height;
197} CopyPixmap;
198
199static void copy_pixmap_region_each(ProcessInfo *key,
200 HashedProcessData *value,
201 CopyPixmap *cp)
202{
203 GdkPixmap *src = cp->src;
204 GdkPixmap *dest = cp->dest;
205
206 if(dest == NULL)
207 dest = value->pixmap;
208 if(src == NULL)
209 src = value->pixmap;
210
211 gdk_draw_drawable (dest,
212 cp->gc,
213 src,
214 cp->xsrc, cp->ysrc,
215 cp->xdest, cp->ydest,
216 cp->width, cp->height);
217}
218
219
220
221
222void copy_pixmap_region(ProcessList *process_list, GdkDrawable *dest,
223 GdkGC *gc, GdkDrawable *src,
224 gint xsrc, gint ysrc,
225 gint xdest, gint ydest, gint width, gint height)
226{
227 CopyPixmap cp = { dest, gc, src, xsrc, ysrc, xdest, ydest, width, height };
228
229 g_hash_table_foreach(process_list->process_hash,
230 (GHFunc)copy_pixmap_region_each,
231 &cp);
232}
233
234
235
236typedef struct _RectanglePixmap {
237 gboolean filled;
238 gint x, y, width, height;
239 GdkGC *gc;
240} RectanglePixmap;
241
242static void rectangle_pixmap_each(ProcessInfo *key,
243 HashedProcessData *value,
244 RectanglePixmap *rp)
245{
246 if(rp->height == -1)
247 rp->height = value->height;
248
249 gdk_draw_rectangle (value->pixmap,
250 rp->gc,
251 rp->filled,
252 rp->x, rp->y,
253 rp->width, rp->height);
254}
255
256
257
258
259void rectangle_pixmap(ProcessList *process_list, GdkGC *gc,
260 gboolean filled, gint x, gint y, gint width, gint height)
261{
262 RectanglePixmap rp = { filled, x, y, width, height, gc };
263
264 g_hash_table_foreach(process_list->process_hash,
265 (GHFunc)rectangle_pixmap_each,
266 &rp);
267}
268
269
270/* Renders each pixmaps into on big drawable */
271void copy_pixmap_to_screen(ProcessList *process_list,
272 GdkDrawable *dest,
273 GdkGC *gc,
274 gint x, gint y,
275 gint width, gint height)
276{
866fefbd 277 if(process_list->index_to_pixmap->len == 0) return;
278 guint cell_height = process_list->cell_height;
279
1c736ed5 280 /* Get indexes */
281 gint begin = floor(y/(double)cell_height);
282 gint end = MIN(ceil((y+height)/(double)cell_height),
283 process_list->index_to_pixmap->len);
284 gint i;
cc09b702 285
1c736ed5 286 for(i=begin; i<end; i++) {
287 g_assert(i<process_list->index_to_pixmap->len);
288 /* Render the pixmap to the screen */
289 GdkPixmap *pixmap =
6cec4cd2 290 //(GdkPixmap*)g_ptr_array_index(process_list->index_to_pixmap, i);
291 GDK_PIXMAP(g_ptr_array_index(process_list->index_to_pixmap, i));
1c736ed5 292
293 gdk_draw_drawable (dest,
294 gc,
295 pixmap,
296 x, 0,
297 x, i*cell_height,
298 width, cell_height);
299
300 }
301
302
303}
304
305
306
307
308
309
310
fa2c4dbe 311
312
4c69e0cc 313ProcessList *processlist_construct(void)
f0d936c0 314{
a56a1ba4 315 GtkTreeViewColumn *column;
316 GtkCellRenderer *renderer;
317
ba90bc77 318 ProcessList* process_list = g_new(ProcessList,1);
a56a1ba4 319
ba90bc77 320 process_list->number_of_process = 0;
a56a1ba4 321
4e86ae2e 322 process_list->current_hash_data = NULL;
323
a56a1ba4 324 /* Create the Process list */
f5d980bf 325 process_list->list_store = gtk_list_store_new ( N_COLUMNS,
a56a1ba4 326 G_TYPE_STRING,
327 G_TYPE_UINT,
e92eabaf 328 G_TYPE_UINT,
a95bc95a 329 G_TYPE_UINT,
a56a1ba4 330 G_TYPE_ULONG,
d0cd7f09 331 G_TYPE_ULONG,
a56a1ba4 332 G_TYPE_ULONG);
333
334
f5d980bf 335 process_list->process_list_widget =
a56a1ba4 336 gtk_tree_view_new_with_model
f5d980bf 337 (GTK_TREE_MODEL (process_list->list_store));
f3b7430d 338
f5d980bf 339 g_object_unref (G_OBJECT (process_list->list_store));
a56a1ba4 340
f3b7430d 341 gtk_tree_sortable_set_default_sort_func(
f5d980bf 342 GTK_TREE_SORTABLE(process_list->list_store),
a56a1ba4 343 process_sort_func,
344 NULL,
345 NULL);
80fdc3cb 346
347
348 gtk_tree_sortable_set_sort_column_id(
349 GTK_TREE_SORTABLE(process_list->list_store),
350 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
351 GTK_SORT_ASCENDING);
352
353
14963be0 354 process_list->process_hash = g_hash_table_new_full(
7893f726 355 process_list_hash_fct, process_list_equ_fct,
a56a1ba4 356 destroy_hash_key, destroy_hash_data
357 );
358
359
360 gtk_tree_view_set_headers_visible(
3cb8b205 361 GTK_TREE_VIEW(process_list->process_list_widget), TRUE);
a56a1ba4 362
363 /* Create a column, associating the "text" attribute of the
364 * cell_renderer to the first column of the model */
365 /* Columns alignment : 0.0 : Left 0.5 : Center 1.0 : Right */
366 renderer = gtk_cell_renderer_text_new ();
866fefbd 367 process_list->renderer = renderer;
368
369 gtk_cell_renderer_get_size(renderer,
370 GTK_WIDGET(process_list->process_list_widget),
371 NULL,
372 NULL,
373 NULL,
374 NULL,
375 &process_list->cell_height);
376
85690c4b 377 guint ypad;
378 g_object_get(G_OBJECT(renderer), "ypad", &ypad, NULL);
379
380 process_list->cell_height += ypad;
381
a56a1ba4 382 column = gtk_tree_view_column_new_with_attributes ( "Process",
383 renderer,
384 "text",
385 PROCESS_COLUMN,
386 NULL);
387 gtk_tree_view_column_set_alignment (column, 0.0);
388 gtk_tree_view_column_set_fixed_width (column, 45);
389 gtk_tree_view_append_column (
f5d980bf 390 GTK_TREE_VIEW (process_list->process_list_widget), column);
b9a010a2 391
392 process_list->button = column->button;
393
a56a1ba4 394 column = gtk_tree_view_column_new_with_attributes ( "PID",
395 renderer,
396 "text",
397 PID_COLUMN,
398 NULL);
399 gtk_tree_view_append_column (
f5d980bf 400 GTK_TREE_VIEW (process_list->process_list_widget), column);
a56a1ba4 401
e92eabaf 402 column = gtk_tree_view_column_new_with_attributes ( "PPID",
403 renderer,
404 "text",
405 PPID_COLUMN,
406 NULL);
407 gtk_tree_view_append_column (
408 GTK_TREE_VIEW (process_list->process_list_widget), column);
a95bc95a 409
410 column = gtk_tree_view_column_new_with_attributes ( "CPU",
411 renderer,
412 "text",
413 CPU_COLUMN,
414 NULL);
415 gtk_tree_view_append_column (
416 GTK_TREE_VIEW (process_list->process_list_widget), column);
a56a1ba4 417
418 column = gtk_tree_view_column_new_with_attributes ( "Birth sec",
419 renderer,
420 "text",
421 BIRTH_S_COLUMN,
422 NULL);
423 gtk_tree_view_append_column (
f5d980bf 424 GTK_TREE_VIEW (process_list->process_list_widget), column);
a56a1ba4 425
426 //gtk_tree_view_column_set_visible(column, 0);
427 //
428 column = gtk_tree_view_column_new_with_attributes ( "Birth nsec",
429 renderer,
430 "text",
431 BIRTH_NS_COLUMN,
432 NULL);
433 gtk_tree_view_append_column (
f5d980bf 434 GTK_TREE_VIEW (process_list->process_list_widget), column);
a56a1ba4 435
d0cd7f09 436 column = gtk_tree_view_column_new_with_attributes ( "TRACE",
437 renderer,
438 "text",
439 TRACE_COLUMN,
440 NULL);
441 gtk_tree_view_append_column (
442 GTK_TREE_VIEW (process_list->process_list_widget), column);
443
444
a56a1ba4 445 //gtk_tree_view_column_set_visible(column, 0);
446
447 g_object_set_data_full(
f5d980bf 448 G_OBJECT(process_list->process_list_widget),
ba90bc77 449 "process_list_Data",
450 process_list,
a56a1ba4 451 (GDestroyNotify)processlist_destroy);
452
1c736ed5 453 process_list->index_to_pixmap = g_ptr_array_sized_new(ALLOCATE_PROCESSES);
454
ba90bc77 455 return process_list;
f0d936c0 456}
b9a010a2 457
ba90bc77 458void processlist_destroy(ProcessList *process_list)
f0d936c0 459{
b9a010a2 460 g_debug("processlist_destroy %p", process_list);
14963be0 461 g_hash_table_destroy(process_list->process_hash);
462 process_list->process_hash = NULL;
1c736ed5 463 g_ptr_array_free(process_list->index_to_pixmap, TRUE);
f0d936c0 464
ba90bc77 465 g_free(process_list);
b9a010a2 466 g_debug("processlist_destroy end");
467}
468
469static gboolean remove_hash_item(ProcessInfo *process_info,
470 HashedProcessData *hashed_process_data,
471 ProcessList *process_list)
472{
b9a010a2 473 GtkTreeIter iter;
474
ad96f4a0 475 iter = hashed_process_data->y_iter;
b9a010a2 476
477 gtk_list_store_remove (process_list->list_store, &iter);
1c736ed5 478 gdk_pixmap_unref(hashed_process_data->pixmap);
b9a010a2 479
1d1df11d 480 if(likely(process_list->current_hash_data != NULL)) {
481 if(likely(hashed_process_data ==
482 process_list->current_hash_data[process_info->cpu]))
d2d199a6 483 process_list->current_hash_data[process_info->cpu] = NULL;
484 }
b9a010a2 485 return TRUE; /* remove the element from the hash table */
f0d936c0 486}
487
b9a010a2 488void processlist_clear(ProcessList *process_list)
489{
490 g_info("processlist_clear %p", process_list);
491
492 g_hash_table_foreach_remove(process_list->process_hash,
493 (GHRFunc)remove_hash_item,
494 (gpointer)process_list);
495 process_list->number_of_process = 0;
1c736ed5 496 update_index_to_pixmap(process_list);
b9a010a2 497}
498
499
ba90bc77 500GtkWidget *processlist_get_widget(ProcessList *process_list)
f0d936c0 501{
f5d980bf 502 return process_list->process_list_widget;
f0d936c0 503}
504
505
4c69e0cc 506void destroy_hash_key(gpointer key)
f0d936c0 507{
a56a1ba4 508 g_free(key);
fa2c4dbe 509}
510
4c69e0cc 511void destroy_hash_data(gpointer data)
fa2c4dbe 512{
a56a1ba4 513 g_free(data);
fa2c4dbe 514}
515
f4b88a7d 516
517void processlist_set_name(ProcessList *process_list,
518 GQuark name,
519 HashedProcessData *hashed_process_data)
520{
521 gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
522 PROCESS_COLUMN, g_quark_to_string(name),
523 -1);
524}
525
ba90bc77 526int processlist_add( ProcessList *process_list,
1c736ed5 527 Drawing_t *drawing,
a56a1ba4 528 guint pid,
a95bc95a 529 guint cpu,
e92eabaf 530 guint ppid,
a56a1ba4 531 LttTime *birth,
d0cd7f09 532 guint trace_num,
f4b88a7d 533 GQuark name,
a56a1ba4 534 guint *height,
4e86ae2e 535 ProcessInfo **pm_process_info,
f5d980bf 536 HashedProcessData **pm_hashed_process_data)
fa2c4dbe 537{
a56a1ba4 538 ProcessInfo *Process_Info = g_new(ProcessInfo, 1);
14963be0 539 HashedProcessData *hashed_process_data = g_new(HashedProcessData, 1);
f5d980bf 540 *pm_hashed_process_data = hashed_process_data;
4e86ae2e 541 *pm_process_info = Process_Info;
a56a1ba4 542
543 Process_Info->pid = pid;
a95bc95a 544 if(pid == 0)
545 Process_Info->cpu = cpu;
546 else
547 Process_Info->cpu = 0;
e92eabaf 548 Process_Info->ppid = ppid;
a56a1ba4 549 Process_Info->birth = *birth;
d0cd7f09 550 Process_Info->trace_num = trace_num;
b9a010a2 551
552 /* When we create it from before state update, we are sure that the
553 * last event occured before the beginning of the global area.
554 *
555 * If it is created after state update, this value (0) will be
556 * overriden by the new state before anything is drawn.
557 */
23093869 558 hashed_process_data->x.over = 0;
e72908ed 559 hashed_process_data->x.over_used = FALSE;
b2743953 560 hashed_process_data->x.over_marked = FALSE;
23093869 561 hashed_process_data->x.middle = 0;
e72908ed 562 hashed_process_data->x.middle_used = FALSE;
b2743953 563 hashed_process_data->x.middle_marked = FALSE;
23093869 564 hashed_process_data->x.under = 0;
e72908ed 565 hashed_process_data->x.under_used = FALSE;
b2743953 566 hashed_process_data->x.under_marked = FALSE;
567 hashed_process_data->next_good_time = ltt_time_zero;
1c736ed5 568
a56a1ba4 569 /* Add a new row to the model */
ad96f4a0 570 gtk_list_store_append ( process_list->list_store,
571 &hashed_process_data->y_iter);
572
573 gtk_list_store_set ( process_list->list_store, &hashed_process_data->y_iter,
f4b88a7d 574 PROCESS_COLUMN, g_quark_to_string(name),
a56a1ba4 575 PID_COLUMN, pid,
e92eabaf 576 PPID_COLUMN, ppid,
40debf7b 577 CPU_COLUMN, cpu,
a56a1ba4 578 BIRTH_S_COLUMN, birth->tv_sec,
579 BIRTH_NS_COLUMN, birth->tv_nsec,
d0cd7f09 580 TRACE_COLUMN, trace_num,
a56a1ba4 581 -1);
866fefbd 582 //gtk_tree_view_set_model(GTK_TREE_VIEW(process_list->process_list_widget),
583 // GTK_TREE_MODEL(process_list->list_store));
584 //gtk_container_resize_children(GTK_CONTAINER(process_list->process_list_widget));
585
a95bc95a 586 g_hash_table_insert(process_list->process_hash,
a56a1ba4 587 (gpointer)Process_Info,
14963be0 588 (gpointer)hashed_process_data);
a56a1ba4 589
ba90bc77 590 process_list->number_of_process++;
a56a1ba4 591
866fefbd 592 hashed_process_data->height = process_list->cell_height;
593
1c736ed5 594 g_assert(hashed_process_data->height != 0);
595
596 *height = hashed_process_data->height * process_list->number_of_process;
597
598 hashed_process_data->pixmap =
599 gdk_pixmap_new(drawing->drawing_area->window,
600 drawing->alloc_width,
601 hashed_process_data->height,
602 -1);
a56a1ba4 603
1c736ed5 604 // Clear the image
605 gdk_draw_rectangle (hashed_process_data->pixmap,
606 drawing->drawing_area->style->black_gc,
607 TRUE,
608 0, 0,
609 drawing->alloc_width,
610 hashed_process_data->height);
611
612 update_index_to_pixmap(process_list);
613
614
a56a1ba4 615 return 0;
f0d936c0 616}
617
ba90bc77 618int processlist_remove( ProcessList *process_list,
a56a1ba4 619 guint pid,
a95bc95a 620 guint cpu,
d0cd7f09 621 LttTime *birth,
622 guint trace_num)
f0d936c0 623{
4e86ae2e 624 ProcessInfo process_info;
14963be0 625 HashedProcessData *hashed_process_data;
a56a1ba4 626 GtkTreeIter iter;
627
4e86ae2e 628 process_info.pid = pid;
324cdea4 629 if(pid == 0)
4e86ae2e 630 process_info.cpu = cpu;
324cdea4 631 else
4e86ae2e 632 process_info.cpu = 0;
633 process_info.birth = *birth;
634 process_info.trace_num = trace_num;
a56a1ba4 635
636
1d1df11d 637 hashed_process_data =
a56a1ba4 638 (HashedProcessData*)g_hash_table_lookup(
14963be0 639 process_list->process_hash,
1d1df11d 640 &process_info);
641 if(likely(hashed_process_data != NULL))
a56a1ba4 642 {
ad96f4a0 643 iter = hashed_process_data->y_iter;
a56a1ba4 644
f5d980bf 645 gtk_list_store_remove (process_list->list_store, &iter);
e800cf84 646
14963be0 647 g_hash_table_remove(process_list->process_hash,
4e86ae2e 648 &process_info);
649
1d1df11d 650 if(likely(process_list->current_hash_data != NULL)) {
651 if(likely(hashed_process_data == process_list->current_hash_data[cpu])) {
0e9000a1 652 process_list->current_hash_data[cpu] = NULL;
653 }
4e86ae2e 654 }
1c736ed5 655
656 gdk_pixmap_unref(hashed_process_data->pixmap);
657
658 update_index_to_pixmap(process_list);
659
ba90bc77 660 process_list->number_of_process--;
a56a1ba4 661
662 return 0;
663 } else {
664 return 1;
665 }
fa2c4dbe 666}
667
668
40debf7b 669#if 0
6550d711 670static inline guint get_cpu_number_from_name(GQuark name)
a95bc95a 671{
a95bc95a 672 const gchar *string;
673 char *begin;
674 guint cpu;
675
676 string = g_quark_to_string(name);
677
678 begin = strrchr(string, '/');
679 begin++;
680
681 g_assert(begin != '\0');
682
683 cpu = strtoul(begin, NULL, 10);
684
685 return cpu;
686}
40debf7b 687#endif //0
This page took 0.077226 seconds and 4 git commands to generate.