diff options
Diffstat (limited to 'src/profiler.c')
| -rw-r--r-- | src/profiler.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/profiler.c b/src/profiler.c index 66a0e37f92e..f22a0352e73 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -387,6 +387,9 @@ static enum profiler_cpu_running | |||
| 387 | /* Hash-table log of CPU profiler. */ | 387 | /* Hash-table log of CPU profiler. */ |
| 388 | static struct profiler_log cpu; | 388 | static struct profiler_log cpu; |
| 389 | 389 | ||
| 390 | /* Number of unprocessed profiler signals. */ | ||
| 391 | static uintptr_t pending_profiler_signals; | ||
| 392 | |||
| 390 | /* The current sampling interval in nanoseconds. */ | 393 | /* The current sampling interval in nanoseconds. */ |
| 391 | static EMACS_INT current_sampling_interval; | 394 | static EMACS_INT current_sampling_interval; |
| 392 | 395 | ||
| @@ -402,7 +405,19 @@ handle_profiler_signal (int signal) | |||
| 402 | count += overruns; | 405 | count += overruns; |
| 403 | } | 406 | } |
| 404 | #endif | 407 | #endif |
| 405 | add_sample (&cpu, count); | 408 | pending_signals = true; |
| 409 | pending_profiler_signals += count; | ||
| 410 | } | ||
| 411 | |||
| 412 | void | ||
| 413 | process_pending_profiler_signals (void) | ||
| 414 | { | ||
| 415 | uintptr_t count = pending_profiler_signals; | ||
| 416 | if (count) | ||
| 417 | { | ||
| 418 | pending_profiler_signals = 0; | ||
| 419 | add_sample (&cpu, count); | ||
| 420 | } | ||
| 406 | } | 421 | } |
| 407 | 422 | ||
| 408 | static void | 423 | static void |