diff options
| author | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-04 15:42:03 -0400 |
|---|---|---|
| committer | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-04 15:42:03 -0400 |
| commit | 22179e611b0b641192cbc1e3863ed2c76305c448 (patch) | |
| tree | fc7b23b86243647cf75c25f1ca4f0ad3a8268223 /scripts/logview | |
| parent | 272a6b10b55d61e65fa28bf1ee84d217913d317c (diff) | |
| download | ansible-22179e611b0b641192cbc1e3863ed2c76305c448.tar.gz ansible-22179e611b0b641192cbc1e3863ed2c76305c448.tar.xz ansible-22179e611b0b641192cbc1e3863ed2c76305c448.zip | |
add a --profile option to output timing info per task
Diffstat (limited to 'scripts/logview')
| -rwxr-xr-x | scripts/logview | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/logview b/scripts/logview index eb72ba95a..2cf947be1 100755 --- a/scripts/logview +++ b/scripts/logview @@ -37,6 +37,7 @@ def parse_args(args): parser.add_option("-v", default=False, dest='verbose', action='store_true', help='Verbose') parser.add_option("-s", default=[], dest='search_terms', action='append', help="status to search for") parser.add_option("-l", default=False, dest="list_pb", action='store_true', help="list playbooks for a specific date") + parser.add_option("--profile", default=False, dest="profile", action='store_true', help="output timing input per task") (opts, args) = parser.parse_args(args) opts.datestr = date_cheat(opts.datestr) @@ -64,6 +65,15 @@ def search_logs(opts, logfiles): msg += '\n' msg += json.dumps(slurp, indent=4) msg += '\n' + if opts.profile: + st = slurp.get('task_start', 0) + end = slurp.get('task_end', 0) + if st and end: + dur = str(float(end) - float(st)) + else: + dur = "Unknown" + msg += ' Duration: %s sec' % dur + return msg |
