emacs-devel
[Top][All Lists]
Advanced

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

Re: Elisp native profiler


From: Stefan Monnier
Subject: Re: Elisp native profiler
Date: Tue, 25 Sep 2012 13:28:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

[ Sorry, I hit C-c C-c by mistake in my previous email. ]

> Btw, doesn't sigprof_handler in profile.c violate the SYNC_INPUT
> paradigm, by running non-trivial code which can allocate memory from a
> signal handler?

sigprof_handler is written in such a way that it doesn't allocate any
memory, so while it runs non-trivial code, it doesn't make any
system-call or anything like that, it doesn't modify any data reachable
from the rest of Emacs code, and neither does the rest of Emacs code
modify any of the data it uses (except for a few global vars like
cpu_log, and I believe these don't suffer from race-conditions, but I'm
not very good at detecting those problems).

> Shouldn't profiling use the same framework as atimers
> and the other async events?

We could do that, but to the extent that it is possible to do all the
work in the signal_handler while still being safe, I think it's
preferable.  Most of the work done in the other signal handlers are
inherently "unsafe in the handler" because they really need to
make syscalls.


        Stefan



reply via email to

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