     (-persistent! [this]
       this)))
 
+(defn tdigest-summary
+  [td]
+  (str "samples=" (unchecked-get td "n") "\n"
+       "Q50=" (.percentile td 0.50) "\n"
+       "Q75=" (.percentile td 0.75) "\n"
+       "Q95=" (.percentile td 0.90) "\n"
+       "MAX=" (.percentile td 1)))
+
 (defn timestamp
   []
   (js/performance.now))


        print-single-summary!
        (fn [name td]
          (js/console.log (str "[measure: " name "] "
                               "samples=" (unchecked-get td "n") "\n"
                               "Q50=" (.percentile td 0.50) "\n"
                               "Q75=" (.percentile td 0.75) "\n"
                               "Q95=" (.percentile td 0.90) "\n"
                               "MAX=" (.percentile td 1))))
        print-summary!
        (f/debounce
         #(.forEach registry (fn [td name] (print-single-summary! name td)))

    (uxbox.util.perf/with-measure name
      (apply f args))))

(defn on-render-factory
  [label]
  (let [td  (tdigest)
        log (f/debounce
             (fn [phase td]
               (js/console.log (str "[profile: " label " (" phase ")] "
                                    (tdigest-summary td))))
             300)]
    (fn [id phase adur, bdur, st, ct, itx]
      (conj! td adur)
