mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Call back after collecting all traces.
2008-03-24 Soren Sandmann <sandmann@daimi.au.dk> * collector.c (collect_traces): Call back after collecting all traces. * TODO: update * process.c: Simpler code to find vmlinux svn path=/trunk/; revision=406
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
d2a6151f8d
commit
62ffe734b0
@ -1,3 +1,12 @@
|
|||||||
|
2008-03-24 Soren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
|
* collector.c (collect_traces): Call back after collecting all
|
||||||
|
traces.
|
||||||
|
|
||||||
|
* TODO: update
|
||||||
|
|
||||||
|
* process.c: Simpler code to find vmlinux
|
||||||
|
|
||||||
Sat Mar 29 11:14:38 2008 Søren Sandmann <sandmann@redhat.com>
|
Sat Mar 29 11:14:38 2008 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* unwind.[ch], testunwind.c: Beginning of a dwarf unwinder.
|
* unwind.[ch], testunwind.c: Beginning of a dwarf unwinder.
|
||||||
|
|||||||
16
TODO
16
TODO
@ -121,6 +121,22 @@ Before 1.2:
|
|||||||
- do heuristic stackwalk in kernel
|
- do heuristic stackwalk in kernel
|
||||||
- do heuristic stackwalk in userland
|
- do heuristic stackwalk in userland
|
||||||
|
|
||||||
|
- Send heuristic stack trace to user space, along with
|
||||||
|
location on the stack. Then, in userspace analyze the
|
||||||
|
machine code to determine the size of the stack frame at any
|
||||||
|
point. The instructions that would need to be recognized are:
|
||||||
|
|
||||||
|
subl <constant>, %esp
|
||||||
|
addl <constant>, %esp
|
||||||
|
leave
|
||||||
|
jcc
|
||||||
|
push
|
||||||
|
pop
|
||||||
|
|
||||||
|
GCC is unlikely to have different stack sizes at the entry
|
||||||
|
to a basic block.
|
||||||
|
|
||||||
|
We can often find a vmlinux in /lib/modules/<uname-r>/build.
|
||||||
|
|
||||||
* "Expand all" is horrendously slow because update_screenshot gets called
|
* "Expand all" is horrendously slow because update_screenshot gets called
|
||||||
for every "expanded" signal. In fact even normal expanding is really
|
for every "expanded" signal. In fact even normal expanding is really
|
||||||
|
|||||||
10
collector.c
10
collector.c
@ -170,6 +170,8 @@ in_dead_period (Collector *collector)
|
|||||||
static void
|
static void
|
||||||
collect_traces (Collector *collector)
|
collect_traces (Collector *collector)
|
||||||
{
|
{
|
||||||
|
gboolean first;
|
||||||
|
|
||||||
/* After a reset we ignore samples for a short period so that
|
/* After a reset we ignore samples for a short period so that
|
||||||
* a reset will actually cause 'samples' to become 0
|
* a reset will actually cause 'samples' to become 0
|
||||||
*/
|
*/
|
||||||
@ -179,6 +181,8 @@ collect_traces (Collector *collector)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
first = collector->n_samples == 0;
|
||||||
|
|
||||||
while (collector->current != collector->map_area->head)
|
while (collector->current != collector->map_area->head)
|
||||||
{
|
{
|
||||||
const SysprofStackTrace *trace;
|
const SysprofStackTrace *trace;
|
||||||
@ -211,10 +215,10 @@ collect_traces (Collector *collector)
|
|||||||
collector->current = 0;
|
collector->current = 0;
|
||||||
|
|
||||||
collector->n_samples++;
|
collector->n_samples++;
|
||||||
|
|
||||||
if (collector->callback)
|
|
||||||
collector->callback (collector->n_samples == 1, collector->data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (collector->callback)
|
||||||
|
collector->callback (first, collector->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
37
process.c
37
process.c
@ -446,35 +446,28 @@ file_exists (const char *name)
|
|||||||
static gchar *
|
static gchar *
|
||||||
look_for_vmlinux (void)
|
look_for_vmlinux (void)
|
||||||
{
|
{
|
||||||
|
static const char names[][48] = {
|
||||||
|
"/lib/modules/%s/build/vmlinux",
|
||||||
|
"/usr/lib/debug/lib/modules/%s/vmlinux",
|
||||||
|
"/lib/modules/%s/source/vmlinux",
|
||||||
|
"/boot/vmlinux-%s",
|
||||||
|
};
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
char *result;
|
int i;
|
||||||
char **s;
|
|
||||||
char *names[4];
|
|
||||||
|
|
||||||
uname (&utsname);
|
uname (&utsname);
|
||||||
|
|
||||||
names[0] = g_strdup_printf (
|
for (i = 0; i < G_N_ELEMENTS (names); ++i)
|
||||||
"/usr/lib/debug/lib/modules/%s/vmlinux", utsname.release);
|
|
||||||
names[1] = g_strdup_printf (
|
|
||||||
"/lib/modules/%s/source/vmlinux", utsname.release);
|
|
||||||
names[2] = g_strdup_printf (
|
|
||||||
"/boot/vmlinux-%s", utsname.release);
|
|
||||||
names[3] = NULL;
|
|
||||||
|
|
||||||
result = NULL;
|
|
||||||
for (s = names; *s; s++)
|
|
||||||
{
|
{
|
||||||
if (file_exists (*s))
|
char *filename = g_strdup_printf (names[i], utsname.release);
|
||||||
{
|
|
||||||
result = g_strdup (*s);
|
if (file_exists (filename))
|
||||||
break;
|
return filename;
|
||||||
}
|
|
||||||
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (s = names; *s; s++)
|
return NULL;
|
||||||
g_free (*s);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
|
|||||||
Reference in New Issue
Block a user