Skip to content

Commit

Permalink
iocost_monitor: exit successfully if interval is zero
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
htejun authored and axboe committed Apr 30, 2020
1 parent cd00650 commit f4fe3ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/cgroup/iocost_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
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()
Expand Down Expand Up @@ -243,6 +244,9 @@ def table_row_str(self, path):
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()
Expand Down

0 comments on commit f4fe3ea

Please sign in to comment.