Skip to content

Commit ceb72d8

Browse files
committed
async-profiler 4.0 (build from source, head support)
1 parent 134d4f7 commit ceb72d8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Formula/a/async-profiler.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ class AsyncProfiler < Formula
55
version "4.0"
66
sha256 "7beb736868af485d6b0b624e42141f78df0ca8403188adc17965b7153261aa55"
77
license "Apache-2.0"
8+
head "https://github.com/async-profiler/async-profiler.git", branch: "master"
89

910
depends_on "cmake" => :build
1011
depends_on "openjdk" => :test
1112

1213
def install
13-
on_macos do
14-
system "make", "FAT_BINARY=true"
15-
end
16-
# on_linux do
17-
# system "make", "CC=/usr/local/musl/bin/musl-gcc"
18-
# end
14+
args = []
15+
args << "COMMIT_TAG=#{Utils.git_head}" if build.head?
16+
args << "FAT_BINARY=true" if OS.mac?
17+
# args << "CC=/usr/local/musl/bin/musl-gcc" if OS.linux?
18+
19+
system "make", *args, "all"
1920

2021
bin.install Dir["build/bin/*"]
2122
lib.install Dir["build/lib/*"]
@@ -28,7 +29,7 @@ def install
2829
(testpath/"Main.java").write <<~JAVA
2930
public class Main {
3031
public static void main(String[] args) throws Exception {
31-
Thread.sleep(10_000);
32+
Thread.sleep(8_000);
3233
}
3334
}
3435
JAVA
@@ -39,6 +40,9 @@ def install
3940

4041
system Formula["openjdk"].bin/"java", "-agentpath:#{lib}/libasyncProfiler.dylib=start,event=cpu,lock=10ms,file=test-profile-via-lib.jfr", testpath/"Main.java"
4142
assert_predicate testpath/"test-profile-via-lib.jfr", :exist?
43+
44+
system bin/"jfrconv", "-o", "pprof", testpath/"test-profile-via-lib.jfr", testpath/"test-profile-via-lib.pprof"
45+
assert_predicate testpath/"test-profile-via-lib.pprof", :exist?
4246
ensure
4347
Process.kill("TERM", pid)
4448
end

0 commit comments

Comments
 (0)