[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Elisp native profiler

From: Tomohiro Matsuyama
Subject: Re: Elisp native profiler
Date: Thu, 27 Sep 2012 07:46:55 +0900

> > Date: Wed, 26 Sep 2012 16:59:46 +0900
> > From: Tomohiro Matsuyama <address@hidden>
> > Cc: address@hidden, address@hidden, address@hidden
> > 
> > > I don't understand why do you say that threads mean no C-level
> > > backtrace, please explain.
> > I've explored and finally didn't find out how to obtain the information 
> > like siginfo_t and ucontext_t of running main thread from profiler thread.  
> > I want to know if possible.
> What kind of information do you need about the C-level backtrace?  We
> are talking about profiling the primitives written in C, right?

> So what do you need, in addition to the name of the primitive, that is in
> siginfo_t and ucontext_t?
What I wanted to say here is that we need to get a stack pointer of the 
running main thread to obtain C-level backtrace.  In my understand, the
stack pointer is not available to other threads without firing signals.
Of course, the profile thread can fire a signal (e.g. SIGALRM), but it
also makes the profiler non-portable and complicated.  The profiler using
threads looks like this:

    void profiler_thread() {
      while (1) {
        /* Record the elisp backtrace (backtrace_list) here.  */

        /* Obtain C-level backtrace here if possible.  */

        /* Sleep for sampling interval.  */

By the way, is it easy to obtain C-level backtrace?  gdb and addr2line might
help me, but I want a small and portable library for that.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]