(defun sanityinc/time-subtract-millis (b a)
  (* 1000.0 (float-time (time-subtract b a))))


(defvar sanityinc/require-times nil
  "A list of (FEATURE . LOAD-DURATION).
LOAD-DURATION is the time taken in milliseconds to load FEATURE.")

(defadvice require
  (around build-require-times (feature &optional filename noerror) activate)
  "Note in `sanityinc/require-times' the time taken to require each feature."
  (let* ((already-loaded (memq feature features))
         (require-start-time (and (not already-loaded) (current-time))))
    (prog1
        ad-do-it
      (when (and (not already-loaded) (memq feature features))
        (add-to-list 'sanityinc/require-times
                     (cons feature
                           (sanityinc/time-subtract-millis (current-time)
                                                           require-start-time))
                     t)))))



(provide 'init-benchmarking)

(defun sanityinc/time-subtract-millis (b a)
  (* 1000.0 (float-time (time-subtract b a))))


(defvar sanityinc/require-times nil
  "A list of (FEATURE . LOAD-DURATION).
LOAD-DURATION is the time taken in milliseconds to load FEATURE.")

(defadvice require (around sanityinc/build-require-times (feature &optional filename noerror) activate)
  "Note in `sanityinc/require-times' the time taken to require each feature."
  (let* ((already-loaded (memq feature features))
         (require-start-time (and (not already-loaded) (current-time))))
    (prog1
        ad-do-it
      (when (and (not already-loaded) (memq feature features))
        (let ((time (sanityinc/time-subtract-millis (current-time) require-start-time)))
          (add-to-list 'sanityinc/require-times
                       (cons feature time)
                       t))))))



(provide 'init-benchmarking)

Tidy up the require-times benchmarking advice
Tidy up the require-times benchmarking advice

mmqmzk/emacs.d,benkha/emacs.d,baohaojun/emacs.d,emuio/emacs.d,jkaessens/emacs.d,cyjia/emacs.d,Werewolflsp/emacs.d,svenyurgensson/emacs.d,cjqw/emacs.d,arthurl/emacs.d,ernest-dzf/emacs.d,LKI/emacs.d,kindoblue/emacs.d,blueabysm/emacs.d,Shanicky/emacs.d,qinshulei/emacs.d,dcorking/emacs.d,qianwan/emacs.d,blueseason/emacs.d,wegatron/emacs.d,Enzo-Liu/emacs.d,zhuoyikang/emacs.d,jhpx/emacs.d,braveoyster/emacs.d,purcell/emacs.d,kongfy/emacs.d,roxolan/emacs.d,lujianmei/emacs.d,46do14/emacs.d,sgarciac/emacs.d,zhaotai/.emacs.d,gsmlg/emacs.d,lust4life/emacs.d,zenith-john/emacs.d,fengxl/emacs.d,krzysz00/emacs.d,me020523/emacs.d