better hash functions in state.c and processlist.c
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 12 Aug 2004 21:21:58 +0000 (21:21 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 12 Aug 2004 21:21:58 +0000 (21:21 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@718 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/state.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c

index 20d4184a43c29c01a972bbb57ad0396dd11a5f54..2ff087f48d335aef3363dcd593445f0bf7bbe598 100644 (file)
@@ -97,7 +97,8 @@ void lttv_state_state_saved_free(LttvTraceState *self,
 
 guint process_hash(gconstpointer key) 
 {
-  return ((const LttvProcessState *)key)->pid;
+  guint pid = ((const LttvProcessState *)key)->pid;
+  return (pid>>8 ^ pid>>4 ^ pid>>2 ^ pid) ;
 }
 
 
index e877e6d99cca540a9ce60c896db30db0c5150b17..64abc0bdf54e6578122a19af5da272d6bd955447 100644 (file)
@@ -54,7 +54,19 @@ GdkColor drawing_colors[NUM_COLORS] =
   { 0, 0xFFFF, 0xFFFF, 0xFFFF }  /* COL_MODE_UNKNOWN : white */
 
 };
+/*
+RUN+USER MODE green
+RUN+SYSCALL
+RUN+TRAP
+RUN+IRQ
+WAIT+foncé
+WAIT CPU + WAIT FORK vert foncé ou jaune
+IRQ rouge
+TRAP: orange
+SYSCALL: bleu pâle
 
+ZOMBIE + WAIT EXIT
+*/
 
 
 /*****************************************************************************
@@ -261,7 +273,6 @@ void drawing_data_request(Drawing_t *drawing,
 
       
       /* Add these hooks to each event_by_id hooks list */
-
       /* add before */
       for(k = 0 ; k < hooks->len/2 ; k++) {
         hook = g_array_index(hooks, LttvTraceHook, k);
index 6e2ec2c75fcade1b85face1721c7419169496683..924d8c52501b795eb673f579433b98304250ff9f 100644 (file)
@@ -233,16 +233,17 @@ gint process_sort_func  ( GtkTreeModel *model,
 
 }
 
-static guint hash_fct(gconstpointer key)
+static guint process_list_hash_fct(gconstpointer key)
 {
-  return ((ProcessInfo*)key)->pid ^ ((ProcessInfo*)key)->cpu;
+  guint pid = ((ProcessInfo*)key)->pid;
+  return ((pid>>8 ^ pid>>4 ^ pid>>2 ^ pid) ^ ((ProcessInfo*)key)->cpu);
 }
 
-static gboolean equ_fct(gconstpointer a, gconstpointer b)
+static gboolean process_list_equ_fct(gconstpointer a, gconstpointer b)
 {
   const ProcessInfo *pa = (const ProcessInfo*)a;
   const ProcessInfo *pb = (const ProcessInfo*)b;
-
+  
   if(pa->pid != pb->pid)
     return 0;
 
@@ -307,7 +308,7 @@ ProcessList *processlist_construct(void)
       GTK_SORT_ASCENDING);
   
   process_list->process_hash = g_hash_table_new_full(
-      hash_fct, equ_fct,
+      process_list_hash_fct, process_list_equ_fct,
       destroy_hash_key, destroy_hash_data
       );
   
This page took 0.033681 seconds and 4 git commands to generate.