@@ -273,6 +273,12 @@ java -jar jonoffcpu-correlator.jar stacks --profile P --output F |
273 | 273 | [--summary S] |
274 | 274 | [--include REGEX]... [--exclude REGEX]... |
275 | 275 | [--include-from FILE]... [--exclude-from FILE]... |
| 276 | + [--canonical-names] [--hide REGEX]... [--trim-root REGEX]... |
| 277 | + [--root-at REGEX]... [--root-at-unmatched bucket|keep] [--leaf-at REGEX]... |
| 278 | + [--collapse-leaf REGEX]... [--collapse-leaf-label frame|category] |
| 279 | + [--thread-frame none|name|pool] (each REGEX option also has a -from FILE form) |
| 280 | +java -jar jonoffcpu-correlator.jar stacks --collapsed-input C --output F [filters and transforms] |
| 281 | +java -jar jonoffcpu-correlator.jar stacks --list-presets |
276 | 282 | java -jar jonoffcpu-correlator.jar merge --profiles A,B,... --output M |
277 | 283 | java -jar jonoffcpu-correlator.jar export --profile P --format csv|jsonl --output E |
278 | 284 | ``` |
@@ -291,6 +297,59 @@ reason only when it contributes to the selected part. The `--summary` file names |
291 | 297 | the `time` part and carries `unsplitNanos`, the kept entries' unsplit time, which |
292 | 298 | a `sleeping` or `runqueue` slice leaves out. |
293 | 299 |
|
| 300 | +### Transforms |
| 301 | + |
| 302 | +Filters decide which entries a slice keeps; transforms change what a kept |
| 303 | +entry's Java stack looks like. They run per entry after the filters, which |
| 304 | +therefore always match the full, untransformed stacks, in this order: |
| 305 | + |
| 306 | +1. `--canonical-names` removes generated-class addresses (`$$Lambda.0x…`, |
| 307 | + `$$Lambda$14/0x…`, `LambdaForm$MH/0x…`, `LambdaForm$DMH/0x…`), so runs compare. |
| 308 | +2. `--hide` removes every matching frame anywhere; a stack of nothing else |
| 309 | + keeps its leaf. |
| 310 | +3. `--trim-root` removes the longest root-side run of matching frames; the |
| 311 | + run stops at the first frame that does not match, so deeper matches stay, |
| 312 | + and a stack that matches throughout keeps its leaf. |
| 313 | +4. `--root-at` starts the stack at its root-most matching frame. A stack |
| 314 | + without one becomes the single frame `[no application frame]`, or stays as |
| 315 | + it is with `--root-at-unmatched keep`. |
| 316 | +5. `--leaf-at` cuts the callees of the leaf-most matching frame and keeps the |
| 317 | + match; a stack without one is unchanged. |
| 318 | +6. `--collapse-leaf` replaces the longest leaf-side run of matching frames by |
| 319 | + the run's root-most frame, or with `--collapse-leaf-label category` by the |
| 320 | + category of that frame: `[kernel]`, `[monitor]`, `[park]`, `[wait]`, |
| 321 | + `[sleep]`, `[lock]` or `[native]`, and the frame itself when none applies. |
| 322 | + |
| 323 | +`--package-names` and `--thread-frame` (the thread's name, or its pool with |
| 324 | +every digit run replaced by `#`, as a frame after any reason frame) are then |
| 325 | +applied as display. With `--stack java+kernel` or `java+user+kernel` the native |
| 326 | +stacks are appended unchanged after the transformed Java stack. Lines that read |
| 327 | +the same after transforming merge, adding their intervals and nanoseconds, so |
| 328 | +no transform changes a total. Each `REGEX` option repeats, and has a |
| 329 | +`-from FILE` form that reads patterns as `--exclude-from` does. Every `-from` |
| 330 | +option, the filters' included, also accepts `preset:NAME`, a list bundled with |
| 331 | +the correlator: `jvm-infra` (thread, executor and Netty entry points, for |
| 332 | +`--trim-root` or `--hide`), `jvm-wait-machinery` (lock, park and monitor |
| 333 | +internals down to libc and the kernel, for `--collapse-leaf`) and `jvm-idle` |
| 334 | +(waits for work, for `--exclude-from`); `stacks --list-presets` prints them with |
| 335 | +their caveats. When any transform is in effect the `--summary` file gains a |
| 336 | +`transforms` object: each option with its patterns and their source (`inline`, a |
| 337 | +file, or `preset:NAME`), `linesBefore`/`linesAfter`, the weight-averaged depth |
| 338 | +`framesBefore`/`framesAfter`, and for `--root-at` the `noApplicationFrame` |
| 339 | +weight and share. |
| 340 | + |
| 341 | +`--collapsed-input FILE` takes any collapsed file instead of a profile — a CPU, |
| 342 | +wall, allocation or lock view the converter wrote, or a jonoffcpu collapsed |
| 343 | +file — through the same filters, transforms and `--package-names`. The |
| 344 | +converter's Java frames lose their compilation marker (`_[j]`, `_[i]`, `_[0]`, |
| 345 | +`_[1]`) and the `/` of their class names; every other frame is kept verbatim. |
| 346 | +In a file with such markers every unmarked frame is native; in one without them |
| 347 | +a frame is native when its name contains `::`, `.so.` or a space, starts with |
| 348 | +`/` or `[`, or ends with `_[k]`. Weights keep the file's unit, integer or |
| 349 | +decimal, and the summary says `input: collapsed`. `--reason`, `--stack`, |
| 350 | +`--weights`, `--time`, `--reason-frame` and `--thread-frame` need a profile and |
| 351 | +are refused. |
| 352 | + |
294 | 353 | `--package-names abbreviate` cuts each package segment of a Java frame to its |
295 | 354 | first letter (`io.netty.channel.epoll.Native.epollWait0` becomes |
296 | 355 | `i.n.c.e.Native.epollWait0`), and `drop` shows `Class.method`; a hidden class's |
|