static guint process_list_hash_fct(gconstpointer key)
{
- guint pid = ((ProcessInfo*)key)->pid;
- return ((pid>>8 ^ pid>>4 ^ pid>>2 ^ pid) ^ ((ProcessInfo*)key)->cpu);
+ guint pid = ((const ProcessInfo*)key)->pid;
+ return ((pid>>8 ^ pid>>4 ^ pid>>2 ^ pid) ^ ((const ProcessInfo*)key)->cpu);
}
+/* If hash is good, should be different */
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;
-
- if((pa->pid == 0 && (pa->cpu != pb->cpu)))
- return 0;
-
- if(pa->birth.tv_sec != pb->birth.tv_sec)
- return 0;
-
- if(pa->birth.tv_nsec != pb->birth.tv_nsec)
- return 0;
-
- if(pa->trace_num != pb->trace_num)
- return 0;
-
- return 1;
+ gboolean ret = TRUE;
+
+ if(likely(pa->pid != pb->pid))
+ ret = FALSE;
+ else if(likely((pa->pid == 0 && (pa->cpu != pb->cpu))))
+ ret = FALSE;
+ else if(unlikely(ltt_time_compare(pa->birth, pb->birth) != 0))
+ ret = FALSE;
+ else if(unlikely(pa->trace_num != pb->trace_num))
+ ret = FALSE;
+
+ return ret;
}
void destroy_hash_key(gpointer key);
gtk_list_store_remove (process_list->list_store, &iter);
- if(process_list->current_hash_data != NULL) {
- if(hashed_process_data ==
- process_list->current_hash_data[process_info->cpu])
+ if(likely(process_list->current_hash_data != NULL)) {
+ if(likely(hashed_process_data ==
+ process_list->current_hash_data[process_info->cpu]))
process_list->current_hash_data[process_info->cpu] = NULL;
}
return TRUE; /* remove the element from the hash table */
}
-
-static inline gint get_cell_height(ProcessList *process_list, GtkTreeView *tree_view)
-{
- gint height = process_list->cell_height_cache;
- if(height != -1) return height;
- else {
- GtkTreeViewColumn *Column = gtk_tree_view_get_column(tree_view, 0);
-
- gtk_tree_view_column_cell_get_size(Column, NULL, NULL, NULL, NULL,
- &process_list->cell_height_cache);
- }
-
-
- return process_list->cell_height_cache;
-}
-
void destroy_hash_key(gpointer key)
{
g_free(key);
guint trace_num)
{
ProcessInfo process_info;
- gint *path_indices;
HashedProcessData *hashed_process_data;
GtkTreeIter iter;
process_info.trace_num = trace_num;
- if(hashed_process_data =
+ hashed_process_data =
(HashedProcessData*)g_hash_table_lookup(
process_list->process_hash,
- &process_info))
+ &process_info);
+ if(likely(hashed_process_data != NULL))
{
iter = hashed_process_data->y_iter;
g_hash_table_remove(process_list->process_hash,
&process_info);
- if(process_list->current_hash_data != NULL) {
- if(hashed_process_data == process_list->current_hash_data[cpu]) {
+ if(likely(process_list->current_hash_data != NULL)) {
+ if(likely(hashed_process_data == process_list->current_hash_data[cpu])) {
process_list->current_hash_data[cpu] = NULL;
}
}