aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Brown2015-06-22 15:26:44 -0400
committerKen Brown2015-06-22 15:26:44 -0400
commitdc30fb9247d5d9d98ae1c3501d3ffa90e2001a46 (patch)
tree936b1c717c4576558a54387777d033933d077fdc /src
parent567bf811dc83d4e2a770f602fc70df0874aa02e4 (diff)
downloademacs-dc30fb9247d5d9d98ae1c3501d3ffa90e2001a46.tar.gz
emacs-dc30fb9247d5d9d98ae1c3501d3ffa90e2001a46.zip
Improve diagnostics of profiler-cpu-start
* src/profiler.c (setup_cpu_timer): Change return type to 'int'; return -1 if the sampling interval is invalid. (Fprofiler_cpu_start): Improve error message if 'setup_cpu_timer' fails. (Bug#20843)
Diffstat (limited to 'src')
-rw-r--r--src/profiler.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/profiler.c b/src/profiler.c
index 1b49afe0331..185382c5bd8 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -250,7 +250,7 @@ deliver_profiler_signal (int signal)
250 deliver_process_signal (signal, handle_profiler_signal); 250 deliver_process_signal (signal, handle_profiler_signal);
251} 251}
252 252
253static enum profiler_cpu_running 253static int
254setup_cpu_timer (Lisp_Object sampling_interval) 254setup_cpu_timer (Lisp_Object sampling_interval)
255{ 255{
256 struct sigaction action; 256 struct sigaction action;
@@ -263,7 +263,7 @@ setup_cpu_timer (Lisp_Object sampling_interval)
263 ? ((EMACS_INT) TYPE_MAXIMUM (time_t) * billion 263 ? ((EMACS_INT) TYPE_MAXIMUM (time_t) * billion
264 + (billion - 1)) 264 + (billion - 1))
265 : EMACS_INT_MAX))) 265 : EMACS_INT_MAX)))
266 return NOT_RUNNING; 266 return -1;
267 267
268 current_sampling_interval = XINT (sampling_interval); 268 current_sampling_interval = XINT (sampling_interval);
269 interval = make_timespec (current_sampling_interval / billion, 269 interval = make_timespec (current_sampling_interval / billion,
@@ -336,9 +336,18 @@ See also `profiler-log-size' and `profiler-max-stack-depth'. */)
336 profiler_max_stack_depth); 336 profiler_max_stack_depth);
337 } 337 }
338 338
339 profiler_cpu_running = setup_cpu_timer (sampling_interval); 339 int status = setup_cpu_timer (sampling_interval);
340 if (! profiler_cpu_running) 340 if (status == -1)
341 error ("Invalid sampling interval"); 341 {
342 profiler_cpu_running = NOT_RUNNING;
343 error ("Invalid sampling interval");
344 }
345 else
346 {
347 profiler_cpu_running = status;
348 if (! profiler_cpu_running)
349 error ("Unable to start profiler timer");
350 }
342 351
343 return Qt; 352 return Qt;
344} 353}