Commit bee71b2d authored by Sasha Goldshtein's avatar Sasha Goldshtein

tools: Add block comments to u* scripts

parent 1cba422a
......@@ -102,6 +102,9 @@ int trace_%s(struct pt_regs *ctx) {
probes = []
#
# Java
#
if args.language == "java":
# Oddly, the gc__begin/gc__end probes don't really have any useful
# information, while the mem__pool* ones do. There's also a bunch of
......@@ -128,6 +131,9 @@ if args.language == "java":
begin_save, end_save, formatter))
probes.append(Probe("gc__begin", "gc__end",
"", "", lambda _: "no additional info available"))
#
# Python
#
elif args.language == "python":
begin_save = """
int gen = 0;
......@@ -144,12 +150,18 @@ elif args.language == "python":
(event.field1, event.field2)
probes.append(Probe("gc__start", "gc__done",
begin_save, end_save, formatter))
#
# Ruby
#
elif args.language == "ruby":
# Ruby GC probes do not have any additional information available.
probes.append(Probe("gc__mark__begin", "gc__mark__end",
"", "", lambda _: "GC mark stage"))
probes.append(Probe("gc__sweep__begin", "gc__sweep__end",
"", "", lambda _: "GC sweep stage"))
#
# Node
#
elif args.language == "node":
end_save = """
u32 gc_type = 0;
......
......@@ -60,6 +60,9 @@ BPF_HASH(allocs, struct key_t, struct val_t);
usdt = USDT(pid=args.pid)
#
# Java
#
if args.language == "java":
program += """
int alloc_entry(struct pt_regs *ctx) {
......@@ -76,6 +79,9 @@ int alloc_entry(struct pt_regs *ctx) {
}
"""
usdt.enable_probe("object__alloc", "alloc_entry")
#
# Ruby
#
elif args.language == "ruby":
create_template = """
int THETHING_alloc_entry(struct pt_regs *ctx) {
......@@ -105,6 +111,9 @@ int object_alloc_entry(struct pt_regs *ctx) {
for thing in ["string", "hash", "array"]:
program += create_template.replace("THETHING", thing)
usdt.enable_probe("%s__create" % thing, "%s_alloc_entry" % thing)
#
# C
#
elif args.language == "c":
program += """
int alloc_entry(struct pt_regs *ctx, size_t size) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment