From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vasilij Schneidermann Newsgroups: gmane.emacs.bugs Subject: bug#22114: 24.5; [PATCH] Allow profiler.el to display reports after stopping Date: Tue, 8 Dec 2015 20:15:23 +0100 Message-ID: <20151208191523.GB19310@odonien.bevuta.com> References: <83bna0di5k.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="gBBFr7Ir9EOA20Yy" X-Trace: ger.gmane.org 1449602182 11661 80.91.229.3 (8 Dec 2015 19:16:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Dec 2015 19:16:22 +0000 (UTC) Cc: 22114@debbugs.gnu.org To: Eli Zaretskii , John Wiegley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 08 20:16:11 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 1a6NkB-0003Q7-2C for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Dec 2015 20:16:11 +0100 Original-Received: from localhost ([::1]:33156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6NkA-0005G5-7l for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Dec 2015 14:16:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Nk6-0005Fs-7q for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 14:16:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6Nk2-0006O0-1I for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 14:16:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Nk1-0006Nu-VG for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 14:16:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1a6Nk1-0004aS-PA for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 14:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Vasilij Schneidermann Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2015 19:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22114 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 22114-submit@debbugs.gnu.org id=B22114.144960215417603 (code B ref 22114); Tue, 08 Dec 2015 19:16:01 +0000 Original-Received: (at 22114) by debbugs.gnu.org; 8 Dec 2015 19:15:54 +0000 Original-Received: from localhost ([127.0.0.1]:43678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6Nju-0004Zp-8H for submit@debbugs.gnu.org; Tue, 08 Dec 2015 14:15:54 -0500 Original-Received: from mail-wm0-f41.google.com ([74.125.82.41]:34000) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6NjR-0004Ys-NX for 22114@debbugs.gnu.org; Tue, 08 Dec 2015 14:15:53 -0500 Original-Received: by wmvv187 with SMTP id v187so228039476wmv.1 for <22114@debbugs.gnu.org>; Tue, 08 Dec 2015 11:15:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=g8FnCr/WVg4LuRgXNKYC5BaqZccryDKSSiAhGj6Rwek=; b=hTPYtGp7zReazTH4PQhxq4lz5bFFEvhC0ADRUy/tabK1nuxGitAglh+VXSFmNWVugL bXow1j7CYma1xGQeFHtfpTh4JJQ7yPbPaUeWyrc0l50KzahL/kILbf89es8wIRIXo0+p 1thW7c7VoauByKyvxQgUyYto9L71SgsTMtHx8NUC7u8IgNhozM+ETOIik6lhVzTb31ln gJ/OQ+G1OM5PnRAB8j1//2MXBaz1Y8qMs4OniNRGdrPkv+Tz+SiVTpE8lLHN7gJtE8uR ZCfEiA7BXTq9fklz4BWRTzKIj0OUKZEDssHBgsidApnX0q6vSX8GAb+FPF676CdfaKlV E2Tg== X-Received: by 10.28.156.75 with SMTP id f72mr30403397wme.91.1449602125039; Tue, 08 Dec 2015 11:15:25 -0800 (PST) Original-Received: from localhost (port-92-204-65-240.dynamic.qsc.de. [92.204.65.240]) by smtp.gmail.com with ESMTPSA id z13sm4200598wjr.47.2015.12.08.11.15.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Dec 2015 11:15:24 -0800 (PST) Content-Disposition: inline In-Reply-To: <83bna0di5k.fsf@gnu.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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: 208.118.235.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:109791 Archived-At: --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=utf-8 Content-Disposition: inline > I prefer to solve the problem rather than work around it. I'm not sure I'm understanding this correctly. How is your suggestion of just removing the check for whether the profiler is running not a workaround? The only way I see of solving this without extra code in the frontend is by fixing the underlying C code, but you've confirmed that this is not an option. At least not without restructuring profiler.c heavily. To prove that I'm not the crazy one here, I've written two example programs in Ruby (with ruby-prof) and Python (with cProfile). Both of them calculate a Fibonacci number in a profiler run, then display the recorded data. You can easily verify that the profiler behaves idempotently and does not just discard data on a whim by editing these. This does make a lot of sense if you consider that profiling data is precious and would make sure it isn't easily lost unless someone intentionally discards it. I've been told by others that other tools like gprof, perf and callgrind don't reset either, therefore my conclusion on the topic is that Emacs is the odd one in this group. Considering that this problem hasn't been reported before, I doubt anyone has been using the profiler seriously and this change will not disrupt anyone's workflow (which would need to be weird anyways because the only user-visible part that did change is that stopping doesn't prevent you from viewing a profiler run). --gBBFr7Ir9EOA20Yy Content-Type: application/x-ruby Content-Disposition: attachment; filename="profile.rb" Content-Transfer-Encoding: quoted-printable require 'ruby-prof'=0A=0Adef fib(n)=0A if n =3D=3D 0=0A 0=0A elsif n = =3D=3D 1=0A 1=0A else=0A fib(n-1) + fib(n-2)=0A end=0Aend=0A=0ARuby= Prof.start=0Afib(30)=0Alog =3D RubyProf.stop=0A=0Aprinter =3D RubyProf::Fla= tPrinter.new(log)=0Aprinter.print(STDOUT)=0A --gBBFr7Ir9EOA20Yy Content-Type: text/x-python; charset=utf-8 Content-Disposition: attachment; filename="profile.py" import cProfile, pstats, io def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2) pr = cProfile.Profile() pr.enable() fib(30) pr.disable() s= io.StringIO() sortby = 'cumulative' ps = pstats.Stats(pr, stream=s).sort_stats(sortby) ps.print_stats() print(s.getvalue()) --gBBFr7Ir9EOA20Yy--