@@ -5,17 +5,18 @@ class AsyncProfiler < Formula
5
5
version "4.0"
6
6
sha256 "7beb736868af485d6b0b624e42141f78df0ca8403188adc17965b7153261aa55"
7
7
license "Apache-2.0"
8
+ head "https://github.com/async-profiler/async-profiler.git" , branch : "master"
8
9
9
10
depends_on "cmake" => :build
10
11
depends_on "openjdk" => :test
11
12
12
13
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"
19
20
20
21
bin . install Dir [ "build/bin/*" ]
21
22
lib . install Dir [ "build/lib/*" ]
@@ -28,7 +29,7 @@ def install
28
29
( testpath /"Main.java" ) . write <<~JAVA
29
30
public class Main {
30
31
public static void main(String[] args) throws Exception {
31
- Thread.sleep(10_000 );
32
+ Thread.sleep(8_000 );
32
33
}
33
34
}
34
35
JAVA
@@ -39,6 +40,9 @@ def install
39
40
40
41
system Formula [ "openjdk" ] . bin /"java" , "-agentpath:#{ lib } /libasyncProfiler.dylib=start,event=cpu,lock=10ms,file=test-profile-via-lib.jfr" , testpath /"Main.java"
41
42
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?
42
46
ensure
43
47
Process . kill ( "TERM" , pid )
44
48
end
0 commit comments