-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinit-ad.el
25 lines (22 loc) · 918 Bytes
/
init-ad.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;; advice of load function
(defadvice load (around require-benchmark activate)
(let* ((before (current-time))
(result ad-do-it)
(after (current-time))
(time (+ (* (- (nth 1 after) (nth 1 before)) 1000.0)
(/ (- (nth 2 after) (nth 2 before)) 1000.0)))
(arg (ad-get-arg 0)))
(message "--- %04d [ms]: (loading) %s" time arg)))
;; advice of require function
(defadvice require (around require-benchmark activate)
"http://memo.sugyan.com/entry/20120105/1325756767"
(let* ((before (current-time))
(result ad-do-it)
(after (current-time))
(time (+ (* (- (nth 1 after) (nth 1 before)) 1000.0)
(/ (- (nth 2 after) (nth 2 before)) 1000.0)))
(arg (ad-get-arg 0)))
(unless (or (memq arg '(cl-lib macroexp))
(> 0.1 time))
(message "--- %04d [ms]: %s" time arg))))
(provide 'init-ad)