Skip to content

Commit b64e5e9

Browse files
committed
async-profiler 4.0 (fix style)
1 parent ceb72d8 commit b64e5e9

File tree

1 file changed

+54
-47
lines changed

1 file changed

+54
-47
lines changed

Formula/a/async-profiler.rb

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,57 @@
11
class AsyncProfiler < Formula
2-
desc "Sampling CPU and HEAP profiler for Java featuring AsyncGetCallTrace + perf_events"
3-
homepage "https://github.com/async-profiler/async-profiler"
4-
url "https://github.com/async-profiler/async-profiler/archive/refs/tags/v4.0.tar.gz"
5-
version "4.0"
6-
sha256 "7beb736868af485d6b0b624e42141f78df0ca8403188adc17965b7153261aa55"
7-
license "Apache-2.0"
8-
head "https://github.com/async-profiler/async-profiler.git", branch: "master"
9-
10-
depends_on "cmake" => :build
11-
depends_on "openjdk" => :test
12-
13-
def install
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"
20-
21-
bin.install Dir["build/bin/*"]
22-
lib.install Dir["build/lib/*"]
23-
libexec.install Dir["build/jar/*"]
24-
end
25-
26-
test do
27-
assert_match "Async-profiler #{version}", shell_output("#{bin}/asprof --version")
28-
29-
(testpath/"Main.java").write <<~JAVA
30-
public class Main {
31-
public static void main(String[] args) throws Exception {
32-
Thread.sleep(8_000);
33-
}
2+
desc "Sampling CPU & HEAP profiler for Java using AsyncGetCallTrace + perf_events"
3+
homepage "https://github.com/async-profiler/async-profiler"
4+
url "https://github.com/async-profiler/async-profiler/archive/refs/tags/v4.0.tar.gz"
5+
version "4.0"
6+
sha256 "7beb736868af485d6b0b624e42141f78df0ca8403188adc17965b7153261aa55"
7+
license "Apache-2.0"
8+
head "https://github.com/async-profiler/async-profiler.git", branch: "master"
9+
10+
depends_on "cmake" => :build
11+
depends_on "openjdk" => :test
12+
13+
def install
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"
20+
21+
bin.install Dir["build/bin/*"]
22+
lib.install Dir["build/lib/*"]
23+
libexec.install Dir["build/jar/*"]
24+
end
25+
26+
test do
27+
assert_match "Async-profiler #{version}", shell_output("#{bin}/asprof --version")
28+
29+
(testpath/"Main.java").write <<~JAVA
30+
public class Main {
31+
public static void main(String[] args) throws Exception {
32+
Thread.sleep(8_000);
3433
}
35-
JAVA
36-
37-
pid = spawn Formula["openjdk"].bin/"java", testpath/"Main.java"
38-
system bin/"asprof", "-d", "2", "-f", testpath/"test-profile-via-attach.html", "jps"
39-
assert_predicate testpath/"test-profile-via-attach.html", :exist?
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"
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?
46-
ensure
47-
Process.kill("TERM", pid)
48-
end
34+
}
35+
JAVA
36+
37+
pid = spawn Formula["openjdk"].bin/"java", testpath/"Main.java"
38+
system bin/"asprof",
39+
"-d", "2",
40+
"-f", testpath/"test-profile-via-attach.html",
41+
"jps"
42+
assert_path_exists testpath/"test-profile-via-attach.html"
43+
44+
system Formula["openjdk"].bin/"java",
45+
"-agentpath:#{lib}/libasyncProfiler.dylib=start,event=cpu,lock=10ms,file=test-profile-via-lib.jfr",
46+
testpath/"Main.java"
47+
assert_path_exists testpath/"test-profile-via-lib.jfr"
48+
49+
system bin/"jfrconv",
50+
"-o", "pprof",
51+
testpath/"test-profile-via-lib.jfr",
52+
testpath/"test-profile-via-lib.pprof"
53+
assert_path_exists testpath/"test-profile-via-lib.pprof"
54+
ensure
55+
Process.kill("TERM", pid)
4956
end
50-
57+
end

0 commit comments

Comments
 (0)