Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/tracing/timeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Suite.
Run the following command with a **normal** user (*not* as `root` or using `sudo`):

```shell
./capture.py -e 47 -m /path/to/libmmtk_openjdk.so --no-root-nodes
./capture.py -e 47 -m /path/to/libmmtk_openjdk.so --no-pinning-roots
```

`-e 47` means we only capture one GC in every 47 GCs because otherwise it will have to print too
Expand All @@ -37,7 +37,7 @@ us an illusion of "all GCs are nursery GC" or "all GCs are full-heap GC". This

[aliasing effect]: https://en.wikipedia.org/wiki/Aliasing

`--no-root-nodes` skips the `process_root_nodes` USDT which does not exist in `libmmtk_openjdk.so`.
`--no-pinning-roots` skips the `process_pinning_roots` USDT which does not exist in `libmmtk_openjdk.so`.

Replace `/path/to/libmmtk_openjdk.so` with the actual path to the `.so` that contains MMTk and its
binding.
Expand Down Expand Up @@ -124,7 +124,7 @@ This means things are working properly. Now re-run `./capture.py` again, but pi
file.

```
./capture.py -e 47 -m /path/to/libmmtk_openjdk.so --no-root-nodes > mybenchmark.log
./capture.py -e 47 -m /path/to/libmmtk_openjdk.so --no-pinning-roots > mybenchmark.log
```

Type the root password if prompted.
Expand Down
13 changes: 9 additions & 4 deletions tools/tracing/timeline/capture.bt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ END {
system("rm $TMP_FILE");
}

// We only set up the harness_begin/harness_end probes when the -H option is set.
// Some VM bindings don't implement harness_begin/harness_end, and those trace points don't exist.
// The user will see error if they add the -H option.
//////// BEGIN:HARNESS
usdt:$MMTK:mmtk:harness_begin {
if (@harness) {
//begin collecting data at harness_begin (start of final iteration)
Expand All @@ -32,6 +36,7 @@ usdt:$MMTK:mmtk:harness_end {
exit();
}
}
//////// END:HARNESS

usdt:$MMTK:mmtk:gc_start {
// Close the "GC_REQUEST_WAIT" span opened at `gc_requested`, right before opening "GC".
Expand Down Expand Up @@ -102,13 +107,13 @@ usdt:$MMTK:mmtk:roots {
printf("roots,meta,%d,%lu,%lu,%lu\n", tid, nsecs, arg0, arg1);
}

//////// BEGIN:PROCESS_ROOT_NODES
usdt:$MMTK:mmtk:process_root_nodes {
//////// BEGIN:PROCESS_PINNING_ROOTS
usdt:$MMTK:mmtk:process_pinning_roots {
if (@enable_print) {
printf("process_root_nodes,meta,%d,%lu,%lu,%lu\n", tid, nsecs, arg0, arg1);
printf("process_pinning_roots,meta,%d,%lu,%lu,%lu\n", tid, nsecs, arg0, arg1);
}
}
//////// END:PROCESS_ROOT_NODES
//////// END:PROCESS_PINNING_ROOTS

usdt:$MMTK:mmtk:process_slots {
if (@enable_print) {
Expand Down
11 changes: 7 additions & 4 deletions tools/tracing/timeline/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def get_args():
help="Only capture every N-th GC"),
parser.add_argument("-x", "--extra", metavar="S", type=str, action="append",
help="Append script S after 'capture.bt'. Use this option multiple times to append multiple scripts."),
parser.add_argument("--no-root-nodes", action="store_true",
help="Do not add 'process_root_nodes' probe." +
parser.add_argument("--no-pinning-roots", action="store_true",
help="Do not add 'process_pinning_roots' probe." +
" This USDT is conditionally generated by Rust generics, and may not exist in some VM bindings.")
parser.add_argument("--enable-sweep-chunk-ms", action="store_true",
help="enable the 'sweep_chunk_ms' probe." +
Expand Down Expand Up @@ -77,12 +77,15 @@ def main():
script_lines = script_path.read_text().splitlines()
scripts_lines.extend(script_lines)

if args.no_root_nodes:
delete_lines_between(scripts_lines, "BEGIN:PROCESS_ROOT_NODES", "END:PROCESS_ROOT_NODES")
if args.no_pinning_roots:
delete_lines_between(scripts_lines, "BEGIN:PROCESS_PINNING_ROOTS", "END:PROCESS_PINNING_ROOTS")

if not args.enable_sweep_chunk_ms:
delete_lines_between(scripts_lines, "BEGIN:SWEEP_CHUNK_MS", "END:SWEEP_CHUNK_MS")

if not args.harness:
delete_lines_between(scripts_lines, "BEGIN:HARNESS", "END:HARNESS")

merged_script = "\n".join(scripts_lines)

template = Template(merged_script)
Expand Down
2 changes: 1 addition & 1 deletion tools/tracing/timeline/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def enrich_meta(self, name, tid, ts, gc, wp, args):
# bpftrace may drop events. Be conservative.
if wp is not None:
match name:
case "process_root_nodes":
case "process_pinning_roots":
wp["args"] |= {
"num_roots": int(args[0]),
"num_enqueued_nodes": int(args[1]),
Expand Down
Loading