diff options
author | nicolargo <nicolas@nicolargo.com> | 2023-10-15 09:57:05 +0200 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2023-10-15 09:57:05 +0200 |
commit | 3765c0ee1654874e59223436ef6c3ad6e1084ad4 (patch) | |
tree | 8f7f6954a98d92256e2244d94b8978262a2375b3 | |
parent | c05614344efcd07fbc80805501dac95709cb7d77 (diff) |
Correct estimated executed duration when using --stop-after command line
-rw-r--r-- | glances/__init__.py | 2 | ||||
-rw-r--r-- | glances/standalone.py | 18 |
2 files changed, 9 insertions, 11 deletions
diff --git a/glances/__init__.py b/glances/__init__.py index 9ae141aa..da642a3b 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -108,7 +108,7 @@ def start(config, args): # Start the main loop logger.debug("Glances started in {} seconds".format(start_duration.get())) if args.stop_after: - logger.info('Glances will be stopped in ~{} seconds'.format(args.stop_after * args.time * args.memory_leak * 2)) + logger.info('Glances will be stopped in ~{} seconds'.format(args.stop_after * args.time)) if args.memory_leak: print( diff --git a/glances/standalone.py b/glances/standalone.py index 8ab60e8c..8ea5400a 100644 --- a/glances/standalone.py +++ b/glances/standalone.py @@ -161,24 +161,22 @@ class GlancesStandalone(object): return ret + def serve_n(self, n=1): + """Serve n time.""" + for _ in range(n): + if not self.__serve_once(): + break + # self.end() + def serve_forever(self): """Wrapper to the serve_forever function.""" if self.args.stop_after: - for _ in range(self.args.stop_after): - if not self.__serve_once(): - break + self.serve_n(self.args.stop_after) else: while self.__serve_once(): pass # self.end() - def serve_n(self, n=1): - """Serve n time.""" - for _ in range(n): - if not self.__serve_once(): - break - # self.end() - def end(self): """End of the standalone CLI.""" if not self.quiet: |