From 8dd4dd15612b35f7cd84e53ab3aaf1be133e02cd Mon Sep 17 00:00:00 2001 From: Jan Nidzwetzki Date: Wed, 1 Feb 2023 16:45:20 +0100 Subject: [PATCH] Minor changes and improvements --- README.md | 2 +- src/pg_lock_tracer/pg_lock_tracer.py | 2 +- src/pg_lock_tracer/pg_lw_lock_tracer.py | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index caeb4a0..2d06aa7 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres - pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -s DEADLOCK # Print stacktrace for locks and deadlocks -pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -s LOCK, DEADLOCK +pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -s LOCK DEADLOCK # Trace only Transaction and Query related events pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -t TRANSACTION QUERY diff --git a/src/pg_lock_tracer/pg_lock_tracer.py b/src/pg_lock_tracer/pg_lock_tracer.py index d128140..c353f11 100755 --- a/src/pg_lock_tracer/pg_lock_tracer.py +++ b/src/pg_lock_tracer/pg_lock_tracer.py @@ -45,7 +45,7 @@ pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -s DEADLOCK # Print stacktrace for locks and deadlocks -pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -s LOCK, DEADLOCK +pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -s LOCK DEADLOCK # Trace only Transaction and Query related events pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -t TRANSACTION QUERY diff --git a/src/pg_lock_tracer/pg_lw_lock_tracer.py b/src/pg_lock_tracer/pg_lw_lock_tracer.py index c9224a6..315df77 100755 --- a/src/pg_lock_tracer/pg_lw_lock_tracer.py +++ b/src/pg_lock_tracer/pg_lw_lock_tracer.py @@ -338,7 +338,14 @@ def init(self): if self.prog_args.verbose: print(bpf_program_final) - self.bpf_instance = BPF(text=bpf_program_final, usdt_contexts=self.usdts) + # Disable warnings like + # 'warning: '__HAVE_BUILTIN_BSWAP32__' macro redefined [-Wmacro-redefined]' + bpf_cflags = ["-Wno-macro-redefined"] if not self.prog_args.verbose else [] + + print("===> Compiling BPF program") + self.bpf_instance = BPF( + text=bpf_program_final, cflags=bpf_cflags, usdt_contexts=self.usdts + ) self.bpf_instance["lockevents"].open_perf_buffer( self.print_lock_event, page_cnt=64