clojure-goes-fast / clj-async-profiler

Embedded high-precision Clojure profiler
http://clojure-goes-fast.com/kb/profiling/clj-async-profiler/
411 stars 17 forks source link

Choose output dir #27

Closed avocade closed 1 year ago

avocade commented 1 year ago

Instead of hardcoded /tmp, which doesn't really work on some machines (like on Fly.io).

alexander-yakushev commented 1 year ago

As a workaround, you could have also done it like this:

(.bindRoot #'clj-async-profiler.core/temp-directory
           (let [output-dir (or (System/getenv "CLJ_ASYNC_PROFILER_OUTPUT_DIR") "/tmp")
                 root (io/file output-dir "clj-async-profiler")]
             (.mkdirs (io/file root "results"))
             (.mkdirs (io/file root "internal"))
             root))

Basically, the same code but you execute it before using clj-async-profiler, so you don't need to build a fork.

Regarding the customization, I can make it configurable through a Java property, say clj-async-profiler.output-dir, would that work?