@@ -0,0 +1,40 @@
1+{ lib, stdenv, fetchFromGitHub, jdk8 }:
2+
3+stdenv.mkDerivation rec {
4+ pname = "async-profiler";
5+ version = "1.8.4";
6+
7+ src = fetchFromGitHub {
8+ owner = "jvm-profiling-tools";
9+ repo = "async-profiler";
10+ rev = "v${version}";
11+ sha256 = "sha256-R/TFElytq3mBG+jKjb7XlFUqpXBpSZGfbscUdg2vevE=";
12+ };
13+
14+ buildInputs = [ jdk8 ];
15+
16+ installPhase = ''
17+ runHook preInstall
18+ install -D "$src/profiler.sh" "$out/bin/async-profiler"
19+ install -D build/jattach "$out/bin/jattach"
20+ install -D build/libasyncProfiler.so "$out/lib/libasyncProfiler.so"
21+ install -D -t "$out/share/java/" build/*.jar
22+ runHook postInstall
23+ '';
24+
25+ fixupPhase = ''
26+ substituteInPlace $out/bin/async-profiler \
27+ --replace 'JATTACH=$SCRIPT_DIR/build/jattach' \
28+ 'JATTACH=${placeholder "out"}/bin/jattach' \
29+ --replace 'PROFILER=$SCRIPT_DIR/build/libasyncProfiler.so' \
30+ 'PROFILER=${placeholder "out"}/lib/libasyncProfiler.so'
31+ '';
32+
33+ meta = with lib; {
34+ description = "A low overhead sampling profiler for Java that does not suffer from Safepoint bias problem";
35+ homepage = "https://github.com/jvm-profiling-tools/async-profiler";
36+ license = licenses.asl20;
37+ maintainers = with maintainers; [ mschuwalow ];
38+ platforms = platforms.all;
39+ };
40+}