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