bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20843: 24.5; Profiler error: "Invalid sampling interval"


From: Ken Brown
Subject: bug#20843: 24.5; Profiler error: "Invalid sampling interval"
Date: Mon, 22 Jun 2015 14:04:50 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0



On 6/22/2015 11:35 AM, Eli Zaretskii wrote:
Date: Sun, 21 Jun 2015 18:17:27 -0400
From: Ken Brown <address@hidden>
CC: address@hidden, address@hidden

If so, we cannot test this at
configure time, because it means we will have to run a program, which
is not a good idea.

So in that case, I think we should simply disable the CPU profiler on
Cygwin using "#ifndef __CYGWIN__" or some such.

Done as commit 5fac0de.

Thanks.

   Also, the diagnostics should be improved, as the
wording is misleading in that case.

As it stands, profiler-cpu-start reports "Invalid sampling interval"
whenever setup_cpu_timer fails to start the timer, regardless of the
reason.  I'll try to improve this.

Yes, please.

How's this:

Looks fine, but perhaps it would be cleaner to return the actual
message string or some distinctive code from setup_cpu_timer.  This
would avoid the need for a global variable.

Is this better?

--- a/src/profiler.c
+++ b/src/profiler.c
@@ -250,7 +250,7 @@ deliver_profiler_signal (int signal)
   deliver_process_signal (signal, handle_profiler_signal);
 }

-static enum profiler_cpu_running
+static int
 setup_cpu_timer (Lisp_Object sampling_interval)
 {
   struct sigaction action;
@@ -263,7 +263,7 @@ setup_cpu_timer (Lisp_Object sampling_interval)
                          ? ((EMACS_INT) TYPE_MAXIMUM (time_t) * billion
                             + (billion - 1))
                          : EMACS_INT_MAX)))
-    return NOT_RUNNING;
+    return -1;

   current_sampling_interval = XINT (sampling_interval);
   interval = make_timespec (current_sampling_interval / billion,
@@ -336,9 +336,18 @@ See also `profiler-log-size' and `profiler-max-stack-depth'. */)
                          profiler_max_stack_depth);
     }

-  profiler_cpu_running = setup_cpu_timer (sampling_interval);
-  if (! profiler_cpu_running)
-    error ("Invalid sampling interval");
+  int status = setup_cpu_timer (sampling_interval);
+  if (status == -1)
+    {
+      profiler_cpu_running = NOT_RUNNING;
+      error ("Invalid sampling interval");
+    }
+  else
+    {
+      profiler_cpu_running = status;
+      if (! profiler_cpu_running)
+       error ("Unable to start profiler timer");
+    }

   return Qt;
 }

Ken





reply via email to

[Prev in Thread] Current Thread [Next in Thread]