diff options
Diffstat (limited to 'src/profiler.c')
| -rw-r--r-- | src/profiler.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/profiler.c b/src/profiler.c index 8573d13b554..e7593a6a0e0 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -257,19 +257,20 @@ See also `profiler-log-size' and `profiler-max-stack-depth'. */) | |||
| 257 | timer.it_value = timer.it_interval; | 257 | timer.it_value = timer.it_interval; |
| 258 | setitimer (ITIMER_PROF, &timer, 0); | 258 | setitimer (ITIMER_PROF, &timer, 0); |
| 259 | 259 | ||
| 260 | profiler_cpu_running = 1; | 260 | profiler_cpu_running = true; |
| 261 | 261 | ||
| 262 | return Qt; | 262 | return Qt; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | DEFUN ("profiler-cpu-stop", Fprofiler_cpu_stop, Sprofiler_cpu_stop, | 265 | DEFUN ("profiler-cpu-stop", Fprofiler_cpu_stop, Sprofiler_cpu_stop, |
| 266 | 0, 0, 0, | 266 | 0, 0, 0, |
| 267 | doc: /* Stop the cpu profiler. The profiler log is not affected. */) | 267 | doc: /* Stop the cpu profiler. The profiler log is not affected. |
| 268 | Return non-nil if the profiler was running. */) | ||
| 268 | (void) | 269 | (void) |
| 269 | { | 270 | { |
| 270 | if (!profiler_cpu_running) | 271 | if (!profiler_cpu_running) |
| 271 | error ("Sample profiler is not running"); | 272 | return Qnil; |
| 272 | profiler_cpu_running = 0; | 273 | profiler_cpu_running = false; |
| 273 | 274 | ||
| 274 | setitimer (ITIMER_PROF, 0, 0); | 275 | setitimer (ITIMER_PROF, 0, 0); |
| 275 | 276 | ||
| @@ -332,7 +333,7 @@ See also `profiler-log-size' and `profiler-max-stack-depth'. */) | |||
| 332 | memory_log = make_log (profiler_log_size, | 333 | memory_log = make_log (profiler_log_size, |
| 333 | profiler_max_stack_depth); | 334 | profiler_max_stack_depth); |
| 334 | 335 | ||
| 335 | profiler_memory_running = 1; | 336 | profiler_memory_running = true; |
| 336 | 337 | ||
| 337 | return Qt; | 338 | return Qt; |
| 338 | } | 339 | } |
| @@ -340,13 +341,13 @@ See also `profiler-log-size' and `profiler-max-stack-depth'. */) | |||
| 340 | DEFUN ("profiler-memory-stop", | 341 | DEFUN ("profiler-memory-stop", |
| 341 | Fprofiler_memory_stop, Sprofiler_memory_stop, | 342 | Fprofiler_memory_stop, Sprofiler_memory_stop, |
| 342 | 0, 0, 0, | 343 | 0, 0, 0, |
| 343 | doc: /* Stop the memory profiler. The profiler log is not affected. */) | 344 | doc: /* Stop the memory profiler. The profiler log is not affected. |
| 345 | Return non-nil if the profiler was running. */) | ||
| 344 | (void) | 346 | (void) |
| 345 | { | 347 | { |
| 346 | if (!profiler_memory_running) | 348 | if (!profiler_memory_running) |
| 347 | error ("Memory profiler is not running"); | 349 | return Qnil; |
| 348 | profiler_memory_running = 0; | 350 | profiler_memory_running = false; |
| 349 | |||
| 350 | return Qt; | 351 | return Qt; |
| 351 | } | 352 | } |
| 352 | 353 | ||
| @@ -403,6 +404,7 @@ to make room for new entries. */); | |||
| 403 | profiler_log_size = 10000; | 404 | profiler_log_size = 10000; |
| 404 | 405 | ||
| 405 | #ifdef PROFILER_CPU_SUPPORT | 406 | #ifdef PROFILER_CPU_SUPPORT |
| 407 | profiler_cpu_running = false; | ||
| 406 | cpu_log = Qnil; | 408 | cpu_log = Qnil; |
| 407 | staticpro (&cpu_log); | 409 | staticpro (&cpu_log); |
| 408 | defsubr (&Sprofiler_cpu_start); | 410 | defsubr (&Sprofiler_cpu_start); |
| @@ -410,6 +412,7 @@ to make room for new entries. */); | |||
| 410 | defsubr (&Sprofiler_cpu_running_p); | 412 | defsubr (&Sprofiler_cpu_running_p); |
| 411 | defsubr (&Sprofiler_cpu_log); | 413 | defsubr (&Sprofiler_cpu_log); |
| 412 | #endif | 414 | #endif |
| 415 | profiler_memory_running = false; | ||
| 413 | memory_log = Qnil; | 416 | memory_log = Qnil; |
| 414 | staticpro (&memory_log); | 417 | staticpro (&memory_log); |
| 415 | defsubr (&Sprofiler_memory_start); | 418 | defsubr (&Sprofiler_memory_start); |