mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Use callbacks from stackstash.
Sat Nov 5 18:06:40 2005 Soeren Sandmann <sandmann@redhat.com> * profile.c (profile_create_descendants): Use callbacks from stackstash. * stackstash.c (stack_node_foreach_trace): New function * stackstash.c (do_node_callback): New function
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
1f5b6ff38c
commit
c0aed2a4de
36
stackstash.c
36
stackstash.c
@ -155,6 +155,42 @@ stack_stash_foreach (StackStash *stash,
|
||||
do_callback (stash->root, NULL, stack_func, data);
|
||||
}
|
||||
|
||||
static void
|
||||
do_node_callback (StackNode *node, const GSList *trace,
|
||||
StackTraceFunction func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList link;
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
link.next = (GSList *)trace;
|
||||
link.data = node;
|
||||
|
||||
if (node->size)
|
||||
func (&link, data);
|
||||
|
||||
do_node_callback (node->children, &link, func, data);
|
||||
do_node_callback (node->siblings, trace, func, data);
|
||||
}
|
||||
|
||||
void
|
||||
stack_node_foreach_trace (StackNode *node,
|
||||
StackTraceFunction func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList link;
|
||||
|
||||
link.next = NULL;
|
||||
link.data = node;
|
||||
|
||||
if (node->size)
|
||||
func (&link, data);
|
||||
|
||||
do_node_callback (node->children, &link, func, data);
|
||||
}
|
||||
|
||||
static void
|
||||
stack_node_free (StackNode *node)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user