mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-11 00:32:06 -07:00
Delay processing of SIGPROF to the next safepoint
* src/lisp.h (process_pending_profiler_signals): New function. * src/profiler.c (pending_profiler_signals): New variable. (handle_profiler_signal): Instead of calling add_sample, set pending_signals and increment pending_profiler_signals. (process_pending_profiler_signals): New function. * src/keyboard.c (process_pending_signals): Call process_pending_profiler_signals.
This commit is contained in:
parent
cabe8da3b6
commit
f3ef8385dc
3 changed files with 18 additions and 1 deletions
|
|
@ -8190,6 +8190,7 @@ process_pending_signals (void)
|
|||
handle_async_input ();
|
||||
do_pending_atimers ();
|
||||
do_async_work ();
|
||||
process_pending_profiler_signals ();
|
||||
}
|
||||
|
||||
/* Undo any number of BLOCK_INPUT calls down to level LEVEL,
|
||||
|
|
|
|||
|
|
@ -5974,6 +5974,7 @@ extern bool profiler_memory_running;
|
|||
extern void malloc_probe (size_t);
|
||||
extern void syms_of_profiler (void);
|
||||
extern void mark_profiler (void);
|
||||
extern void process_pending_profiler_signals (void);
|
||||
|
||||
|
||||
#ifdef DOS_NT
|
||||
|
|
|
|||
|
|
@ -387,6 +387,9 @@ static enum profiler_cpu_running
|
|||
/* Hash-table log of CPU profiler. */
|
||||
static struct profiler_log cpu;
|
||||
|
||||
/* Number of unprocessed profiler signals. */
|
||||
static uintptr_t pending_profiler_signals;
|
||||
|
||||
/* The current sampling interval in nanoseconds. */
|
||||
static EMACS_INT current_sampling_interval;
|
||||
|
||||
|
|
@ -402,7 +405,19 @@ handle_profiler_signal (int signal)
|
|||
count += overruns;
|
||||
}
|
||||
#endif
|
||||
add_sample (&cpu, count);
|
||||
pending_signals = true;
|
||||
pending_profiler_signals += count;
|
||||
}
|
||||
|
||||
void
|
||||
process_pending_profiler_signals (void)
|
||||
{
|
||||
uintptr_t count = pending_profiler_signals;
|
||||
if (count)
|
||||
{
|
||||
pending_profiler_signals = 0;
|
||||
add_sample (&cpu, count);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue