[Top][All Lists]

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

Re: Elisp native profiler

From: Eli Zaretskii
Subject: Re: Elisp native profiler
Date: Mon, 01 Oct 2012 23:12:45 +0200

> Date: Mon, 01 Oct 2012 19:59:46 +0200
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden, address@hidden
> Actually, I take this back: I'm quite sure the problem is that the
> handler is quite expensive.  The proof: when the user types 
> "M-x profiler-stop RET", the timer thread does not exit, it continues
> to run, sleeping 30 ms at a time, then awakens, sees that the timer is
> disabled, and goes back to sleep.  So almost the whole thread loop is
> executed, except suspending/resuming the main thread and calling the
> handler.  The difference in terms of CPU usage is tremendous, though:
> zero CPU usage.
> So either suspending/resuming a thread takes a lot of time, or the
> handler, or both.

The truth is neither.  I timed the code with a high-resolution timer
and found a bug.  After fixing it, the CPU usage while profiling is
zero (not visible on the CPU graph).  Also, it turns out that calling
the SIGPROF handler takes about 10 usec, half of it to suspend and
resume the main thread.

reply via email to

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