mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
Make these function call back with GLists rather than GSLists.
Sun Nov 6 18:31:23 2005 Soeren Sandmann <sandmann@redhat.com> * stackstash.c (stack_stash_foreach): * stackstash.c (stack_node_foreach_trace): Make these function call back with GLists rather than GSLists. * profile.c (add_trace_to_tree): Iterate backwards instead of copying the list.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
c1bfbbf9b8
commit
64b2627c4a
@ -1,3 +1,12 @@
|
||||
Sun Nov 6 18:31:23 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* stackstash.c (stack_stash_foreach):
|
||||
* stackstash.c (stack_node_foreach_trace): Make these function
|
||||
call back with GLists rather than GSLists.
|
||||
|
||||
* profile.c (add_trace_to_tree): Iterate backwards instead of
|
||||
copying the list.
|
||||
|
||||
Sun Nov 6 17:06:52 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* profile.c (add_trace_to_tree): Turn this function into a
|
||||
|
||||
10
collector.c
10
collector.c
@ -256,16 +256,16 @@ lookup_symbol (Process *process, gpointer address, GHashTable *unique_symbols)
|
||||
}
|
||||
|
||||
static void
|
||||
resolve_symbols (GSList *trace, gint size, gpointer data)
|
||||
resolve_symbols (GList *trace, gint size, gpointer data)
|
||||
{
|
||||
GSList *slist;
|
||||
GList *list;
|
||||
ResolveInfo *info = data;
|
||||
Process *process = g_slist_last (trace)->data;
|
||||
Process *process = g_list_last (trace)->data;
|
||||
GPtrArray *resolved_trace = g_ptr_array_new ();
|
||||
|
||||
for (slist = trace; slist && slist->next; slist = slist->next)
|
||||
for (list = trace; list && list->next; list = list->next)
|
||||
{
|
||||
gpointer address = slist->data;
|
||||
gpointer address = list->data;
|
||||
char *symbol;
|
||||
|
||||
symbol = lookup_symbol (process, address, info->unique_symbols);
|
||||
|
||||
@ -234,17 +234,15 @@ profile_new (StackStash *stash)
|
||||
}
|
||||
|
||||
static void
|
||||
add_trace_to_tree (GSList *trace, gint size, gpointer data)
|
||||
add_trace_to_tree (GList *trace, gint size, gpointer data)
|
||||
{
|
||||
GSList *list;
|
||||
GList *list;
|
||||
GPtrArray *nodes_to_unmark = g_ptr_array_new ();
|
||||
ProfileDescendant *parent = NULL;
|
||||
int i, len;
|
||||
ProfileDescendant **tree = data;
|
||||
|
||||
trace = g_slist_reverse (g_slist_copy (trace));
|
||||
|
||||
for (list = trace; list != NULL; list = list->next)
|
||||
for (list = g_list_last (trace); list != NULL; list = list->prev)
|
||||
{
|
||||
gpointer address = list->data;
|
||||
ProfileDescendant *match = NULL;
|
||||
@ -321,7 +319,6 @@ add_trace_to_tree (GSList *trace, gint size, gpointer data)
|
||||
}
|
||||
|
||||
g_ptr_array_free (nodes_to_unmark, TRUE);
|
||||
g_slist_free (trace);
|
||||
}
|
||||
|
||||
ProfileDescendant *
|
||||
|
||||
12
stackstash.c
12
stackstash.c
@ -127,17 +127,20 @@ stack_stash_add_trace (StackStash *stash,
|
||||
|
||||
static void
|
||||
do_callback (StackNode *node,
|
||||
const GSList *trace,
|
||||
GList *trace,
|
||||
StackFunction func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList link;
|
||||
GList link;
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
link.next = (GSList *)trace;
|
||||
if (trace)
|
||||
trace->prev = &link;
|
||||
link.next = trace;
|
||||
link.data = node->address;
|
||||
link.prev = NULL;
|
||||
|
||||
if (node->size)
|
||||
func (&link, node->size, data);
|
||||
@ -159,10 +162,11 @@ stack_node_foreach_trace (StackNode *node,
|
||||
StackFunction func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList link;
|
||||
GList link;
|
||||
|
||||
link.next = NULL;
|
||||
link.data = node->address;
|
||||
link.prev = NULL;
|
||||
|
||||
if (node->size)
|
||||
func (&link, node->size, data);
|
||||
|
||||
@ -41,8 +41,8 @@ struct StackNode
|
||||
gboolean toplevel;
|
||||
};
|
||||
|
||||
typedef void (* StackFunction) (GSList *trace,
|
||||
gint size,
|
||||
typedef void (* StackFunction) (GList *trace,
|
||||
gint size,
|
||||
gpointer data);
|
||||
|
||||
/* Stach */
|
||||
|
||||
Reference in New Issue
Block a user