mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-09 14:40:54 +00:00
updates
2006-03-11 Soren Sandmann <sandmann@redhat.com> * TODO: updates * stackstash.[ch]: Make stackstash refcounted * collector.c, profile.c: Update for refcounted stackstash, plug leak. * collector.c (open_fd): Remove FIXME comment
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
849efc820d
commit
9859854cc1
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2006-03-11 Soren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
* TODO: updates
|
||||||
|
|
||||||
|
* stackstash.[ch]: Make stackstash refcounted
|
||||||
|
|
||||||
|
* collector.c, profile.c: Update for refcounted stackstash, plug
|
||||||
|
leak.
|
||||||
|
|
||||||
|
* collector.c (open_fd): Remove FIXME comment
|
||||||
|
|
||||||
2006-03-05 Soeren Sandmann <sandmann@redhat.com>
|
2006-03-05 Soeren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* sysprof-text.c, collector.c, sysprof.c: Do proper
|
* sysprof-text.c, collector.c, sysprof.c: Do proper
|
||||||
|
|||||||
4
TODO
4
TODO
@ -79,8 +79,6 @@ Before 1.2:
|
|||||||
- a more pragmatic approach might be to just walk the tree and
|
- a more pragmatic approach might be to just walk the tree and
|
||||||
save it.
|
save it.
|
||||||
|
|
||||||
- make stackstash ref counted
|
|
||||||
|
|
||||||
- plug all the leaks
|
- plug all the leaks
|
||||||
- don't leak the presentation strings/objects
|
- don't leak the presentation strings/objects
|
||||||
- loading and saving probably leak right now
|
- loading and saving probably leak right now
|
||||||
@ -471,6 +469,8 @@ Later:
|
|||||||
|
|
||||||
DONE:
|
DONE:
|
||||||
|
|
||||||
|
- make stackstash ref counted
|
||||||
|
|
||||||
- Charge 'self' properly to processes that don't get any stack trace at all
|
- Charge 'self' properly to processes that don't get any stack trace at all
|
||||||
(probably we get that for free with stackstash reorganisation)
|
(probably we get that for free with stackstash reorganisation)
|
||||||
|
|
||||||
|
|||||||
14
collector.c
14
collector.c
@ -205,7 +205,6 @@ open_fd (Collector *collector,
|
|||||||
{
|
{
|
||||||
set_no_module_error (err);
|
set_no_module_error (err);
|
||||||
|
|
||||||
/* FIXME: set error */
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,7 +242,7 @@ void
|
|||||||
collector_reset (Collector *collector)
|
collector_reset (Collector *collector)
|
||||||
{
|
{
|
||||||
if (collector->stash)
|
if (collector->stash)
|
||||||
stack_stash_free (collector->stash);
|
stack_stash_unref (collector->stash);
|
||||||
|
|
||||||
process_flush_caches();
|
process_flush_caches();
|
||||||
|
|
||||||
@ -313,13 +312,16 @@ resolve_symbols (GList *trace, gint size, gpointer data)
|
|||||||
unique_dup (info->unique_symbols,
|
unique_dup (info->unique_symbols,
|
||||||
"Everything"));
|
"Everything"));
|
||||||
|
|
||||||
stack_stash_add_trace (info->resolved_stash, (gulong *)resolved_trace->pdata, resolved_trace->len, size);
|
stack_stash_add_trace (info->resolved_stash,
|
||||||
|
(gulong *)resolved_trace->pdata,
|
||||||
|
resolved_trace->len, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile *
|
Profile *
|
||||||
collector_create_profile (Collector *collector)
|
collector_create_profile (Collector *collector)
|
||||||
{
|
{
|
||||||
ResolveInfo info;
|
ResolveInfo info;
|
||||||
|
Profile *profile;
|
||||||
|
|
||||||
info.resolved_stash = stack_stash_new ();
|
info.resolved_stash = stack_stash_new ();
|
||||||
info.unique_symbols = g_hash_table_new (g_direct_hash, g_direct_equal);
|
info.unique_symbols = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||||
@ -327,8 +329,12 @@ collector_create_profile (Collector *collector)
|
|||||||
stack_stash_foreach (collector->stash, resolve_symbols, &info);
|
stack_stash_foreach (collector->stash, resolve_symbols, &info);
|
||||||
|
|
||||||
g_hash_table_destroy (info.unique_symbols);
|
g_hash_table_destroy (info.unique_symbols);
|
||||||
|
|
||||||
|
profile = profile_new (info.resolved_stash);
|
||||||
|
|
||||||
|
stack_stash_unref (info.resolved_stash);
|
||||||
|
|
||||||
return profile_new (info.resolved_stash);
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -228,7 +228,7 @@ profile_new (StackStash *stash)
|
|||||||
{
|
{
|
||||||
Profile *profile = g_new (Profile, 1);
|
Profile *profile = g_new (Profile, 1);
|
||||||
|
|
||||||
profile->stash = stash;
|
profile->stash = stack_stash_ref (stash);
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ profile_list_callers (Profile *profile,
|
|||||||
void
|
void
|
||||||
profile_free (Profile *profile)
|
profile_free (Profile *profile)
|
||||||
{
|
{
|
||||||
/* FIXME unref stash */
|
stack_stash_unref (profile->stash);
|
||||||
g_free (profile);
|
g_free (profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
38
stackstash.c
38
stackstash.c
@ -23,6 +23,7 @@ struct StackStash
|
|||||||
{
|
{
|
||||||
StackNode *root;
|
StackNode *root;
|
||||||
GHashTable *nodes_by_data;
|
GHashTable *nodes_by_data;
|
||||||
|
int ref_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
static StackNode *
|
static StackNode *
|
||||||
@ -39,18 +40,25 @@ stack_node_new (void)
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stach */
|
static StackStash *
|
||||||
StackStash *
|
create_stack_stash (void)
|
||||||
stack_stash_new (void)
|
|
||||||
{
|
{
|
||||||
StackStash *stash = g_new (StackStash, 1);
|
StackStash *stash = g_new (StackStash, 1);
|
||||||
|
|
||||||
stash->root = NULL;
|
stash->root = NULL;
|
||||||
stash->nodes_by_data = g_hash_table_new (g_direct_hash, g_direct_equal);
|
stash->nodes_by_data = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||||
|
stash->ref_count = 1;
|
||||||
|
|
||||||
return stash;
|
return stash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Stach */
|
||||||
|
StackStash *
|
||||||
|
stack_stash_new (void)
|
||||||
|
{
|
||||||
|
return create_stack_stash();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
decorate_node (StackStash *stash,
|
decorate_node (StackStash *stash,
|
||||||
StackNode *node)
|
StackNode *node)
|
||||||
@ -187,8 +195,8 @@ stack_node_free (StackNode *node)
|
|||||||
g_free (node);
|
g_free (node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
stack_stash_free (StackStash *stash)
|
stack_stash_free (StackStash *stash)
|
||||||
{
|
{
|
||||||
stack_node_free (stash->root);
|
stack_node_free (stash->root);
|
||||||
g_hash_table_destroy (stash->nodes_by_data);
|
g_hash_table_destroy (stash->nodes_by_data);
|
||||||
@ -196,6 +204,21 @@ stack_stash_free (StackStash *stash)
|
|||||||
g_free (stash);
|
g_free (stash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stack_stash_unref (StackStash *stash)
|
||||||
|
{
|
||||||
|
stash->ref_count--;
|
||||||
|
if (stash->ref_count == 0)
|
||||||
|
stack_stash_free (stash);
|
||||||
|
}
|
||||||
|
|
||||||
|
StackStash *
|
||||||
|
stack_stash_ref (StackStash *stash)
|
||||||
|
{
|
||||||
|
stash->ref_count++;
|
||||||
|
return stash;
|
||||||
|
}
|
||||||
|
|
||||||
StackNode *
|
StackNode *
|
||||||
stack_stash_find_node (StackStash *stash,
|
stack_stash_find_node (StackStash *stash,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
@ -256,10 +279,7 @@ build_hash_table (StackNode *node,
|
|||||||
StackStash *
|
StackStash *
|
||||||
stack_stash_new_from_root (StackNode *root)
|
stack_stash_new_from_root (StackNode *root)
|
||||||
{
|
{
|
||||||
StackStash *stash = g_new (StackStash, 1);
|
StackStash *stash = create_stack_stash();
|
||||||
|
|
||||||
stash->root = root;
|
|
||||||
stash->nodes_by_data = g_hash_table_new (g_direct_hash, g_direct_equal);
|
|
||||||
|
|
||||||
build_hash_table (stash->root, stash);
|
build_hash_table (stash->root, stash);
|
||||||
|
|
||||||
|
|||||||
@ -64,8 +64,9 @@ StackNode *stack_stash_find_node (StackStash *stash,
|
|||||||
void stack_stash_foreach_by_address (StackStash *stash,
|
void stack_stash_foreach_by_address (StackStash *stash,
|
||||||
StackNodeFunc func,
|
StackNodeFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void stack_stash_free (StackStash *stash);
|
|
||||||
StackNode *stack_stash_get_root (StackStash *stash);
|
StackNode *stack_stash_get_root (StackStash *stash);
|
||||||
StackStash *stack_stash_new_from_root (StackNode *root);
|
StackStash *stack_stash_new_from_root (StackNode *root);
|
||||||
|
StackStash *stack_stash_ref (StackStash *stash);
|
||||||
|
void stack_stash_unref (StackStash *stash);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user