diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/profiler.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/profiler.c b/src/profiler.c index 12d75012c79..f421eb52b31 100644 --- a/src/profiler.c +++ b/src/profiler.c | |||
| @@ -534,7 +534,11 @@ DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log, | |||
| 534 | The log is a hash-table mapping backtraces to counters which represent | 534 | The log is a hash-table mapping backtraces to counters which represent |
| 535 | the amount of time spent at those points. Every backtrace is a vector | 535 | the amount of time spent at those points. Every backtrace is a vector |
| 536 | of functions, where the last few elements may be nil. | 536 | of functions, where the last few elements may be nil. |
| 537 | Before returning, a new log is allocated for future samples. */) | 537 | |
| 538 | If the profiler has not run since the last invocation of | ||
| 539 | `profiler-cpu-log' (or was never run at all), return nil. If the | ||
| 540 | profiler is currently running, allocate a new log for future samples | ||
| 541 | before returning. */) | ||
| 538 | (void) | 542 | (void) |
| 539 | { | 543 | { |
| 540 | /* Temporarily stop profiling to avoid it interfering with our data | 544 | /* Temporarily stop profiling to avoid it interfering with our data |
| @@ -556,6 +560,7 @@ Before returning, a new log is allocated for future samples. */) | |||
| 556 | static Lisp_Object | 560 | static Lisp_Object |
| 557 | export_log (struct profiler_log *plog) | 561 | export_log (struct profiler_log *plog) |
| 558 | { | 562 | { |
| 563 | if (!plog->log) return Qnil; | ||
| 559 | log_t *log = plog->log; | 564 | log_t *log = plog->log; |
| 560 | /* The returned hash table uses `equal' as key equivalence predicate | 565 | /* The returned hash table uses `equal' as key equivalence predicate |
| 561 | which is more discriminating than the `function-equal' used by | 566 | which is more discriminating than the `function-equal' used by |
| @@ -639,7 +644,11 @@ DEFUN ("profiler-memory-log", | |||
| 639 | The log is a hash-table mapping backtraces to counters which represent | 644 | The log is a hash-table mapping backtraces to counters which represent |
| 640 | the amount of memory allocated at those points. Every backtrace is a vector | 645 | the amount of memory allocated at those points. Every backtrace is a vector |
| 641 | of functions, where the last few elements may be nil. | 646 | of functions, where the last few elements may be nil. |
| 642 | Before returning, a new log is allocated for future samples. */) | 647 | |
| 648 | If the profiler has not run since the last invocation of | ||
| 649 | `profiler-memory-log' (or was never run at all), return nil. If the | ||
| 650 | profiler is currently running, allocate a new log for future samples | ||
| 651 | before returning. */) | ||
| 643 | (void) | 652 | (void) |
| 644 | { | 653 | { |
| 645 | bool prof_mem = profiler_memory_running; | 654 | bool prof_mem = profiler_memory_running; |