Here, take this lisp code:
(global-set-key (kbd "C-t") 'timed-key-seq)
(defvar timed-keys-hash (make-hash-table :test 'equal))
(defun timed-key-seq ()
(interactive)
(let* ((t-beg (current-time))
(key (read-key-sequence "command:"))
(t-end (current-time))
(t-diff (time-subtract t-end t-beg))
(data (gethash key timed-keys-hash)))
(if data
(destructuring-bind (times . time) data
(puthash key (cons (1+ times) (time-add time t-diff))
timed-keys-hash))
(puthash key (cons 1 t-diff) timed-keys-hash))
(call-interactively (key-binding key))))
(defun anb-report ()
(interactive)
(let (entries)
(maphash (lambda (key data)
(push
(format "%s:\t%sx = %s ms\n"
key (car data)
(format-time-string "%3N" (cdr data)))
entries))
timed-keys-hash)
(message (apply #'concat entries))))
The disadvantage is that you need to bind timed-key-seq
to something,
I'd suggest C-t. And then you just prefix all your commands by C-t.
Maybe someone can suggest a defadvice
that will make sure that this function will
be called each time without having to prefix it.
Use anb-report
to generate the report. It will show you how many times you called
each combination and how many milliseconds they took together.