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) { ...@@ -102,6 +102,9 @@ int trace_%s(struct pt_regs *ctx) {
probes = [] probes = []
#
# Java
#
if args.language == "java": if args.language == "java":
# Oddly, the gc__begin/gc__end probes don't really have any useful # 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 # information, while the mem__pool* ones do. There's also a bunch of
...@@ -128,6 +131,9 @@ if args.language == "java": ...@@ -128,6 +131,9 @@ if args.language == "java":
begin_save, end_save, formatter)) begin_save, end_save, formatter))
probes.append(Probe("gc__begin", "gc__end", probes.append(Probe("gc__begin", "gc__end",
"", "", lambda _: "no additional info available")) "", "", lambda _: "no additional info available"))
#
# Python
#
elif args.language == "python": elif args.language == "python":
begin_save = """ begin_save = """
int gen = 0; int gen = 0;
...@@ -144,12 +150,18 @@ elif args.language == "python": ...@@ -144,12 +150,18 @@ elif args.language == "python":
(event.field1, event.field2) (event.field1, event.field2)
probes.append(Probe("gc__start", "gc__done", probes.append(Probe("gc__start", "gc__done",
begin_save, end_save, formatter)) begin_save, end_save, formatter))
#
# Ruby
#
elif args.language == "ruby": elif args.language == "ruby":
# Ruby GC probes do not have any additional information available. # Ruby GC probes do not have any additional information available.
probes.append(Probe("gc__mark__begin", "gc__mark__end", probes.append(Probe("gc__mark__begin", "gc__mark__end",
"", "", lambda _: "GC mark stage")) "", "", lambda _: "GC mark stage"))
probes.append(Probe("gc__sweep__begin", "gc__sweep__end", probes.append(Probe("gc__sweep__begin", "gc__sweep__end",
"", "", lambda _: "GC sweep stage")) "", "", lambda _: "GC sweep stage"))
#
# Node
#
elif args.language == "node": elif args.language == "node":
end_save = """ end_save = """
u32 gc_type = 0; u32 gc_type = 0;
......
...@@ -60,6 +60,9 @@ BPF_HASH(allocs, struct key_t, struct val_t); ...@@ -60,6 +60,9 @@ BPF_HASH(allocs, struct key_t, struct val_t);
usdt = USDT(pid=args.pid) usdt = USDT(pid=args.pid)
#
# Java
#
if args.language == "java": if args.language == "java":
program += """ program += """
int alloc_entry(struct pt_regs *ctx) { int alloc_entry(struct pt_regs *ctx) {
...@@ -76,6 +79,9 @@ 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") usdt.enable_probe("object__alloc", "alloc_entry")
#
# Ruby
#
elif args.language == "ruby": elif args.language == "ruby":
create_template = """ create_template = """
int THETHING_alloc_entry(struct pt_regs *ctx) { int THETHING_alloc_entry(struct pt_regs *ctx) {
...@@ -105,6 +111,9 @@ int object_alloc_entry(struct pt_regs *ctx) { ...@@ -105,6 +111,9 @@ int object_alloc_entry(struct pt_regs *ctx) {
for thing in ["string", "hash", "array"]: for thing in ["string", "hash", "array"]:
program += create_template.replace("THETHING", thing) program += create_template.replace("THETHING", thing)
usdt.enable_probe("%s__create" % thing, "%s_alloc_entry" % thing) usdt.enable_probe("%s__create" % thing, "%s_alloc_entry" % thing)
#
# C
#
elif args.language == "c": elif args.language == "c":
program += """ program += """
int alloc_entry(struct pt_regs *ctx, size_t size) { 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