summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@redhat.com>2005-03-31 05:21:58 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2005-03-31 05:21:58 +0000
commitd33a9703a05a0ed173f967045643451fdfb51c7e (patch)
treea9561beaa7942e154d5217e3d518bf12ac537ef0
parentc2dc2c368053c7de04d9fd6054bd26dba682fa43 (diff)
Make this function work
Thu Mar 31 00:19:47 2005 Soeren Sandmann <sandmann@redhat.com> * sysprof.c (set_busy): Make this function work * sysprof.c (on_profile_toggled): Use it here * sysprof.c (on_object_selection_changed): And here * profile.c (add_trace_to_tree): Use GPtrArrays instead of GHashTable and GList.
-rw-r--r--ChangeLog11
-rw-r--r--profile.c57
-rw-r--r--sysprof.c16
3 files changed, 51 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index f8f9a1d..91c8877 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Mar 31 00:19:47 2005 Soeren Sandmann <sandmann@redhat.com>
+
+ * sysprof.c (set_busy): Make this function work
+
+ * sysprof.c (on_profile_toggled): Use it here
+
+ * sysprof.c (on_object_selection_changed): And here
+
+ * profile.c (add_trace_to_tree): Use GPtrArrays instead of
+ GHashTable and GList.
+
Mon Mar 28 11:09:02 2005 Soeren Sandmann <sandmann@redhat.com>
* TODO: updates
diff --git a/profile.c b/profile.c
index 38ac85a..bcdf82d 100644
--- a/profile.c
+++ b/profile.c
@@ -525,12 +525,12 @@ static void
add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
{
GList *list;
- GList *nodes_to_unmark = NULL;
- GList *nodes_to_unmark_recursive = NULL;
+ GPtrArray *nodes_to_unmark = g_ptr_array_new ();
+ GPtrArray *nodes_to_unmark_recursive = g_ptr_array_new ();
ProfileDescendant *parent = NULL;
+ int i, len;
- GHashTable *seen_objects =
- g_hash_table_new (direct_hash_no_null, g_direct_equal);
+ GPtrArray *seen_objects = g_ptr_array_new ();
for (list = trace; list != NULL; list = list->next)
{
@@ -550,8 +550,14 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
ProfileDescendant *seen_tree_node;
/* Have we seen this object further up the tree? */
- seen_tree_node = g_hash_table_lookup (seen_objects, node->object);
-
+ seen_tree_node = NULL;
+ for (i = 0; i < seen_objects->len; ++i)
+ {
+ ProfileDescendant *n = seen_objects->pdata[i];
+ if (n->object == node->object)
+ seen_tree_node = n;
+ }
+
if (seen_tree_node)
{
ProfileDescendant *node;
@@ -566,12 +572,9 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
match = seen_tree_node;
- g_hash_table_destroy (seen_objects);
- seen_objects =
- g_hash_table_new (direct_hash_no_null, g_direct_equal);
-
+ g_ptr_array_remove_range (seen_objects, 0, seen_objects->len);
for (node = match; node != NULL; node = node->parent)
- g_hash_table_insert (seen_objects, node->object, node);
+ g_ptr_array_add (seen_objects, node);
}
}
@@ -594,15 +597,14 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
if (!match->marked_non_recursive)
{
- nodes_to_unmark = g_list_prepend (nodes_to_unmark, match);
+ g_ptr_array_add (nodes_to_unmark, match);
match->non_recursion += size;
++match->marked_non_recursive;
}
if (!match->marked_total)
{
- nodes_to_unmark_recursive = g_list_prepend (
- nodes_to_unmark_recursive, match);
+ g_ptr_array_add (nodes_to_unmark_recursive, match);
match->total += size;
match->marked_total = TRUE;
@@ -610,30 +612,33 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
if (!list->next)
match->self += size;
-
- g_hash_table_insert (seen_objects, node->object, match);
+
+ g_ptr_array_add (seen_objects, match);
tree = &(match->children);
parent = match;
}
-
- g_hash_table_destroy (seen_objects);
-
- for (list = nodes_to_unmark; list != NULL; list = list->next)
+
+ g_ptr_array_free (seen_objects, TRUE);
+
+ len = nodes_to_unmark->len;
+ for (i = 0; i < len; ++i)
{
- ProfileDescendant *tree_node = list->data;
+ ProfileDescendant *tree_node = nodes_to_unmark->pdata[i];
tree_node->marked_non_recursive = 0;
}
-
- for (list = nodes_to_unmark_recursive; list != NULL; list = list->next)
+
+ len = nodes_to_unmark_recursive->len;
+ for (i = 0; i < len; ++i)
{
- ProfileDescendant *tree_node = list->data;
+ ProfileDescendant *tree_node = nodes_to_unmark_recursive->pdata[i];
tree_node->marked_total = FALSE;
}
-
- g_list_free (nodes_to_unmark);
+
+ g_ptr_array_free (nodes_to_unmark, TRUE);
+ g_ptr_array_free (nodes_to_unmark_recursive, TRUE);
}
static void
diff --git a/sysprof.c b/sysprof.c
index 05b261e..a4a27fb 100644
--- a/sysprof.c
+++ b/sysprof.c
@@ -189,7 +189,6 @@ update_sensitivity (Application *app)
queue_show_samples (app);
}
-#if 0
static void
set_busy (Application *app, gboolean busy)
{
@@ -199,13 +198,14 @@ set_busy (Application *app, gboolean busy)
cursor = gdk_cursor_new (GDK_WATCH);
else
cursor = NULL;
-
+
gdk_window_set_cursor (app->main_window->window, cursor);
if (cursor)
gdk_cursor_unref (cursor);
+
+ gdk_flush ();
}
-#endif
#if 0
static gchar *
@@ -682,9 +682,7 @@ on_profile_toggled (GtkWidget *widget, gpointer data)
if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (app->profile_button)))
{
-#if 0
set_busy (app, TRUE);
-#endif
if (app->profile && !app->profile_from_file)
{
profile_free (app->profile);
@@ -692,9 +690,7 @@ on_profile_toggled (GtkWidget *widget, gpointer data)
}
ensure_profile (app);
-#if 0
set_busy (app, FALSE);
-#endif
}
}
@@ -894,6 +890,10 @@ on_object_selection_changed (GtkTreeSelection *selection, gpointer data)
{
Application *app = data;
GtkTreePath *path;
+
+ set_busy (app, TRUE);
+
+ gdk_window_process_all_updates ();
fill_descendants_tree (app);
fill_callers_list (app);
@@ -905,6 +905,8 @@ on_object_selection_changed (GtkTreeSelection *selection, gpointer data)
gtk_tree_view_expand_row (
GTK_TREE_VIEW (app->descendants_view), path, FALSE);
gtk_tree_path_free (path);
+
+ set_busy (app, FALSE);
}
static void