Add timing

This commit is contained in:
Luke Murphy 2020-10-03 13:12:42 +02:00
parent 96b8997c0c
commit 28706e9c93
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -3,6 +3,7 @@ import json
import os import os
import re import re
import sys import sys
import time
from argparse import ArgumentParser from argparse import ArgumentParser
from datetime import datetime from datetime import datetime
from fnmatch import fnmatch from fnmatch import fnmatch
@ -455,15 +456,21 @@ async def handle_pads(args):
padids = padids[args.skip : len(padids)] padids = padids[args.skip : len(padids)]
print("=" * 79) print("=" * 79)
print("Etherpump warming up the engines ...") print("Etherpump is warming up the engines ...")
print("=" * 79) print("=" * 79)
start = time.time()
async with trio.open_nursery() as nursery: async with trio.open_nursery() as nursery:
for padid in padids: for padid in padids:
nursery.start_soon(handle_pad, args, padid, data, info, session) nursery.start_soon(handle_pad, args, padid, data, info, session)
end = time.time()
print("=" * 79) print("=" * 79)
print("Processed {} pads!".format(len(padids))) print(
"Processed {} pads in {} seconds".format(
len(padids), round(end - start, 2)
)
)
print("=" * 79) print("=" * 79)