Make the pointer array static to improve cache behavior and reduce calls

2006-10-25  Soren Sandmann <sandmann@daimi.au.dk>

        * profile.c (add_trace_to_tree): Make the pointer array static to
        improve cache behavior and reduce calls to malloc().

        * process.c (lookup_kernel_symbol): Remove obsolete comment.
This commit is contained in:
Soren Sandmann
2006-10-26 05:13:16 +00:00
committed by Søren Sandmann Pedersen
parent e2150fc188
commit d78e744422
4 changed files with 17 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2006-10-25 Soren Sandmann <sandmann@daimi.au.dk>
* profile.c (add_trace_to_tree): Make the pointer array static to
improve cache behavior and reduce calls to malloc().
* process.c (lookup_kernel_symbol): Remove obsolete comment.
2006-10-25 Soren Sandmann <sandmann@daimi.au.dk>
* process.c (free_maps): Take a pointer to a variable that will be

5
TODO
View File

@ -433,7 +433,10 @@ http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/ehframe.html
- Have kernel module report the file the address was found in
Should avoid a lot of potential broken/raciness with dlopen etc.
Probably better to send a list of maps with each trace.
Probably better to send a list of maps with each trace. Which
shouldn't really be that expensive. We already walk the list of
maps in process_ensure_map() on every trace. And we can do hashing
if it turns out to be a problem.
- Figure out how Google's pprof script works. Then add real call graph
drawing. (google's script is really simple; uses dot from graphviz).

View File

@ -424,8 +424,6 @@ file_exists (const char *name)
int fd;
fd = open (name, O_RDONLY);
g_print ("trying: %s\n", name);
if (fd > 0)
{
close (fd);
@ -565,16 +563,7 @@ lookup_kernel_symbol (gulong address)
{
static const char *const kernel = "In kernel";
#if 0
g_print ("kernel binary: %s\n", find_kernel_binary ());
#endif
return kernel; /* Can we just return "In kernel"? */
#if 0
kernel.name = "In kernel";
kernel.address = 0x00001337;
return &kernel;
#endif
return kernel;
}
const char *

View File

@ -243,12 +243,15 @@ profile_new (StackStash *stash)
static void
add_trace_to_tree (GList *trace, gint size, gpointer data)
{
static GPtrArray *nodes_to_unmark;
GList *list;
GPtrArray *nodes_to_unmark = g_ptr_array_new ();
ProfileDescendant *parent = NULL;
int i, len;
ProfileDescendant **tree = data;
if (!nodes_to_unmark)
nodes_to_unmark = g_ptr_array_new ();
for (list = g_list_last (trace); list != NULL; list = list->prev)
{
gpointer address = list->data;
@ -325,7 +328,7 @@ add_trace_to_tree (GList *trace, gint size, gpointer data)
tree_node->marked_non_recursive = 0;
}
g_ptr_array_free (nodes_to_unmark, TRUE);
g_ptr_array_set_size (nodes_to_unmark, 0);
}
ProfileDescendant *