kotlinx.coroutines profiler is a sampling profiler which captures all living coroutines, their states, suspension points, threads.
core
module contains profiler, its runner (java agent) and dumps to file writer.show
module displays profiler dumps via webpage.
Profiler depends on modified
kotlinx.coroutines.core
and kotlinx.coroutines.debug
libs.
Their fork.
To achieve patched version of coroutines packages jars:
- go to
profiler
branch:git checkout profiler
- build and push
core
module to mavenLocal repo:gradle :kotlinx-coroutines-core:publishToMavenLocal
- build and push
debug
module to mavenLocal repo:gradle :kotlinx-coroutines-debug:publishToMavenLocal
- Build
core
module:gradle :core:fatJar
- Attach profiler's JAR (at core/out/artifacts/profiler/profiler.jar) to your application as agent via jvm
args:
-javaagent:PATH_TO_PROFILER_JAR=PROFILER_ARGS
Or you can run profiler on sample-app
via gradle :sample-app:runWithProfiler
- Directory to output file:
-o OUTPUT_DIR
. Profiling results will be written atOUTPUT_DIR/coroprof.json
. Also, dump probes and coroutines structure will be written at the same directory:OUTPUT_DIR/coroprof_probes.json
andOUTPUT_DIR/coroprof_struct.json
- Dumps interval in milliseconds:
-i INT_VALUE
- Collect internal statistics of profiling:
-s