Event Timeline
Comment Actions
A bit of stats:
$ cat /tmp/svn-output.log| python parse.py {"first-day": "2021-07-06 07:07:05,685:", "last-day": "2021-07-19 15:59:13,409:", "avg": 601.2648664650753, "max": 133758.75007151812, "min": 0.5996531848795712, "total": 7600}
[1]
#!/usr/bin/env python3 import click import sys import json @click.command() def main(): nb_visits = 0 avg_timing = 0 max_timing = -1 min_timing = -1 for i, line in enumerate(sys.stdin): nb_visits += 1 date_day, date_hour, visit_type, timing, status = line.rstrip().split() timing = float(timing.rstrip("s:")) max_timing = max(max_timing, timing) min_timing = min(min_timing, timing) if min_timing != -1 else timing avg_timing += timing full_day = f"{date_day} {date_hour}" if i == 0: first_day = full_day last_day = full_day result = { "first-day": first_day, "last-day": last_day, "avg": avg_timing / nb_visits, "max": max_timing, "min": min_timing, "total": nb_visits, } print(json.dumps(result)) if __name__ == '__main__': main()
Related to T3374