mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 08:00:53 +00:00
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:
committed by
Søren Sandmann Pedersen
parent
e2150fc188
commit
d78e744422
@ -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>
|
2006-10-25 Soren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
* process.c (free_maps): Take a pointer to a variable that will be
|
* process.c (free_maps): Take a pointer to a variable that will be
|
||||||
|
|||||||
5
TODO
5
TODO
@ -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
|
- Have kernel module report the file the address was found in
|
||||||
Should avoid a lot of potential broken/raciness with dlopen etc.
|
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
|
- Figure out how Google's pprof script works. Then add real call graph
|
||||||
drawing. (google's script is really simple; uses dot from graphviz).
|
drawing. (google's script is really simple; uses dot from graphviz).
|
||||||
|
|||||||
13
process.c
13
process.c
@ -424,8 +424,6 @@ file_exists (const char *name)
|
|||||||
int fd;
|
int fd;
|
||||||
fd = open (name, O_RDONLY);
|
fd = open (name, O_RDONLY);
|
||||||
|
|
||||||
g_print ("trying: %s\n", name);
|
|
||||||
|
|
||||||
if (fd > 0)
|
if (fd > 0)
|
||||||
{
|
{
|
||||||
close (fd);
|
close (fd);
|
||||||
@ -565,16 +563,7 @@ lookup_kernel_symbol (gulong address)
|
|||||||
{
|
{
|
||||||
static const char *const kernel = "In kernel";
|
static const char *const kernel = "In kernel";
|
||||||
|
|
||||||
#if 0
|
return kernel;
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|||||||
@ -243,12 +243,15 @@ profile_new (StackStash *stash)
|
|||||||
static void
|
static void
|
||||||
add_trace_to_tree (GList *trace, gint size, gpointer data)
|
add_trace_to_tree (GList *trace, gint size, gpointer data)
|
||||||
{
|
{
|
||||||
|
static GPtrArray *nodes_to_unmark;
|
||||||
GList *list;
|
GList *list;
|
||||||
GPtrArray *nodes_to_unmark = g_ptr_array_new ();
|
|
||||||
ProfileDescendant *parent = NULL;
|
ProfileDescendant *parent = NULL;
|
||||||
int i, len;
|
int i, len;
|
||||||
ProfileDescendant **tree = data;
|
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)
|
for (list = g_list_last (trace); list != NULL; list = list->prev)
|
||||||
{
|
{
|
||||||
gpointer address = list->data;
|
gpointer address = list->data;
|
||||||
@ -325,7 +328,7 @@ add_trace_to_tree (GList *trace, gint size, gpointer data)
|
|||||||
tree_node->marked_non_recursive = 0;
|
tree_node->marked_non_recursive = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_ptr_array_free (nodes_to_unmark, TRUE);
|
g_ptr_array_set_size (nodes_to_unmark, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileDescendant *
|
ProfileDescendant *
|
||||||
|
|||||||
Reference in New Issue
Block a user