• (summarize profile-data)
Takes the raw data returned by with-profile-data and returns a map
from names to summary statistics. Each value in the map will look
like:

{:mean ..., :min ..., :max ..., :count ..., :sum ...}

:mean, :min, and :max are how long the profiled section took to run,
in nanoseconds. :count is the total number of times the profiled
section was executed. :sum is the total amount of time spent in the
profiled section, in nanoseconds.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/profile.clj:73 top

(defn summarize
  "Takes the raw data returned by with-profile-data and returns a map
  from names to summary statistics.  Each value in the map will look
  like:

     {:mean ..., :min ..., :max ..., :count ..., :sum ...}

  :mean, :min, and :max are how long the profiled section took to run,
  in nanoseconds.  :count is the total number of times the profiled
  section was executed.  :sum is the total amount of time spent in the
  profiled section, in nanoseconds."
  [profile-data]
  (reduce (fn [m [k v]]
            (let [cnt (count v)
                  sum (reduce + v)]
              (assoc m k {:mean (int (/ sum cnt))
                          :min (apply min v)
                          :max (apply max v)
                          :count cnt
                          :sum sum})))
          {} profile-data))
Vars in clojure.contrib.profile/summarize: assoc defn fn let reduce
Used in 0 other vars

Comments top

No comments for summarize. Log in to add a comment.