-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unregister PPPs when they are no longer PPPs
This commit, together with a commit in the `ruby` repo, allows the GC to remove objects from the list of registered PPPs when they are no longer PPPs. Specifically, iseq objects will stop being PPPs since ISEQ_COMPILE_DATA_CLEAR. This commit also adds eBPF tracing extensions to track the number of PPPs and their children involved when pinning or unpinning PPP children, and the number of PPPs removed when cleaning up the PPP list, and visualize them on the generated timeline plot.
- Loading branch information
Showing
8 changed files
with
196 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Ruby binding-specific timeline visualizer extensions | ||
|
||
Scripts in this directory extends the eBPF timeline visualizer tools in the | ||
[mmtk-core](https://github.com/mmtk/mmtk-core/) repository to add more information about work | ||
packets defined in the mmtk-ruby binding. | ||
|
||
Read `mmtk-core/tools/tracing/timeline/README.md` for the basic usage of the tools, and read | ||
`mmtk-core/tools/tracing/timeline/EXTENSION.md` for details about extensions. | ||
|
||
## Examples: | ||
|
||
To capture a trace with Ruby-specific information: | ||
|
||
``` | ||
/path/to/mmtk-core/tools/tracing/timeline/capture.py \ | ||
-x /path/to/mmtk-ruby/tools/tracing/timeline/capture_ruby.bt \ | ||
-m /path/to/mmtk-ruby/mmtk/target/release/libmmtk_ruby.so \ | ||
> my-execution.log | ||
``` | ||
|
||
To convert the log into the JSON format, with Ruby-specific information added to the timeline | ||
blocks: | ||
|
||
``` | ||
/path/to/mmtk-core/tools/tracing/timeline/visualize.py \ | ||
-x /path/to/mmtk-ruby/tools/tracing/timeline/visualize_ruby.bt \ | ||
my-execution.log | ||
``` | ||
|
||
It will generate `my-execution.log.json.gz` which can be loaded into [Perfetto UI]. | ||
|
||
[Perfetto UI]: https://www.ui.perfetto.dev/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
usdt:$MMTK:mmtk_ruby:pin_ppp_children { | ||
if (@enable_print) { | ||
printf("pin_ppp_children,meta,%d,%lu,%lu,%lu,%lu\n", tid, nsecs, arg0, arg1, arg2); | ||
} | ||
} | ||
|
||
usdt:$MMTK:mmtk_ruby:remove_dead_ppps { | ||
if (@enable_print) { | ||
printf("remove_dead_ppps,meta,%d,%lu,%lu,%lu,%lu\n", tid, nsecs, arg0, arg1, arg2); | ||
} | ||
} | ||
|
||
usdt:$MMTK:mmtk_ruby:unpin_ppp_children { | ||
if (@enable_print) { | ||
printf("unpin_ppp_children,meta,%d,%lu,%lu\n", tid, nsecs, arg0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python3 | ||
|
||
def enrich_meta_extra(log_processor, name, tid, ts, gc, wp, args): | ||
if wp is not None: | ||
match name: | ||
case "pin_ppp_children": | ||
num_ppps, num_no_longer_ppps, num_pinned_children = [int(x) for x in args] | ||
num_still_ppps = num_ppps - num_no_longer_ppps | ||
wp["args"] |= { | ||
"num_ppps": num_ppps, | ||
"num_no_longer_ppps": num_no_longer_ppps, | ||
"num_still_ppps": num_still_ppps, | ||
"num_pinned_children": num_pinned_children, | ||
} | ||
|
||
case "remove_dead_ppps": | ||
num_ppps, num_no_longer_ppps, num_dead_ppps = [int(x) for x in args] | ||
num_retained_ppps = num_ppps - num_no_longer_ppps - num_dead_ppps | ||
wp["args"] |= { | ||
"num_ppps": num_ppps, | ||
"num_no_longer_ppps": num_no_longer_ppps, | ||
"num_dead_ppps": num_dead_ppps, | ||
"num_retained_ppps": num_retained_ppps, | ||
} | ||
|
||
case "unpin_ppp_children": | ||
num_children = int(args[0]) | ||
wp["args"] |= { | ||
"num_ppp_children": num_children, | ||
} |