Currently we define USDT probes in capture.bt
usdt:$MMTK:mmtk:sweep_chunk {
if (@enable_print) {
printf("sweep_chunk,meta,%d,%lu,%lu\n", tid, nsecs, arg0);
}
}
and parse the line and convert it to JSON in visualize.py
case "sweep_chunk":
wp["args"] |= {
"allocated_blocks": int(args[0]),
}
and we document them in README.md
- `mmtk:sweep_chunk(allocated_blocks: int)`: an execution of the `SweepChunk` work packet (for
both `MarkSweepSpace` and `ImmixSpace`). `allocated_blocks` is the number of allocated blocks
in the chunk processed by the work packet.
There are dozens of such USDT probes in capture.bt, differing only on the number of arguments. They must exactly match the code in visualize.py. And we need to update the markdown, too. This makes it very difficult to maintain.
One alternative is to declare all such probes in one .py file using declarative syntax.
class sweep_chunk(WorkPacketEnrichment):
""" An execution of the `SweepChunk` work packet for both `MarkSweepSpace` and `ImmixSpace`. """
allocated_blocks: USDTArg(int, "the number of allocated blocks in the chunk processed by the work packet")
Some probes can have derived fields.
class process_node(WorkPacketEnrichment):
""" An execution of the `TracingProcessNodes` work packet, including that executed within `TracingProcessSlots`. """
total_objects: USDTArg(int, "total number of objects in the work packet")
scan_and_trace: USDTArg(int, "number of objects scanned using the `Scanning::scan_object_and_trace_edges` method")
@derived_field
def scan_for_slots(self):
""" the number of objects scanned using `Scanning::scan_object`. """
return self.total_objects - self.scan_and_trace
Some probes can enrich the "GC" timeline bar instead.
class immix_defrag(GCEnrichment):
"""
This probe is fired when the Immix-based plan has determined whether the current
GC is a defrag GC. Only executed if the plan is Immix-based (i.e. Immix, GenImmix and
StickyImmix). Will not be executed during nursery GCs (for GenImmix and StickyImmix).
"""
is_defrag_gc: USDTArg(bool, "True if the current GC is a defrag GC")
capture.py will generate the .bt code snippet from this Python file, and visualize.py will use it to parse the CSV. It also serves as the single place of truth for documentation.
Currently we define USDT probes in capture.bt
and parse the line and convert it to JSON in visualize.py
and we document them in README.md
There are dozens of such USDT probes in capture.bt, differing only on the number of arguments. They must exactly match the code in visualize.py. And we need to update the markdown, too. This makes it very difficult to maintain.
One alternative is to declare all such probes in one
.pyfile using declarative syntax.Some probes can have derived fields.
Some probes can enrich the "GC" timeline bar instead.
capture.py will generate the
.btcode snippet from this Python file, and visualize.py will use it to parse the CSV. It also serves as the single place of truth for documentation.