Skip to content

Instantly share code, notes, and snippets.

@vyzo
Created September 25, 2017 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyzo/449a1807de81750ae8c48b42618fb28d to your computer and use it in GitHub Desktop.
Save vyzo/449a1807de81750ae8c48b42618fb28d to your computer and use it in GitHub Desktop.
Sort samples from gxprof.out
(import :std/sort)
(def (count-top samples)
(def ht (make-hash-table-eq))
(let lp ((rest samples))
(match rest
([[fun . _] . rest]
(hash-update! ht fun fx1+ 0)
(lp rest))
(else
(let (cs (hash->list ht))
(sort! cs (lambda (a b) (> (cdr a) (cdr b)))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment