From 736806aaa6d72a1330447b368e374032cbe4b806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sandmann?= Date: Mon, 2 Jun 2008 03:17:27 +0000 Subject: [PATCH] Do not fold recursions for symbols starting with "In file". MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sun Jun 1 23:03:06 2008 Søren Sandmann * profile.c (add_trace_to_tree): Do not fold recursions for symbols starting with "In file". * treeviewutils.c: Update copyright. Various formatting fixes. svn path=/trunk/; revision=427 --- ChangeLog | 7 +++++++ profile.c | 20 ++++++++++++++++++-- treeviewutils.c | 17 +++++++++-------- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ee1d569..ed7bb4ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Jun 1 23:03:06 2008 Søren Sandmann + + * profile.c (add_trace_to_tree): Do not fold recursions for + symbols starting with "In file". + + * treeviewutils.c: Update copyright. Various formatting fixes. + 2008-04-30 Owen Taylor * module/sysprof-module.c: Reorder the tests for diff --git a/profile.c b/profile.c index 0e3fbfb8..bf923447 100644 --- a/profile.c +++ b/profile.c @@ -232,6 +232,22 @@ profile_new (StackStash *stash) return profile; } +static gboolean +fold_recursion (gpointer address) +{ + /* This is a hack. + * + * The correct way to do it would be to have the address + * be a pointer to more information about the symbol; that + * way we could also do things like change the font. + * + * The problem with that is that we can't compatibly add + * this information to saved files, and we can't compute it + * without access to the processes who generated it. + */ + return strncmp (address, "In file", 7) != 0; +} + static void add_trace_to_tree (GList *trace, gint size, gpointer data) { @@ -244,7 +260,7 @@ add_trace_to_tree (GList *trace, gint size, gpointer data) gpointer address = list->data; ProfileDescendant *prev = NULL; ProfileDescendant *match = NULL; - + for (match = *tree; match != NULL; prev = match, match = match->siblings) { if (match->name == address) @@ -260,7 +276,7 @@ add_trace_to_tree (GList *trace, gint size, gpointer data) } } - if (!match) + if (!match && fold_recursion (address)) { /* Have we seen this object further up the tree? */ for (match = parent; match != NULL; match = match->parent) diff --git a/treeviewutils.c b/treeviewutils.c index 786cc05d..2299ed47 100644 --- a/treeviewutils.c +++ b/treeviewutils.c @@ -3,7 +3,7 @@ * Copyright 2003, 2004, Red Hat, Inc. * * Sysprof -- Sampling, systemwide CPU profiler - * Copyright 2004, 2005, Soeren Sandmann + * Copyright 2004, 2005, 2006, 2007, 2008 Soeren Sandmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,10 +32,10 @@ typedef struct } SortInfo; static void -set_sort_info (GtkTreeView *view, - GtkTreeViewColumn *column, - int model_column, - GtkSortType default_order) +set_sort_info (GtkTreeView *view, + GtkTreeViewColumn *column, + int model_column, + GtkSortType default_order) { SortInfo *info; @@ -56,7 +56,8 @@ get_sort_info (GtkTreeViewColumn *column) } static GtkTreeViewColumn * -find_column_by_model_column (GtkTreeView *view, int model_column) +find_column_by_model_column (GtkTreeView *view, + int model_column) { GList *columns = gtk_tree_view_get_columns (view); GList *list; @@ -78,8 +79,8 @@ find_column_by_model_column (GtkTreeView *view, int model_column) void tree_view_set_sort_column (GtkTreeView *view, - int model_column, - int sort_type) + int model_column, + int sort_type) { GList *columns, *list; GtkTreeSortable *sortable;