diff --git a/ChangeLog b/ChangeLog index 003a3c87..53d52672 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-10-22 Soren Sandmann + + * sfile.c: Fix some spelling errors + + * profile.[ch], sysprof.[ch]: Change "non_recursive" to + "cumulative" to match the UI + + * profile.c (add_trace_to_tree): Add a couple of asserts. + + * TODO: updates + 2007-10-22 Soren Sandmann * elfparser.c (read_table): Don't discard weak symbols. diff --git a/TODO b/TODO index 62833601..d8a1166d 100644 --- a/TODO +++ b/TODO @@ -156,6 +156,19 @@ Before 1.2: - etc. done: HEAD will not load files with the wrong inode now. +* In profile.c, change "non_recursive" to "cumulative", and + "marked_non_recursive" to a boolean "charged". This is tricky code, + so be careful. Possibly make it a two-pass operation: + - first add the new trace + - then walk from the leaf, charging nodes + That would allow us to get rid of the marked field altogether. In fact, + maybe the descendants tree could become a stackstash. We'll just have + to make stack_stash_add_trace() return the leaf. + Hmm, not quite - we still need the "go-back-on-recursion" behavior. + That could be added of course, but that gets complex. + + DONE: the name is now "cumulative" + * Add spew infrastructure to make remote debugging easier. * Make it compile and work on x86-64 diff --git a/profile.c b/profile.c index d93a5f3f..f0dd1a92 100644 --- a/profile.c +++ b/profile.c @@ -291,8 +291,11 @@ add_trace_to_tree (GList *trace, gint size, gpointer data) for (node = parent; node != seen_tree_node->parent; node = node->parent) { - node->non_recursion -= size; + node->cumulative -= size; --node->marked_non_recursive; + + g_assert (node->marked_non_recursive == 0 || + node->marked_non_recursive == 1); } match = seen_tree_node; @@ -304,7 +307,7 @@ add_trace_to_tree (GList *trace, gint size, gpointer data) match = g_new (ProfileDescendant, 1); match->name = address; - match->non_recursion = 0; + match->cumulative = 0; match->self = 0; match->children = NULL; match->marked_non_recursive = 0; @@ -313,10 +316,13 @@ add_trace_to_tree (GList *trace, gint size, gpointer data) *tree = match; } + g_assert (match->marked_non_recursive == 0 || + match->marked_non_recursive == 1); + if (!match->marked_non_recursive) { g_ptr_array_add (nodes_to_unmark, match); - match->non_recursion += size; + match->cumulative += size; ++match->marked_non_recursive; } @@ -331,6 +337,9 @@ add_trace_to_tree (GList *trace, gint size, gpointer data) for (i = 0; i < len; ++i) { ProfileDescendant *tree_node = nodes_to_unmark->pdata[i]; + + g_assert (tree_node->marked_non_recursive == 0 || + tree_node->marked_non_recursive == 1); tree_node->marked_non_recursive = 0; } diff --git a/profile.h b/profile.h index 5a9a3f55..0c1b874e 100644 --- a/profile.h +++ b/profile.h @@ -43,7 +43,7 @@ struct ProfileDescendant { char * name; guint self; - guint non_recursion; + guint cumulative; ProfileDescendant * parent; ProfileDescendant * siblings; ProfileDescendant * children; diff --git a/sfile.c b/sfile.c index ce472b7d..a106595a 100644 --- a/sfile.c +++ b/sfile.c @@ -448,7 +448,7 @@ handle_text (GMarkupParseContext *context, { if (!get_number (text, &instruction.u.pointer.target_id)) { - set_invalid_content_error (err, "Contents '%s' of pointer element is not a number", text); + set_invalid_content_error (err, "Content '%s' of pointer element is not a number", text); return; } } @@ -456,7 +456,7 @@ handle_text (GMarkupParseContext *context, { if (!get_number (text, &instruction.u.integer.value)) { - set_invalid_content_error (err, "Contents '%s' of integer element not a number", text); + set_invalid_content_error (err, "Content '%s' of integer element is not a number", text); return; } } @@ -464,7 +464,7 @@ handle_text (GMarkupParseContext *context, { if (!decode_text (text, &instruction.u.string.value)) { - set_invalid_content_error (err, "Contents '%s' of text element is illformed", text); + set_invalid_content_error (err, "Content '%s' of text element is ill-formed", text); return; } } diff --git a/sysprof.c b/sysprof.c index c30d05e0..ee6a9496 100644 --- a/sysprof.c +++ b/sysprof.c @@ -405,7 +405,7 @@ enum { DESCENDANTS_NAME, DESCENDANTS_SELF, - DESCENDANTS_NON_RECURSE, + DESCENDANTS_CUMULATIVE, DESCENDANTS_OBJECT }; @@ -496,10 +496,10 @@ add_node (GtkTreeStore *store, gtk_tree_store_set (store, &iter, DESCENDANTS_NAME, node->name, DESCENDANTS_SELF, 100 * (node->self)/(double)size, - DESCENDANTS_NON_RECURSE, 100 * (node->non_recursion)/(double)size, + DESCENDANTS_CUMULATIVE, 100 * (node->cumulative)/(double)size, #if 0 DESCENDANTS_SELF, (double)node->self, - DESCENDANTS_NON_RECURSE, (double)node->non_recursion, + DESCENDANTS_CUMULATIVE, (double)node->non_recursion, #endif DESCENDANTS_OBJECT, node->name, -1); @@ -539,7 +539,7 @@ fill_descendants_tree (Application *app) } tree_view_set_model_with_default_sort (app->descendants_view, GTK_TREE_MODEL (tree_store), - DESCENDANTS_NON_RECURSE, GTK_SORT_DESCENDING); + DESCENDANTS_CUMULATIVE, GTK_SORT_DESCENDING); g_object_unref (G_OBJECT (tree_store)); @@ -1021,7 +1021,7 @@ get_data (GtkTreeView *view, model, iter, DESCENDANTS_NAME, name? name : &dummy1, DESCENDANTS_SELF, self? self : &dummy2, - DESCENDANTS_NON_RECURSE, cumulative? cumulative : &dummy3, + DESCENDANTS_CUMULATIVE, cumulative? cumulative : &dummy3, -1); } @@ -1514,7 +1514,7 @@ build_gui (Application *app) gtk_tree_view_set_enable_search (app->descendants_view, FALSE); col = add_plain_text_column (app->descendants_view, _("Descendants"), DESCENDANTS_NAME); add_double_format_column (app->descendants_view, _("Self"), DESCENDANTS_SELF, "%.2f "); - add_double_format_column (app->descendants_view, _("Cumulative"), DESCENDANTS_NON_RECURSE, "%.2f "); + add_double_format_column (app->descendants_view, _("Cumulative"), DESCENDANTS_CUMULATIVE, "%.2f "); g_signal_connect (app->descendants_view, "row-activated", G_CALLBACK (on_descendants_row_activated), app); g_signal_connect (app->descendants_view, "row_expanded",