@@ -2,16 +2,24 @@ Loader for AsyncProfiler
2
2
========================
3
3
4
4
Packages [ async-profiler] ( https://github.com/jvm-profiling-tools/async-profiler ) releases in a JAR
5
- with a ` AsyncProfilerLoader ` that loads the suitable native library for the current platform.
5
+ with a ` AsyncProfilerLoader ` (version 2+) that loads the suitable native library for the current platform.
6
6
7
7
This is usable as a java agent (same arguments as the async-profiler agent) and as the basis for other libraries.
8
8
The real rationale behind this library is that the async-profiler is a nice tool, but it cannot be easily integrated
9
9
into other Java based tools.
10
10
11
- Take the ` all ` build and you have a JAR that provides the important features of async-profiler on all supported platforms:
11
+ The wrapper is tested against all relevant tests of the async-profiler tool, ensuring that it has the same behavior.
12
+
13
+ Take the ` all ` build and you have a JAR that provides the important features of async-profiler on all supported
14
+ platforms.
12
15
13
16
A changelog can be found at the async-profiler repository, as this library should rarely change itself.
14
17
18
+ _ This project assumes that you used async-profiler before, if not, don't worry, you can still use this project,
19
+ but be aware that it's documentation refers you to the async-profiler documentation a lot._
20
+
21
+ _ fdtransfer is currently not supported, feel free to create an issue if you need it._
22
+
15
23
Supported Platforms
16
24
-------------------
17
25
@@ -30,27 +38,29 @@ Commands
30
38
31
39
The following is a more in-depth description of the commands of ` java -jar ap-loader.jar ` .
32
40
33
- Be aware that it is recommended to use run the JVM with the
34
- ` -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints ` flags when attaching to a running JVM .
41
+ Be aware that it is recommended to use run the JVM with the
42
+ ` -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints ` flags.
35
43
This improves the accuracy of the profiler.
36
44
37
45
Overview over the commands:
38
46
39
47
``` sh
40
48
Usage: java -jar ap-loader.jar < command> [args]
41
49
Commands:
42
- help show this help
43
- jattach run the included jattach binary
44
- profiler run the included profiler.sh
45
- supported fails if this JAR does not include a profiler for the current OS and architecture
46
- converter run the included converter JAR
47
- version version of the included async-profiler
48
- clear clear the directory used for storing extracted files
50
+ help show this help
51
+ jattach run the included jattach binary
52
+ profiler run the included profiler.sh
53
+ agentpath prints the path of the extracted async-profiler agent
54
+ jattachpath prints the path of the extracted jattach binary
55
+ supported fails if this JAR does not include a profiler for the current OS and architecture
56
+ converter run the included converter JAR
57
+ version version of the included async-profiler
58
+ clear clear the directory used for storing extracted files
49
59
` ` `
50
60
51
61
# ## jattach
52
62
53
- ` java -jar ap-loader.jar jattach` is equivalent to calling the suitable ` jattach` binary
63
+ ` java -jar ap-loader.jar jattach` is equivalent to calling the suitable ` jattach` binary
54
64
from [GitHub](https://github.com/apangin/jattach)> :
55
65
56
66
` ` ` sh
@@ -67,6 +77,7 @@ java -jar ap-loader.jar jattach <pid> jcmd "help -all"
67
77
See the [GitHub page of jattach](https://github.com/apangin/jattach) for more details.
68
78
69
79
# ## profiler
80
+
70
81
` java -jar ap-loader.jar profiler` is equivalent to calling the suitable ` profiler.sh` :
71
82
72
83
` ` ` sh
@@ -97,7 +108,7 @@ java -jar ap-loader.jar converter jfr2flame <input.jfr> <output.html>
97
108
98
109
The available converters depend on the included async-profiler version.
99
110
Call ` java -jar converter` to a list of available converters, see
100
- [the source code on GitHub](https://github.com/jvm-profiling-tools/async-profiler/blob/master/src/converter/Main.java)
111
+ [the source code on GitHub](https://github.com/jvm-profiling-tools/async-profiler/blob/master/src/converter/Main.java)
101
112
for more details.
102
113
103
114
# ## clear
@@ -127,18 +138,21 @@ Using in Java code
127
138
Then you can use the ` AsyncProfilerLoader` class to load the native library:
128
139
129
140
` ` ` java
130
- AsyncProfiler profiler + one.profiler.AsyncProfilerLoader.load ();
141
+ AsyncProfiler profiler = one.profiler.AsyncProfilerLoader.load ();
131
142
` ` `
132
143
133
- ` AsyncProfiler` is the [main API class](https://github.com/jvm-profiling-tools/async-profiler/blob/master/src/api/one/profiler/AsyncProfiler.java)
144
+ ` AsyncProfiler` is
145
+ the [main API class](https://github.com/jvm-profiling-tools/async-profiler/blob/master/src/api/one/profiler/AsyncProfiler.java)
134
146
from the async-profiler.jar.
135
147
136
148
The API of the ` AsyncProfilerLoader` can be used to execute all commands the CLI programmatically.
137
149
138
150
# ## Snapsshots
151
+
139
152
We currently only release to snapshop, as the API is not stable yet.
140
153
141
154
` ` ` xml
155
+
142
156
< dependency>
143
157
< groupId> me.bechberger< /groupId>
144
158
< artifactId> ap-loader< /artifactId>
@@ -147,7 +161,9 @@ We currently only release to snapshop, as the API is not stable yet.
147
161
` ` `
148
162
149
163
For example for the all variant of version 2.8.3:
164
+
150
165
` ` ` xml
166
+
151
167
< dependency>
152
168
< groupId> me.bechberger< /groupId>
153
169
< artifactId> ap-loader< /artifactId>
@@ -156,7 +172,9 @@ For example for the all variant of version 2.8.3:
156
172
` ` `
157
173
158
174
You also have to add the snapshot repository:
175
+
159
176
` ` ` xml
177
+
160
178
< repositories>
161
179
< repository>
162
180
< id> snapshots< /id>
@@ -171,7 +189,6 @@ You also have to add the snapshot repository:
171
189
< /repositories>
172
190
` ` `
173
191
174
-
175
192
Build and test
176
193
--------------
177
194
@@ -187,21 +204,41 @@ unzip -o async-profiler-2.8.3-macos.zip -d ap-releases
187
204
# build the JAR for the release
188
205
# maven might throw warnings, related to the project version setting,
189
206
# but the alternative solutions don't work, so we ignore the warning for now
190
- mvn -Dproject.versionPlatform=2.8.3-macos assembly:single
207
+ mvn -Dproject.versionPlatform=2.8.3-macos package assembly:single
191
208
# use it
192
209
java -jar target/ap-loader-2.8.3-macos-full.jar ...
193
210
# build the all JAR
194
- mvn -Dproject.versionPlatform=2.8.3-all -f pom_all.xml assembly:single
211
+ mvn -Dproject.versionPlatform=2.8.3-all -f pom_all.xml package assembly:single
195
212
` ` `
196
213
197
214
Development
198
215
-----------
199
216
This project is written in Java 8, to support all relevant platforms.
200
- The feature set should not increase beyond what is currently:
217
+ The feature set should not increase beyond what is currently:
201
218
Just build your library on top of it. But I' m of course happy for bug reports and fixes.
202
219
203
220
The code is formatted using [google-java-format](https://github.com/google/google-java-format).
204
221
222
+ ### bin/releaser.py
223
+
224
+ ```sh
225
+ Usage:
226
+ python3 ./bin/releaser.py <command> ... <command> [release or current if not present]
227
+
228
+ Commands:
229
+ current_version print the youngest released version of async-profiler
230
+ versions print all released versions of async-profiler (supported by this project)
231
+ download download and prepare the folders for the given release
232
+ build build the wrappers for the given release
233
+ test test the given release
234
+ deploy deploy the wrappers for the given release, i.e., use "mvn deploy"
235
+ clear clear the ap-releases and target folders for a fresh start
236
+
237
+ Environment variables:
238
+ JAVA_VERSIONS comma-separated list of Java versions to test with
239
+ (in the form of sdkman! version names, e.g. 17.0.1-sapmchn)
240
+ ```
241
+
205
242
License
206
243
-------
207
244
Apache 2.0
0 commit comments