Commit da1c607c authored by Sasha Goldshtein's avatar Sasha Goldshtein

db*: Print the BPF program prior to loading it (in -v mode)

Printing the BPF program after loading it means that if there is a
load error, the program isn't printed, which sort of defeats the
purpose of the whole thing.
parent aa124dd1
......@@ -106,11 +106,12 @@ for usdt in usdts:
usdt.enable_probe("query__start", "probe_start")
usdt.enable_probe("query__done", "probe_end")
bpf = BPF(text=program, usdt_contexts=usdts)
if args.verbose:
print('\n'.join(map(lambda u: u.get_text(), usdts)))
print(program)
bpf = BPF(text=program, usdt_contexts=usdts)
class Data(ct.Structure):
_fields_ = [
("pid", ct.c_ulonglong),
......
......@@ -88,11 +88,12 @@ for usdt in usdts:
usdt.enable_probe("query__start", "probe_start")
usdt.enable_probe("query__done", "probe_end")
bpf = BPF(text=program, usdt_contexts=usdts)
if args.verbose:
print('\n'.join(map(lambda u: u.get_text(), usdts)))
print(program)
bpf = BPF(text=program, usdt_contexts=usdts)
print("Tracing database queries for pids %s slower than %d ms..." %
(', '.join(map(str, args.pids)), args.threshold))
......
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