mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
Call callback with an extra boolean indicating whether the sample read was
2007-10-20 Soren Sandmann <sandmann@daimi.au.dk> * collector.c (on_read): Call callback with an extra boolean indicating whether the sample read was the first one * collector.c (add_trace_to_stash): Allocate addresses on the stack if possible. * sysprof.c (on_new_sample): Only call update_sensitivity() on the first sample. * stackstash.c (stack_stash_add_trace): Move match to front svn path=/trunk/; revision=373
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
f1cbdbf27c
commit
476e6f0c1b
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2007-10-20 Soren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
|
* collector.c (on_read): Call callback with an extra boolean
|
||||||
|
indicating whether the sample read was the first one
|
||||||
|
|
||||||
|
* collector.c (add_trace_to_stash): Allocate addresses on the
|
||||||
|
stack if possible.
|
||||||
|
|
||||||
|
* sysprof.c (on_new_sample): Only call update_sensitivity() on the
|
||||||
|
first sample.
|
||||||
|
|
||||||
|
* stackstash.c (stack_stash_add_trace): Move match to front
|
||||||
|
|
||||||
2007-09-16 Soren Sandmann <sandmann@daimi.au.dk>
|
2007-09-16 Soren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
* process.c (process_lookup_kernel_symbol): Add support for
|
* process.c (process_lookup_kernel_symbol): Add support for
|
||||||
|
|||||||
13
collector.c
13
collector.c
@ -94,11 +94,17 @@ add_trace_to_stash (const SysprofStackTrace *trace,
|
|||||||
int n_addresses;
|
int n_addresses;
|
||||||
int n_kernel_words;
|
int n_kernel_words;
|
||||||
int a;
|
int a;
|
||||||
|
gulong addrs_stack[2048];
|
||||||
|
int n_alloc;
|
||||||
|
|
||||||
n_addresses = trace->n_addresses;
|
n_addresses = trace->n_addresses;
|
||||||
n_kernel_words = trace->n_kernel_words;
|
n_kernel_words = trace->n_kernel_words;
|
||||||
|
|
||||||
addrs = g_new (gulong, n_addresses + n_kernel_words + 2);
|
n_alloc = n_addresses + n_kernel_words + 2;
|
||||||
|
if (n_alloc <= 2048)
|
||||||
|
addrs = addrs_stack;
|
||||||
|
else
|
||||||
|
addrs = g_new (gulong, n_alloc);
|
||||||
|
|
||||||
a = 0;
|
a = 0;
|
||||||
/* Add kernel addresses */
|
/* Add kernel addresses */
|
||||||
@ -140,7 +146,8 @@ add_trace_to_stash (const SysprofStackTrace *trace,
|
|||||||
stack_stash_add_trace (
|
stack_stash_add_trace (
|
||||||
stash, addrs, a, 1);
|
stash, addrs, a, 1);
|
||||||
|
|
||||||
g_free (addrs);
|
if (addrs != addrs_stack)
|
||||||
|
g_free (addrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -202,7 +209,7 @@ on_read (gpointer data)
|
|||||||
collector->n_samples++;
|
collector->n_samples++;
|
||||||
|
|
||||||
if (collector->callback)
|
if (collector->callback)
|
||||||
collector->callback (collector->data);
|
collector->callback (collector->n_samples == 1, collector->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,8 @@
|
|||||||
|
|
||||||
typedef struct Collector Collector;
|
typedef struct Collector Collector;
|
||||||
|
|
||||||
typedef void (* CollectorFunc) (gpointer data);
|
typedef void (* CollectorFunc) (gboolean first_sample,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
#define COLLECTOR_ERROR collector_error_quark ()
|
#define COLLECTOR_ERROR collector_error_quark ()
|
||||||
|
|
||||||
|
|||||||
16
stackstash.c
16
stackstash.c
@ -165,13 +165,21 @@ stack_stash_add_trace (StackStash *stash,
|
|||||||
for (i = n_addrs - 1; i >= 0; --i)
|
for (i = n_addrs - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
StackNode *match = NULL;
|
StackNode *match = NULL;
|
||||||
StackNode *n;
|
StackNode *prev;
|
||||||
|
|
||||||
for (n = *location; n != NULL; n = n->siblings)
|
prev = NULL;
|
||||||
|
for (match = *location; match != NULL; prev = match, match = match->siblings)
|
||||||
{
|
{
|
||||||
if (n->address == (gpointer)addrs[i])
|
if (match->address == (gpointer)addrs[i])
|
||||||
{
|
{
|
||||||
match = n;
|
if (prev)
|
||||||
|
{
|
||||||
|
/* move to front */
|
||||||
|
prev->siblings = match->siblings;
|
||||||
|
match->siblings = *location;
|
||||||
|
*location = match;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1552,12 +1552,15 @@ build_gui (Application *app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_new_sample (gpointer data)
|
on_new_sample (gboolean first_sample,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
Application *app = data;
|
Application *app = data;
|
||||||
|
|
||||||
if (app->state == PROFILING)
|
if (app->state == PROFILING && first_sample)
|
||||||
update_sensitivity (app);
|
update_sensitivity (app);
|
||||||
|
else
|
||||||
|
queue_show_samples (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Application *
|
static Application *
|
||||||
|
|||||||
Reference in New Issue
Block a user