Skip to content

Commit

Permalink
Merge pull request #32 from jnidzwetzki/minor_fixes
Browse files Browse the repository at this point in the history
Minor changes and improvements
  • Loading branch information
jnidzwetzki committed Feb 1, 2023
2 parents 022b2a6 + 8dd4dd1 commit c10e548
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pg_lock_tracer/pg_lock_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion src/pg_lock_tracer/pg_lw_lock_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c10e548

Please sign in to comment.