diff options
author | Tomohiro Matsuyama <tomo@cx4a.org> | 2012-10-01 07:21:25 +0900 |
---|---|---|
committer | Tomohiro Matsuyama <tomo@cx4a.org> | 2012-10-01 07:21:25 +0900 |
commit | c22bac2cc59c6c04924ecf62c5eeb97a92df7e28 (patch) | |
tree | 707758235e762854e17742bbbcc737687b85e457 /src/profiler.c | |
parent | 5e4daaf3face7ed54de7cb3621edb31e16b011ed (diff) | |
download | emacs-c22bac2cc59c6c04924ecf62c5eeb97a92df7e28.tar.gz |
* profiler.el (profiler-sampling-interval): Rename from
profiler-sample-interval.
(profiler-sampling-interval): Default to 10.
(profiler-find-profile): New command (was profiler-find-log).
(profiler-find-profile-other-window): New command.
(profiler-find-profile-other-frame): New command.
(profiler-profile): Introduce API-level data structure.
Diffstat (limited to 'src/profiler.c')
-rw-r--r-- | src/profiler.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/profiler.c b/src/profiler.c index de118d13859..2f082edc390 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -198,7 +198,7 @@ record_backtrace (log_t *log, EMACS_INT count) } } -/* Sample profiler. */ +/* Sampling profiler. */ #ifdef PROFILER_CPU_SUPPORT @@ -220,10 +220,10 @@ static Lisp_Object cpu_log; /* Separate counter for the time spent in the GC. */ static EMACS_INT cpu_gc_count; -/* The current sample interval in milliseconds. */ -static EMACS_INT current_sample_interval; +/* The current sampling interval in milliseconds. */ +static EMACS_INT current_sampling_interval; -/* Signal handler for sample profiler. */ +/* Signal handler for sampling profiler. */ static void handle_profiler_signal (int signal) @@ -235,11 +235,11 @@ handle_profiler_signal (int signal) not expect the ARRAY_MARK_FLAG to be set. We could try and harden the hash-table code, but it doesn't seem worth the effort. */ - cpu_gc_count = saturated_add (cpu_gc_count, current_sample_interval); + cpu_gc_count = saturated_add (cpu_gc_count, current_sampling_interval); else { eassert (HASH_TABLE_P (cpu_log)); - record_backtrace (XHASH_TABLE (cpu_log), current_sample_interval); + record_backtrace (XHASH_TABLE (cpu_log), current_sampling_interval); } } @@ -250,21 +250,21 @@ deliver_profiler_signal (int signal) } static enum profiler_cpu_running -setup_cpu_timer (Lisp_Object sample_interval) +setup_cpu_timer (Lisp_Object sampling_interval) { struct sigaction action; struct itimerval timer; struct timespec interval; - if (! RANGED_INTEGERP (1, sample_interval, + if (! RANGED_INTEGERP (1, sampling_interval, (TYPE_MAXIMUM (time_t) < EMACS_INT_MAX / 1000 ? (EMACS_INT) TYPE_MAXIMUM (time_t) * 1000 + 999 : EMACS_INT_MAX))) return NOT_RUNNING; - current_sample_interval = XINT (sample_interval); - interval = make_emacs_time (current_sample_interval / 1000, - current_sample_interval % 1000 * 1000000); + current_sampling_interval = XINT (sampling_interval); + interval = make_emacs_time (current_sampling_interval / 1000, + current_sampling_interval % 1000 * 1000000); emacs_sigaction_init (&action, deliver_profiler_signal); sigaction (SIGPROF, &action, 0); @@ -315,12 +315,12 @@ setup_cpu_timer (Lisp_Object sample_interval) DEFUN ("profiler-cpu-start", Fprofiler_cpu_start, Sprofiler_cpu_start, 1, 1, 0, doc: /* Start or restart the cpu profiler. -It takes call-stack samples each SAMPLE-INTERVAL milliseconds. +It takes call-stack samples each SAMPLING-INTERVAL milliseconds. See also `profiler-log-size' and `profiler-max-stack-depth'. */) - (Lisp_Object sample_interval) + (Lisp_Object sampling_interval) { if (profiler_cpu_running) - error ("Sample profiler is already running"); + error ("CPU profiler is already running"); if (NILP (cpu_log)) { @@ -329,9 +329,9 @@ See also `profiler-log-size' and `profiler-max-stack-depth'. */) profiler_max_stack_depth); } - profiler_cpu_running = setup_cpu_timer (sample_interval); + profiler_cpu_running = setup_cpu_timer (sampling_interval); if (! profiler_cpu_running) - error ("Invalid sample interval"); + error ("Invalid sampling interval"); return Qt; } |