Commit f4fe3ea6 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

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: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent cd006509
...@@ -28,7 +28,8 @@ parser.add_argument('devname', metavar='DEV', ...@@ -28,7 +28,8 @@ parser.add_argument('devname', metavar='DEV',
parser.add_argument('--cgroup', action='append', metavar='REGEX', parser.add_argument('--cgroup', action='append', metavar='REGEX',
help='Regex for target cgroups, ') help='Regex for target cgroups, ')
parser.add_argument('--interval', '-i', metavar='SECONDS', type=float, default=1, 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', parser.add_argument('--json', action='store_true',
help='Output in json') help='Output in json')
args = parser.parse_args() args = parser.parse_args()
...@@ -243,6 +244,9 @@ for i, ptr in radix_tree_for_each(blkcg_root.blkg_tree.address_of_()): ...@@ -243,6 +244,9 @@ for i, ptr in radix_tree_for_each(blkcg_root.blkg_tree.address_of_()):
if ioc is None: if ioc is None:
err(f'Could not find ioc for {devname}'); err(f'Could not find ioc for {devname}');
if interval == 0:
sys.exit(0)
# Keep printing # Keep printing
while True: while True:
now = time.time() now = time.time()
......
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