+Mon Oct 31 23:41:33 2005 Soeren Sandmann <sandmann@redhat.com>
+
+ * stackstash.h (struct StackNode): Add "total" field.
+
+ * stackstash.c (stack_stash_add_trace): Keep track of the
+ aggregate size.
+
+ * profile.c (profile_get_size): Sum the totals of the siblings
+ instead of all the children.
+
+ * profile.c (build_object_list): Correctly compute obj->self
+
+ * profile.c (profile_load): Don't ignore the node->total field.
+
+ * profile.c (serialize_call_tree): Save node->total instead of the
+ computed total
+
+ * profile.c (compute_total): Use n->total instead of computing it
+ from scratch.
+
+ * profile.c: Remove unused sum_children() function.
+
+ * TODO: Updates
+
+ * process.c (process_get_from_pid): Plug leak.
+
Mon Oct 31 21:36:37 2005 Søren Sandmann <sandmann@redhat.com>
* sysprof.c (fill_main_list): free the profile objects.
Before 1.2:
+* Don't build the GUI if gtk+ is not installed
+
* Handle time being set back in the RESET_DEAD_PERIOD code.
* Find out if the first sort order of a GtkTreeView column can be changed
(Reported by Kjartan Maraas).
- Fix bugs/performance issues:
- - total should probably be cached so that compute_total() doesn't
- take 80% of the time to generate a profile.
- decorate_node should be done lazily
- Find out why we sometimes get completely ridicoulous stacktraces,
where main seems to be called from within Xlib etc. This happens
process b spends 1% in foo() called from baz()
we get reports of baz() using > 80% of the time.
Or something.
+ - add_trace_to_tree() might be a little slow when dealing with deeply
+ recursive profiles. Hypothesis: seen_nodes can grow large, and the
+ algorithm is O(n^2) in the length of the trace.
- make the things we put in a stackstash real
objects so that
DONE:
+- total should probably be cached so that compute_total() doesn't
+ take 80% of the time to generate a profile.
+
- Fixing the oops in kernels < 2.6.11
- Probably just require 2.6.11 (necessary for timer interrupt
}
static int
-sum_children (StackNode *node)
-{
- int total;
- StackNode *child;
-
- /* FIXME: this is pretty inefficient. Instead perhaps
- * maintain or compute it in the stackstash
- */
- total = node->size;
-
- for (child = node->children; child != NULL; child = child->siblings)
- total += sum_children (child);
-
- return total;
-}
-
-static int
compute_total (StackNode *node)
{
StackNode *n;
int total = 0;
-
+
for (n = node; n != NULL; n = n->next)
{
if (n->toplevel)
- total += sum_children (n);
+ total += n->total;
}
return total;
sfile_add_pointer (output, "siblings", node->siblings);
sfile_add_pointer (output, "children", node->children);
sfile_add_pointer (output, "parent", node->parent);
- sfile_add_integer (output, "total", compute_total (node));
+ sfile_add_integer (output, "total", node->total);
sfile_add_integer (output, "self", node->size);
sfile_add_integer (output, "toplevel", node->toplevel);
sfile_end_add (output, "node", node);
sfile_get_pointer (input, "siblings", (gpointer *)&node->siblings);
sfile_get_pointer (input, "children", (gpointer *)&node->children);
sfile_get_pointer (input, "parent", (gpointer *)&node->parent);
- sfile_get_integer (input, "total", NULL);
+ sfile_get_integer (input, "total", &node->total);
sfile_get_integer (input, "self", (gint32 *)&node->size);
sfile_get_integer (input, "toplevel", &node->toplevel);
{
GList **objects = data;
ProfileObject *obj;
+ StackNode *n;
obj = g_new (ProfileObject, 1);
obj->name = node->address;
obj->total = compute_total (node);
-
- /* FIXME: this is incorrect. We need to sum all the node linked
- * through node->next
- */
- obj->self = node->size;
+
+ obj->self = 0;
+ for (n = node; n != NULL; n = n->siblings)
+ obj->self += n->size;
*objects = g_list_prepend (*objects, obj);
}
gint
profile_get_size (Profile *profile)
{
- return compute_total (stack_stash_get_root (profile->stash));
+ StackNode *n;
+ gint size = 0;
+
+ for (n = stack_stash_get_root (profile->stash); n != NULL; n = n->siblings)
+ size += compute_total (n);
+
+ return size;
}