From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: A tip: how to display longer function names in profiler-report Date: Mon, 21 Dec 2020 21:24:52 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39846"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?iso-8859-1?Q?Cl=E9ment?= Pit-Claudel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 21 22:26:13 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krSh3-000AGt-LK for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Dec 2020 22:26:13 +0100 Original-Received: from localhost ([::1]:43488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krSh2-0001wv-NA for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Dec 2020 16:26:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krSfp-0001PX-Kw for emacs-devel@gnu.org; Mon, 21 Dec 2020 16:24:57 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:12704 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1krSfn-0003Gc-Lf for emacs-devel@gnu.org; Mon, 21 Dec 2020 16:24:57 -0500 Original-Received: (qmail 43761 invoked by uid 3782); 21 Dec 2020 21:24:52 -0000 Original-Received: from acm.muc.de (p4fe15b47.dip0.t-ipconnect.de [79.225.91.71]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Mon, 21 Dec 2020 22:24:52 +0100 Original-Received: (qmail 1099 invoked by uid 1000); 21 Dec 2020 21:24:52 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:261439 Archived-At: Hello, Clément. On Mon, Dec 21, 2020 at 15:24:06 -0500, Clément Pit-Claudel wrote: > On 12/21/20 11:32 AM, Alan Mackenzie wrote: > > Hello, Emacs. > > It's annoyed me for a long time that profiler-report wastes so much > > horizontal screen space, and truncates function names horribly. And > > that's in CC Mode, which has a very short package prefix, "c-". > I think the best fix would be to put the CPU samples and % columns > first instead of last, and put the function name column last, with no > limits on how far to the right it might expand. That's an utterly brilliant idea! Thanks! Something like, very roughly: .... diff --git a/lisp/profiler.el b/lisp/profiler.el index bf8aacccc3..20486da29b 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -445,9 +445,10 @@ profiler-report-leaf-mark :group 'profiler) (defvar profiler-report-cpu-line-format - '((50 left) - (24 right ((19 right) - (5 right))))) + '((24 right ((19 right) + (5 right))) + (90 left)) + ) (defvar profiler-report-memory-line-format '((55 left) @@ -505,13 +512,14 @@ profiler-report-line-format (profiler-format (cl-ecase (profiler-profile-type profiler-report-profile) (cpu profiler-report-cpu-line-format) (memory profiler-report-memory-line-format)) - name-part (if diff-p (list (if (> count 0) (format "+%s" count) count) "") - (list count count-percent))))) + (list count count-percent)) + name-part + ))) (defun profiler-report-insert-calltree (tree) (let ((line (profiler-report-line-format tree))) @@ -735,7 +748,8 @@ profiler-report-describe-entry (cpu (profiler-report-header-line-format profiler-report-cpu-line-format - "Function" (list "CPU samples" "%"))) + (list "CPU samples" "%") "Function" + )) (memory (profiler-report-header-line-format profiler-report-memory-line-format -- Alan Mackenzie (Nuremberg, Germany).