emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master ca2b47f 240/272: Add timing information to async commands


From: Oleh Krehel
Subject: [elpa] master ca2b47f 240/272: Add timing information to async commands
Date: Mon, 25 Apr 2016 10:13:28 +0000

branch: master
commit ca2b47fb7a37934f40327ab9b1d0e9951e7d2d5b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Add timing information to async commands
    
    * counsel.el (counsel--async-start):
    (counsel--async-duration): New defvar.
    (counsel--async-command): (re) set `counsel--async-start'.
    (counsel--async-sentinel): recompute `counsel--async-duration'.
    
    Useful to see how long last query took to process.
---
 counsel.el |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/counsel.el b/counsel.el
index 6a657b7..b5506a0 100644
--- a/counsel.el
+++ b/counsel.el
@@ -81,6 +81,14 @@
   "Store the time when a new process was started.
 Or the time of the last minibuffer update.")
 
+(defvar counsel--async-start nil
+  "Store the time when a new process was started.
+Or the time of the last minibuffer update.")
+
+(defvar counsel--async-duration nil
+  "Store the time in seconds between starting a process and
+  receiving all candidates.")
+
 (defvar counsel--async-exit-code-plist nil
   "Associates exit codes with reasons.")
 
@@ -108,7 +116,8 @@ Or the time of the last minibuffer update.")
                 counsel--process
                 counsel--process
                 cmd))
-    (setq counsel--async-time (current-time))
+    (setq counsel--async-start
+          (setq counsel--async-time (current-time)))
     (set-process-sentinel proc (or process-sentinel #'counsel--async-sentinel))
     (set-process-filter proc (or process-filter #'counsel--async-filter))))
 
@@ -132,6 +141,8 @@ Or the time of the last minibuffer update.")
            (ivy--set-candidates
             (ivy--sort-maybe
              cands))
+           (setq counsel--async-duration
+                 (time-to-seconds (time-since counsel--async-start)))
            (let ((re (funcall ivy--regex-function ivy-text)))
              (unless (stringp re)
                (setq re (caar re)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]