mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
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.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
c2dc2c3680
commit
d33a9703a0
11
ChangeLog
11
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>
|
Mon Mar 28 11:09:02 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* TODO: updates
|
* TODO: updates
|
||||||
|
|||||||
57
profile.c
57
profile.c
@ -525,12 +525,12 @@ static void
|
|||||||
add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
GList *nodes_to_unmark = NULL;
|
GPtrArray *nodes_to_unmark = g_ptr_array_new ();
|
||||||
GList *nodes_to_unmark_recursive = NULL;
|
GPtrArray *nodes_to_unmark_recursive = g_ptr_array_new ();
|
||||||
ProfileDescendant *parent = NULL;
|
ProfileDescendant *parent = NULL;
|
||||||
|
int i, len;
|
||||||
|
|
||||||
GHashTable *seen_objects =
|
GPtrArray *seen_objects = g_ptr_array_new ();
|
||||||
g_hash_table_new (direct_hash_no_null, g_direct_equal);
|
|
||||||
|
|
||||||
for (list = trace; list != NULL; list = list->next)
|
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;
|
ProfileDescendant *seen_tree_node;
|
||||||
|
|
||||||
/* Have we seen this object further up the tree? */
|
/* 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)
|
if (seen_tree_node)
|
||||||
{
|
{
|
||||||
ProfileDescendant *node;
|
ProfileDescendant *node;
|
||||||
@ -566,12 +572,9 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
|||||||
|
|
||||||
match = seen_tree_node;
|
match = seen_tree_node;
|
||||||
|
|
||||||
g_hash_table_destroy (seen_objects);
|
g_ptr_array_remove_range (seen_objects, 0, seen_objects->len);
|
||||||
seen_objects =
|
|
||||||
g_hash_table_new (direct_hash_no_null, g_direct_equal);
|
|
||||||
|
|
||||||
for (node = match; node != NULL; node = node->parent)
|
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)
|
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->non_recursion += size;
|
||||||
++match->marked_non_recursive;
|
++match->marked_non_recursive;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match->marked_total)
|
if (!match->marked_total)
|
||||||
{
|
{
|
||||||
nodes_to_unmark_recursive = g_list_prepend (
|
g_ptr_array_add (nodes_to_unmark_recursive, match);
|
||||||
nodes_to_unmark_recursive, match);
|
|
||||||
|
|
||||||
match->total += size;
|
match->total += size;
|
||||||
match->marked_total = TRUE;
|
match->marked_total = TRUE;
|
||||||
@ -610,30 +612,33 @@ add_trace_to_tree (ProfileDescendant **tree, GList *trace, guint size)
|
|||||||
|
|
||||||
if (!list->next)
|
if (!list->next)
|
||||||
match->self += size;
|
match->self += size;
|
||||||
|
|
||||||
g_hash_table_insert (seen_objects, node->object, match);
|
g_ptr_array_add (seen_objects, match);
|
||||||
|
|
||||||
tree = &(match->children);
|
tree = &(match->children);
|
||||||
parent = match;
|
parent = match;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hash_table_destroy (seen_objects);
|
g_ptr_array_free (seen_objects, TRUE);
|
||||||
|
|
||||||
for (list = nodes_to_unmark; list != NULL; list = list->next)
|
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;
|
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;
|
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
|
static void
|
||||||
|
|||||||
16
sysprof.c
16
sysprof.c
@ -189,7 +189,6 @@ update_sensitivity (Application *app)
|
|||||||
queue_show_samples (app);
|
queue_show_samples (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
static void
|
||||||
set_busy (Application *app, gboolean busy)
|
set_busy (Application *app, gboolean busy)
|
||||||
{
|
{
|
||||||
@ -199,13 +198,14 @@ set_busy (Application *app, gboolean busy)
|
|||||||
cursor = gdk_cursor_new (GDK_WATCH);
|
cursor = gdk_cursor_new (GDK_WATCH);
|
||||||
else
|
else
|
||||||
cursor = NULL;
|
cursor = NULL;
|
||||||
|
|
||||||
gdk_window_set_cursor (app->main_window->window, cursor);
|
gdk_window_set_cursor (app->main_window->window, cursor);
|
||||||
|
|
||||||
if (cursor)
|
if (cursor)
|
||||||
gdk_cursor_unref (cursor);
|
gdk_cursor_unref (cursor);
|
||||||
|
|
||||||
|
gdk_flush ();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static gchar *
|
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 (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (app->profile_button)))
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
set_busy (app, TRUE);
|
set_busy (app, TRUE);
|
||||||
#endif
|
|
||||||
if (app->profile && !app->profile_from_file)
|
if (app->profile && !app->profile_from_file)
|
||||||
{
|
{
|
||||||
profile_free (app->profile);
|
profile_free (app->profile);
|
||||||
@ -692,9 +690,7 @@ on_profile_toggled (GtkWidget *widget, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ensure_profile (app);
|
ensure_profile (app);
|
||||||
#if 0
|
|
||||||
set_busy (app, FALSE);
|
set_busy (app, FALSE);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,6 +890,10 @@ on_object_selection_changed (GtkTreeSelection *selection, gpointer data)
|
|||||||
{
|
{
|
||||||
Application *app = data;
|
Application *app = data;
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
|
||||||
|
set_busy (app, TRUE);
|
||||||
|
|
||||||
|
gdk_window_process_all_updates ();
|
||||||
|
|
||||||
fill_descendants_tree (app);
|
fill_descendants_tree (app);
|
||||||
fill_callers_list (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_expand_row (
|
||||||
GTK_TREE_VIEW (app->descendants_view), path, FALSE);
|
GTK_TREE_VIEW (app->descendants_view), path, FALSE);
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
|
|
||||||
|
set_busy (app, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user