Commit f2e063c2 authored by Prashant Bhole's avatar Prashant Bhole Committed by yonghong-song

tools: shmsnoop, sofdsnoop handle keyboard interrupt (#2126)

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.
parent a753e572
......@@ -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()
......@@ -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()
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