* Patch: Elevate elp--instrumented-p to public API
@ 2021-10-04 14:21 Arthur Miller
2021-10-04 16:16 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Arthur Miller @ 2021-10-04 14:21 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
For a tooling purpose I would like to have check whether a function is
profiler instrumented or not. Such is already included in ELP, but it seems to
prefixed as a private to elp.el. Suggested patch prefixes it as a public API,
adds some rudimentary doc and changes all callers to use new name. There seems
to be no callers outside of elp.el.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ELP-Rename-Instrumented-Predicate.patch --]
[-- Type: text/x-patch, Size: 2442 bytes --]
From 6d3c3a37f70307110dfb7ad83f773e1689430483 Mon Sep 17 00:00:00 2001
From: Arthur Miller <arthur.miller@live.com>
Date: Mon, 4 Oct 2021 16:01:52 +0200
Subject: [PATCH 2/2] ELP Rename Instrumented Predicate
* lisp/emacs-lisp/elp.el (elp--instrumented-p): Add docs.
Renamed 'elp--instrumented-p' to 'elp-instrumented-p'.
Update all callers to use renamed function.
---
lisp/emacs-lisp/elp.el | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index 8c33b7c994..891f58582a 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -251,8 +251,9 @@ elp-instrument-function
(advice-add funsym :around (elp--make-wrapper funsym)
`((name . ,elp--advice-name) (depth . -99)))))
-(defun elp--instrumented-p (sym)
- (advice-member-p elp--advice-name sym))
+(defun elp-instrumented-p (symbol)
+ "Whether SYMBOL is instrumented for emacs lisp profiler."
+ (advice-member-p elp--advice-name symbol))
(defun elp-restore-function (funsym)
"Restore an instrumented function to its original definition.
@@ -261,7 +262,7 @@ elp-restore-function
(list
(intern
(completing-read "Function to restore: " obarray
- #'elp--instrumented-p t))))
+ #'elp-instrumented-p t))))
;; If the function was the master, reset the master.
(if (eq funsym elp-master)
(setq elp-master nil
@@ -342,12 +343,12 @@ elp-set-master
(intern
(let ((default (if elp-master (symbol-name elp-master))))
(completing-read (format-prompt "Master function" default)
- obarray #'elp--instrumented-p t nil nil default)))))
+ obarray #'elp-instrumented-p t nil nil default)))))
;; When there's a master function, recording is turned off by default.
(setq elp-master funsym
elp-record-p nil)
;; Make sure master function is instrumented.
- (or (elp--instrumented-p funsym)
+ (or (elp-instrumented-p funsym)
(elp-instrument-function funsym)))
(defun elp-unset-master ()
@@ -516,7 +517,7 @@ elp-results
) ; end let*
(mapatoms
(lambda (funsym)
- (when (elp--instrumented-p funsym)
+ (when (elp-instrumented-p funsym)
(let* ((info (get funsym elp-timer-info-property))
(symname (format "%s" funsym))
(cc (aref info 0))
--
2.33.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Patch: Elevate elp--instrumented-p to public API
2021-10-04 14:21 Patch: Elevate elp--instrumented-p to public API Arthur Miller
@ 2021-10-04 16:16 ` Stefan Monnier
2021-10-04 19:29 ` Arthur Miller
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2021-10-04 16:16 UTC (permalink / raw)
To: Arthur Miller; +Cc: emacs-devel
Arthur Miller [2021-10-04 16:21:39] wrote:
> For a tooling purpose I would like to have check whether a function is
> profiler instrumented or not. Such is already included in ELP, but it seems to
> prefixed as a private to elp.el. Suggested patch prefixes it as a public API,
> adds some rudimentary doc and changes all callers to use new name. There seems
> to be no callers outside of elp.el.
What's the concrete use case?
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Patch: Elevate elp--instrumented-p to public API
2021-10-04 16:16 ` Stefan Monnier
@ 2021-10-04 19:29 ` Arthur Miller
0 siblings, 0 replies; 3+ messages in thread
From: Arthur Miller @ 2021-10-04 19:29 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Arthur Miller [2021-10-04 16:21:39] wrote:
>> For a tooling purpose I would like to have check whether a function is
>> profiler instrumented or not. Such is already included in ELP, but it seems to
>> prefixed as a private to elp.el. Suggested patch prefixes it as a public API,
>> adds some rudimentary doc and changes all callers to use new name. There seems
>> to be no callers outside of elp.el.
>
> What's the concrete use case?
See the answer in patch about debug instrumentation, reason is the same for all
three patches.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-04 19:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-04 14:21 Patch: Elevate elp--instrumented-p to public API Arthur Miller
2021-10-04 16:16 ` Stefan Monnier
2021-10-04 19:29 ` Arthur Miller
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.