All Projects → clojure-goes-fast → Clj Async Profiler

clojure-goes-fast / Clj Async Profiler

Embeddable Clojure profiler built on https://github.com/jvm-profiling-tools/async-profiler

Programming Languages

clojure
4091 projects

Labels

Projects that are alternatives of or similar to Clj Async Profiler

Hdrhistogram rust
A port of HdrHistogram to Rust
Stars: ✭ 130 (-40.91%)
Mutual labels:  profiling
Hotspot
The Linux perf GUI for performance analysis.
Stars: ✭ 2,415 (+997.73%)
Mutual labels:  profiling
Elinux
嵌入式 Linux 知识库 (elinux.org) 中文翻译计划;本项目发起人发布了《360° 剖析 Linux ELF》视频课程,欢迎订阅:https://www.cctalk.com/m/group/88089283
Stars: ✭ 193 (-12.27%)
Mutual labels:  profiling
Dynamorio
Dynamic Instrumentation Tool Platform
Stars: ✭ 1,828 (+730.91%)
Mutual labels:  profiling
Mtuner
MTuner is a C/C++ memory profiler and memory leak finder for Windows, PlayStation 4 and 3, Android and other platforms
Stars: ✭ 2,007 (+812.27%)
Mutual labels:  profiling
Gprof2dot
Converts profiling output to a dot graph.
Stars: ✭ 2,309 (+949.55%)
Mutual labels:  profiling
Timebudget
Stupidly-simple speed measurements for Python.
Stars: ✭ 127 (-42.27%)
Mutual labels:  profiling
Profilinggo
A quick tour (or reminder) of Go performance tools
Stars: ✭ 219 (-0.45%)
Mutual labels:  profiling
Memory Profiler
A memory profiler for Linux.
Stars: ✭ 2,422 (+1000.91%)
Mutual labels:  profiling
Traceutility
Extract data from .trace documents generated by Instruments
Stars: ✭ 188 (-14.55%)
Mutual labels:  profiling
Pdt
PHP Development Tools project (PDT)
Stars: ✭ 135 (-38.64%)
Mutual labels:  profiling
Laravel Db Profiler
Database Profiler for Laravel Web and Console Applications.
Stars: ✭ 141 (-35.91%)
Mutual labels:  profiling
Nlp profiler
A simple NLP library allows profiling datasets with one or more text columns. When given a dataset and a column name containing text data, NLP Profiler will return either high-level insights or low-level/granular statistical information about the text in that column.
Stars: ✭ 181 (-17.73%)
Mutual labels:  profiling
Stagemonitor
an open source solution to application performance monitoring for java server applications
Stars: ✭ 1,664 (+656.36%)
Mutual labels:  profiling
React Perf Devtool
A browser developer tool extension to inspect performance of React components.
Stars: ✭ 2,277 (+935%)
Mutual labels:  profiling
Flamegraph
Easy flamegraphs for Rust projects and everything else, without Perl or pipes <3
Stars: ✭ 2,185 (+893.18%)
Mutual labels:  profiling
Tracy
C++ frame profiler
Stars: ✭ 3,115 (+1315.91%)
Mutual labels:  profiling
Dd Trace Py
Datadog Python APM Client
Stars: ✭ 220 (+0%)
Mutual labels:  profiling
Debug Recipes
My notes collected while debugging various .NET and Windows problems.
Stars: ✭ 204 (-7.27%)
Mutual labels:  profiling
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+936.82%)
Mutual labels:  profiling

clj-async-profiler

This library is a thin Clojure wrapper around the excellent async-profiler and FlameGraph.

async-profiler is a low overhead sampling profiler for JVM that does not suffer from the safepoint bias problem. It operates by attaching a native Java agent to a running JVM process and collecting the stack traces samples by using HotSpot-specific APIs. Current version of async-profiler that is used by clj-async-profiler is 1.7.

FlameGraph is a set of scripts to generate flame graphs. Flame graphs are a visualization of profiled software, allowing the most frequent code-paths to be identified quickly and accurately.

Preparation

clj-async-profiler is only supported on GNU/Linux and MacOS. See https://github.com/jvm-profiling-tools/async-profiler#supported-platforms.

If you run clj-async-profiler on MacOS, no extra steps are required.

If you are running GNU/Linux, you need to do the following:

  1. Ensure that perf_event_paranoid is set to 1 or less:
$ cat /proc/sys/kernel/perf_event_paranoid
1

If it prints 2, you have to set it to 1 to allow async-profiler to use kernel profiling data.

$ echo 1 | sudo tee /proc/sys/kernel/perf_event_paranoid

See also.

  1. If you see stackframes like /usr/lib/.../libjvm.so, it means that you have to install JDK debug symbols. E.g., on Ubuntu that would be the package openjdk-8-dbg.

Usage

Add com.clojure-goes-fast/clj-async-profiler to your dependencies:

clj-async-profiler exposes an all-in-one facade for generating profiling flame graphs. The most common usage scenario looks like this:

(require '[clj-async-profiler.core :as prof])

;; Profile the following expression:
(prof/profile (dotimes [i 10000] (reduce + (range i))))

;; The resulting flamegraph will be stored in /tmp/clj-async-profiler/results/
;; You can view the SVG directly from there or start a local webserver:

(prof/serve-files 8080) ; Serve on port 8080

You can also start and stop the profiler manually with prof/start and prof/stop.

Each profiling command accepts a map of options. See docstrings for each command for the list of supported options.

Option map for each profiling command can have a :pid value. If it is provided, an external JVM process with this PID will be sampled, otherwise the current process is targeted.

JVM options

JDK9+: you must start the JVM with option -Djdk.attach.allowAttachSelf, otherwise the agent will not be able to dynamically attach to the running process. For Leiningen, add :jvm-opts ["-Djdk.attach.allowAttachSelf"] to project.clj. For Boot, start the process with environment variable BOOT_JVM_OPTIONS="-Djdk.attach.allowAttachSelf".

From async-profiler README: It is highly recommended to use -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints JVM flags. Without those flags the profiler will still work correctly but results might be less accurate. Without these options, there is a high chance that simple inlined methods will not appear in the profile. When agent is attached at runtime CompiledMethodLoad JVMTI event enables debug info, but only for methods compiled after the event is turned on.

Running on non-x64 platforms

clj-async-profiler ships with native libraries only for x64 Linux/OSX and Linux ARM. To use it on other supported platforms, you should do the following:

  1. Build async-profiler for the desired platform.

  2. Put the resulting libasyncProfiler.so in a place accessible by your JVM process.

  3. Execute from Clojure:

    (reset! clj-async-profiler.core/async-profiler-agent-path
            "/path/to/libasyncProfiler.so")
    

License

async-profiler is distributed under Apache-2.0. See APACHE_PUBLIC_LICENSE file. The location of the original repository is https://github.com/jvm-profiling-tools/async-profiler.

Copyright 2017-2019 Andrei Pangin


flamegraph.pl is distributed under CDDL-1.0. See COMMON_DEVELOPMENT_AND_DISTRIBUTION_LICENSE file. The original file location is https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl.

Copyright 2016 Netflix, Inc.
Copyright 2011 Joyent, Inc. All rights reserved.
Copyright 2011 Brendan Gregg. All rights reserved.


lein-simpleton is distributed under the Eclipse Public License. See ECLIPSE_PUBLIC_LICENSE.

Copyright 2013 Fogus and contributors.


clj-async-profiler is distributed under the Eclipse Public License. See ECLIPSE_PUBLIC_LICENSE.

Copyright 2017-2019 Alexander Yakushev

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].