Skip to content

Commit

Permalink
tools: shmsnoop, sofdsnoop handle keyboard interrupt (iovisor#2126)
Browse files Browse the repository at this point in the history
Handle keyboard interrupt to avoid backtrace printed out when user
presses Ctrl-C. Other tools have been fixed recently. Let's fix these
remaining tools.
  • Loading branch information
pbhole authored and yonghong-song committed Jan 11, 2019
1 parent a753e57 commit f2e063c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tools/shmsnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,7 @@ def print_event(cpu, data, size):
b["events"].open_perf_buffer(print_event, page_cnt=64)
start_time = datetime.now()
while not args.duration or datetime.now() - start_time < args.duration:
b.perf_buffer_poll(timeout=1000)
try:
b.perf_buffer_poll(timeout=1000)
except KeyboardInterrupt:
exit()
5 changes: 4 additions & 1 deletion tools/sofdsnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,7 @@ def print_event(cpu, data, size):
b["events"].open_perf_buffer(print_event, page_cnt=64)
start_time = datetime.now()
while not args.duration or datetime.now() - start_time < args.duration:
b.perf_buffer_poll(timeout=1000)
try:
b.perf_buffer_poll(timeout=1000)
except KeyboardInterrupt:
exit()

0 comments on commit f2e063c

Please sign in to comment.