branch: elpa/pacmacs
commit b0bc866a7bb05bd40d53cac7419db02ef1f765be
Author: rexim <[email protected]>
Commit: rexim <[email protected]>
Measure tick time during replay (#122)
---
pacmacs-utils.el | 6 ++++++
tools/it-recorder.el | 9 +++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/pacmacs-utils.el b/pacmacs-utils.el
index eccf32542f..2c14345a2f 100644
--- a/pacmacs-utils.el
+++ b/pacmacs-utils.el
@@ -76,6 +76,12 @@ side-effects."
(when (string-match "\\(map[0-9]+\\)\\.txt" filename)
(match-string 1 filename)))
+(defmacro pacmacs--measure-time (&rest body)
+ "Measure the time it takes to evaluate BODY."
+ `(let ((time (current-time)))
+ ,@body
+ (float-time (time-since time))))
+
(provide 'pacmacs-utils)
;;; pacmacs.el ends here
diff --git a/tools/it-recorder.el b/tools/it-recorder.el
index f96611e992..8570a505ac 100644
--- a/tools/it-recorder.el
+++ b/tools/it-recorder.el
@@ -6,6 +6,7 @@
(defvar pacmacs--tick-counter 0)
(defvar pacmacs--recorded-actions nil)
+(defvar pacmacs--tick-times nil)
(defun pacmacs--record-action (action-name)
(add-to-list 'pacmacs--recorded-actions
@@ -56,7 +57,10 @@
(defun pacmacs-replay-tick ()
(cl-incf pacmacs--tick-counter)
- (pacmacs-tick)
+
+ (add-to-list 'pacmacs--tick-times
+ (pacmacs--measure-time
+ (pacmacs-tick)))
(if (not pacmacs--recorded-actions)
(pacmacs-quit)
@@ -83,4 +87,5 @@
(pacmacs-mode)
(setq pacmacs--recorded-actions (pacmacs--load-test-case filename))
- (setq pacmacs--tick-counter 0))
+ (setq pacmacs--tick-counter 0)
+ (setq pacmacs--tick-times nil))