From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#20843: 24.5; Profiler error: "Invalid sampling interval" Date: Mon, 22 Jun 2015 14:04:50 -0400 Message-ID: <55884E42.607@cornell.edu> References: <83k2v1l7g4.fsf@gnu.org> <5585B8C4.1050204@cornell.edu> <83r3p6i4b1.fsf@gnu.org> <5585DF69.7090008@cornell.edu> <83oak9hzzs.fsf@gnu.org> <558737F7.4080709@cornell.edu> <83r3p3hi22.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1434996387 18111 80.91.229.3 (22 Jun 2015 18:06:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Jun 2015 18:06:27 +0000 (UTC) Cc: sva-news@mygooglest.com, 20843@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 22 20:06:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z766o-0002vU-Jg for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Jun 2015 20:06:14 +0200 Original-Received: from localhost ([::1]:41423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z766n-0004tE-UU for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Jun 2015 14:06:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z766g-0004nB-Do for bug-gnu-emacs@gnu.org; Mon, 22 Jun 2015 14:06:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z766d-00042E-7J for bug-gnu-emacs@gnu.org; Mon, 22 Jun 2015 14:06:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z766c-00041e-Sw for bug-gnu-emacs@gnu.org; Mon, 22 Jun 2015 14:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z766c-00029r-6L for bug-gnu-emacs@gnu.org; Mon, 22 Jun 2015 14:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jun 2015 18:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20843 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20843-submit@debbugs.gnu.org id=B20843.14349963508262 (code B ref 20843); Mon, 22 Jun 2015 18:06:02 +0000 Original-Received: (at 20843) by debbugs.gnu.org; 22 Jun 2015 18:05:50 +0000 Original-Received: from localhost ([127.0.0.1]:54693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z766O-00029A-Ow for submit@debbugs.gnu.org; Mon, 22 Jun 2015 14:05:49 -0400 Original-Received: from limerock04.mail.cornell.edu ([128.84.13.244]:49031) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z766M-00028x-4M for 20843@debbugs.gnu.org; Mon, 22 Jun 2015 14:05:47 -0400 X-CornellRouted: This message has been Routed already. Original-Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock04.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id t5MI5eSW032412; Mon, 22 Jun 2015 14:05:40 -0400 Original-Received: from [172.17.41.121] (cpe-104-229-84-227.twcny.res.rr.com [104.229.84.227]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id t5MI4vQq003993 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 22 Jun 2015 14:05:21 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <83r3p3hi22.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:104233 Archived-At: On 6/22/2015 11:35 AM, Eli Zaretskii wrote: >> Date: Sun, 21 Jun 2015 18:17:27 -0400 >> From: Ken Brown >> CC: sva-news@mygooglest.com, 20843@debbugs.gnu.org >> >>> 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