[sysprof/newui: 15/24] Add callers lines
- From: SÃren Sandmann Pedersen <ssp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/newui: 15/24] Add callers lines
- Date: Wed, 29 Jun 2011 06:39:08 +0000 (UTC)
commit d968bbea869201b43083172e431a661564294ea2
Author: SÃren Sandmann Pedersen <sandmann daimi au dk>
Date: Wed Nov 10 01:52:20 2010 -0500
Add callers lines
sysprof.c | 52 +++++++++++++++++++++++++++++-----------------------
1 files changed, 29 insertions(+), 23 deletions(-)
---
diff --git a/sysprof.c b/sysprof.c
index a009ec9..f217bda 100644
--- a/sysprof.c
+++ b/sysprof.c
@@ -427,9 +427,18 @@ set_row (FooTreeStore *store, GtkTreeIter *iter,
}
static void
+set_node (FooTreeStore *store, GtkTreeIter *iter, int size, ProfileDescendant *node)
+{
+ set_row (store, iter,
+ node->name,
+ node->self * 100 / (double)size,
+ node->cumulative * 100 / (double)(size));
+}
+
+static void
add_node (FooTreeStore *store,
int size,
- GtkTreeIter *parent,
+ const GtkTreeIter *parent,
ProfileDescendant *node)
{
GtkTreeIter iter;
@@ -438,18 +447,9 @@ add_node (FooTreeStore *store,
return;
foo_tree_store_insert (store, &iter, (GtkTreeIter *)parent, 0);
-
- set_row (store, &iter, node->name,
- 100 * (node->self)/(double)size,
- 100 * (node->cumulative)/(double)size);
- if (parent == NULL)
- {
- foo_tree_store_insert (store, &iter, &iter, 0);
-
- set_row (store, &iter, "<i>Descendants</i>", 1.0, 1.0);
- }
-
+ set_node (store, &iter, size, node);
+
add_node (store, size, parent, node->siblings);
add_node (store, size, &iter, node->children);
}
@@ -457,14 +457,10 @@ add_node (FooTreeStore *store,
static void
fill_descendants_tree (Application *app)
{
- FooTreeStore *tree_store;
+ FooTreeStore *store;
- tree_store =
- foo_tree_store_new (4,
- G_TYPE_DOUBLE,
- G_TYPE_DOUBLE,
- G_TYPE_STRING,
- G_TYPE_POINTER);
+ store = foo_tree_store_new (
+ 4, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_STRING, G_TYPE_POINTER);
if (app->profile)
{
@@ -477,19 +473,29 @@ fill_descendants_tree (Application *app)
if (object->name)
{
+ int size = profile_get_size (app->profile);
+ GtkTreeIter iter, iter2;
ProfileDescendant *node =
profile_create_descendants (app->profile, object->name);
- add_node (tree_store,
- profile_get_size (app->profile), NULL, node);
+ foo_tree_store_insert (store, &iter, NULL, 0);
+ set_node (store, &iter, size, node);
+
+ foo_tree_store_insert (store, &iter2, &iter, 0);
+ set_row (store, &iter2, "<i>Descendants</i>", 2.0, 2.0);
+ add_node (store, size, &iter2, node->children);
+
+ foo_tree_store_insert (store, &iter2, &iter, 0);
+ set_row (store, &iter2, "<i>Callers</i>", 1.0, 1.0);
+
}
}
}
- tree_view_set_model_with_default_sort (app->descendants_view, GTK_TREE_MODEL (tree_store),
+ tree_view_set_model_with_default_sort (app->descendants_view, GTK_TREE_MODEL (store),
DESCENDANTS_CUMULATIVE, GTK_SORT_DESCENDING);
- g_object_unref (G_OBJECT (tree_store));
+ g_object_unref (G_OBJECT (store));
gtk_tree_view_columns_autosize (app->descendants_view);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]