Skip to content

Instantly share code, notes, and snippets.

@mgalgs
Created August 5, 2013 18:45
Show Gist options
  • Save mgalgs/6158341 to your computer and use it in GitHub Desktop.
Save mgalgs/6158341 to your computer and use it in GitHub Desktop.
(defun magit-perf-log (msg)
"Log a msg to the magit perf log"
(flet ((message (&rest args) (ignore)))
(with-temp-buffer
(insert msg)
(append-to-file (point-min)
(point-max)
"/tmp/magit-perf-log.txt"))))
(defun magit-cmd-output (cmd args)
(let ((time-before (float-time)))
(magit-perf-log (format "Running %s %s\n" cmd args))
(with-output-to-string
(with-current-buffer standard-output
(apply #'process-file
cmd
nil (list t nil) nil
args)))
(magit-perf-log (format "%s %s --> Elapsed: %f seconds\n"
cmd
args
(- (float-time)
time-before)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment