diff --git a/src/taoensso/timbre/profiling.clj b/src/taoensso/timbre/profiling.clj index af1d838..82ad42f 100644 --- a/src/taoensso/timbre/profiling.clj +++ b/src/taoensso/timbre/profiling.clj @@ -29,7 +29,7 @@ (defn plog-stats "{::pname [time1 time2 ...] ...} => {::pname {:min ...} ...}" [plog] - (reduce (fn [m [pname times]] + (reduce (fn [m [pname times]] ; TODO reduce-kv for Clojure 1.4+ (let [count (count times) time (reduce + times) mean (long (/ time count)) @@ -68,7 +68,7 @@ ft (fn [nanosecs] (let [pow #(Math/pow 10 %) ok-pow? #(>= nanosecs (pow %)) - to-pow #(utils/round-to (/ nanosecs (pow %1)) %2)] + to-pow #(utils/round-to %2 (/ nanosecs (pow %1)))] (cond (ok-pow? 9) (str (to-pow 9 1) "s") (ok-pow? 6) (str (to-pow 6 0) "ms") (ok-pow? 3) (str (to-pow 3 0) "μs") diff --git a/src/taoensso/timbre/utils.clj b/src/taoensso/timbre/utils.clj index 8268721..b2632b2 100644 --- a/src/taoensso/timbre/utils.clj +++ b/src/taoensso/timbre/utils.clj @@ -47,11 +47,11 @@ (defn round-to "Rounds argument to given number of decimal places." - [x places] + [places x] (if (zero? places) (Math/round (double x)) (let [modifier (Math/pow 10.0 places)] (/ (Math/round (* x modifier)) modifier)))) -(comment (round-to 10 0) - (round-to 10.123 2)) \ No newline at end of file +(comment (round-to 0 10) + (round-to 2 10.123)) \ No newline at end of file