summaryrefslogtreecommitdiff
path: root/tools/cgroup
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2020-04-13 12:27:57 -0400
committerJens Axboe <axboe@kernel.dk>2020-04-30 15:54:45 -0600
commitf4fe3ea636385a51f1dfbb27c387a04b12b919e9 (patch)
tree9033f3957cfece9184c9ab805b69c34783c55356 /tools/cgroup
parentcd006509b0a93cb7ee9d9fd50ae274098997a460 (diff)
iocost_monitor: exit successfully if interval is zero
This is to help external tools to decide whether iocost_monitor has all its requirements met or not based on the exit status of an -i0 run. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/cgroup')
-rw-r--r--tools/cgroup/iocost_monitor.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/cgroup/iocost_monitor.py b/tools/cgroup/iocost_monitor.py
index 7427a5ee761b..eb2363b868c5 100644
--- a/tools/cgroup/iocost_monitor.py
+++ b/tools/cgroup/iocost_monitor.py
@@ -28,7 +28,8 @@ parser.add_argument('devname', metavar='DEV',
parser.add_argument('--cgroup', action='append', metavar='REGEX',
help='Regex for target cgroups, ')
parser.add_argument('--interval', '-i', metavar='SECONDS', type=float, default=1,
- help='Monitoring interval in seconds')
+ help='Monitoring interval in seconds (0 exits immediately '
+ 'after checking requirements)')
parser.add_argument('--json', action='store_true',
help='Output in json')
args = parser.parse_args()
@@ -243,6 +244,9 @@ for i, ptr in radix_tree_for_each(blkcg_root.blkg_tree.address_of_()):
if ioc is None:
err(f'Could not find ioc for {devname}');
+if interval == 0:
+ sys.exit(0)
+
# Keep printing
while True:
now = time.time()