From 0206fc4e3568eab6cacfc1d5916258a9ba764f5d Mon Sep 17 00:00:00 2001 From: Jerome Marchand Date: Mon, 5 Aug 2019 15:29:22 +0200 Subject: [PATCH] tools: fix vfscount output when no duration is specified Since commit a2e71a9eb71a ("vfscount.py: add args time (#2344)"), vfscount does not show any output when it is interrupted by a key press, which is the only way out when no time limit is specified. I assume the exit() that has been added in the keyboard interrupt handler is there so that no output is displayed when the program has been interrupted early when a time limit has been specified. But since the tool still invite the user to use Ctrl-C to end the tracing in that case, it seems more consistent to show an output in that case too. This patch removes the exit() and the tools always show a result at the end. It also adds the duration argument to the synopsis and the option section in the man page. --- man/man8/vfscount.8 | 6 +++++- tools/vfscount.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/man/man8/vfscount.8 b/man/man8/vfscount.8 index fbf0e89e..febbc9e6 100644 --- a/man/man8/vfscount.8 +++ b/man/man8/vfscount.8 @@ -2,7 +2,7 @@ .SH NAME vfscount \- Count VFS calls ("vfs_*"). Uses Linux eBPF/bcc. .SH SYNOPSIS -.B vfscount +.B vfscount [duration] .SH DESCRIPTION This counts VFS calls. This can be useful for general workload characterization of these operations. @@ -14,6 +14,10 @@ Edit the script to customize which functions to trace. Since this uses BPF, only the root user can use this tool. .SH REQUIREMENTS CONFIG_BPF and bcc. +.SH OPTIONS +.TP +duration +duration of the trace in seconds. .SH EXAMPLES .TP Count some VFS calls until Ctrl-C is hit: diff --git a/tools/vfscount.py b/tools/vfscount.py index b7c18efd..303d3fde 100755 --- a/tools/vfscount.py +++ b/tools/vfscount.py @@ -54,7 +54,6 @@ print("Tracing... Ctrl-C to end.") sleep(interval) except KeyboardInterrupt: pass - exit() print("\n%-16s %-26s %8s" % ("ADDR", "FUNC", "COUNT")) counts = b.get_table("counts") -- 2.20.1