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 22:09:10 +0000 Message-ID: References: <63c6196a-319b-f436-4f8f-14b6719f90de@gmail.com> 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="29867"; 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 23:10:11 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 1krTNb-0007h8-Iu for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Dec 2020 23:10:11 +0100 Original-Received: from localhost ([::1]:36588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krTNa-0004uF-K0 for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Dec 2020 17:10:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krTMh-0004Qk-8s for emacs-devel@gnu.org; Mon, 21 Dec 2020 17:09:15 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:14327 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1krTMf-0001bF-90 for emacs-devel@gnu.org; Mon, 21 Dec 2020 17:09:15 -0500 Original-Received: (qmail 70654 invoked by uid 3782); 21 Dec 2020 22:09:10 -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 23:09:10 +0100 Original-Received: (qmail 1364 invoked by uid 1000); 21 Dec 2020 22:09:10 -0000 Content-Disposition: inline In-Reply-To: <63c6196a-319b-f436-4f8f-14b6719f90de@gmail.com> 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:261443 Archived-At: Hello again, Clément. On Mon, Dec 21, 2020 at 16:34:10 -0500, Clément Pit-Claudel wrote: > On 12/21/20 4:24 PM, Alan Mackenzie wrote: > > Something like, very roughly: .... > Precisely :) Love it. And we can even remove the padding spaces from the last column. Indeed, why not? The following is close, but hasn't yet tested the other sort of profiling ("memory", I think), and the headings aren't 100% yet. But see what you think! diff --git a/lisp/profiler.el b/lisp/profiler.el index bf8aacccc3..6fbcad3009 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -85,6 +85,9 @@ profiler-format (t (profiler-ensure-string arg))) for len = (length str) + if (zerop width) + collect str into frags + else if (< width len) collect (progn (put-text-property (max 0 (- width 2)) len 'invisible 'profiler str) @@ -445,9 +448,10 @@ profiler-report-leaf-mark :group 'profiler) (defvar profiler-report-cpu-line-format - '((50 left) - (24 right ((19 right) - (5 right))))) + '((14 right ((9 right) + (5 right))) + (1 left "%s") + (0 left))) (defvar profiler-report-memory-line-format '((55 left) @@ -505,13 +509,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 +740,7 @@ profiler-report-describe-entry (cpu (profiler-report-header-line-format profiler-report-cpu-line-format - "Function" (list "CPU samples" "%"))) + (list "Samples" "%") " " "Function")) (memory (profiler-report-header-line-format profiler-report-memory-line-format -- Alan Mackenzie (Nuremberg, Germany).