Commit 39909a4d authored by Tomas Krizek's avatar Tomas Krizek

global_stats: save start/end time as integer timestamp

parent 60679d58
...@@ -214,7 +214,7 @@ def main(): ...@@ -214,7 +214,7 @@ def main():
sys.exit(1) sys.exit(1)
with lmdb.env.begin(sdb) as txn: with lmdb.env.begin(sdb) as txn:
stats = pickle.loads(txn.get(b'global_stats')) stats = pickle.loads(txn.get(b'global_stats'))
global_stats['duration'] = round(stats['end_time'] - stats['start_time']) global_stats['duration'] = stats['end_time'] - stats['start_time']
print_results(global_stats, field_weights, field_stats, n=args.limit) print_results(global_stats, field_weights, field_stats, n=args.limit)
......
...@@ -118,7 +118,7 @@ def main(): ...@@ -118,7 +118,7 @@ def main():
except KeyError: except KeyError:
pass pass
stats = { stats = {
'start_time': time.time(), 'start_time': int(time.time()),
'end_time': None, 'end_time': None,
} }
...@@ -148,7 +148,7 @@ def main(): ...@@ -148,7 +148,7 @@ def main():
# attempt to preserve data if something went wrong (or not) # attempt to preserve data if something went wrong (or not)
txn.commit() txn.commit()
stats['end_time'] = time.time() stats['end_time'] = int(time.time())
with lmdb.env.begin(sdb, write=True) as txn: with lmdb.env.begin(sdb, write=True) as txn:
txn.put(b'global_stats', pickle.dumps(stats)) txn.put(b'global_stats', pickle.dumps(stats))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment