     (let ((start (current-time)) res delta)
       (setq res ad-do-it
             delta (float-time (time-since start)))
-      (when (> delta spacemacs-load-time-threshold)
+      (when (> delta spacemacs-debug-timer-threshold)
         (with-current-buffer "*load-times*"
           (goto-char (point-max))
           (insert (format "File %s: Loaded %s: %.3f sec\n"
                           load-file-name (ad-get-arg 0) delta))))
       res)))
 
+(when spacemacs-debug-with-adv-timers
+  (with-current-buffer (get-buffer-create "*load-times*")
+    (insert (format "Measured times greater than %.3f sec:\n\n"
+                    spacemacs-debug-timer-threshold)))
+
+  (add-hook 'after-init-hook
+            (lambda ()
+              (with-current-buffer "*load-times*"
+                (goto-char (point-max))
+                (insert (format "[%.3f] Spacemacs finished initializing\n\n"
+                                (float-time (time-since emacs-start-time)) )))))
+
+  (advice-add 'load :around #'spacemacs//load-timer)
+  (advice-add 'require :around #'spacemacs//load-timer)
+  (advice-add 'package-initialize
+	      :around
+        (spacemacs||make-function-timer package-intialize))
+  (advice-add 'configuration-layer/sync
+              :around
+              (spacemacs||make-function-timer configuration-layer/sync))
+  ;; (advice-add 'configuration-layer/sync
+  ;;             :around
+  ;;             (spacemacs||make-function-profiler configuration-layer/sync))
+  (advice-add 'configuration-layer//configure-package
+	      :around
+	      (spacemacs||make-function-timer configuration-layer//configure-package)))
+
 (provide 'core-debug)

                                           (profiler-report)
                                           (profiler-stop))))))

(when (member "--timed-requires" command-line-args)
  (setq command-line-args (delete "--timed-requires" command-line-args))

  (defvar spacemacs-load-time-threshold 0.15
    "Generate message if file takes longer than this number of
seconds to load")

  (with-current-buffer (get-buffer-create "*load-times*")
    (insert (format "All files that took longer than %.3f seconds to load\n\n"
                    spacemacs-load-time-threshold)))

  (defadvice require (around spacemacs//timed-require activate)
    (let ((start (current-time)) res delta)
      (setq res ad-do-it
            delta (float-time (time-since start)))
      (when (> delta spacemacs-load-time-threshold)
        (with-current-buffer "*load-times*"
          (goto-char (point-max))
          (insert (format "File %s: Required %s: %.3f sec\n"

;;; core-debug.el --- Spacemacs Core File  -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
