Created
September 25, 2017 07:55
-
-
Save vyzo/449a1807de81750ae8c48b42618fb28d to your computer and use it in GitHub Desktop.
Sort samples from gxprof.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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