tss script can measure aech command duration
This commit is contained in:
14
bin/tss
14
bin/tss
@@ -1,9 +1,17 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from sys import stdin, stdout
|
from sys import stdin, stdout, argv
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
|
detailed = '-d' in argv
|
||||||
start = time()
|
start = time()
|
||||||
|
last = start
|
||||||
for line in stdin:
|
for line in stdin:
|
||||||
stamp = time() - start
|
now = time()
|
||||||
stdout.write(f"{stamp:0.6f} {line}")
|
duration = now - start
|
||||||
|
diff = now - last
|
||||||
|
last = now
|
||||||
|
if detailed:
|
||||||
|
stdout.write(f"{duration:0.6f} [{diff:0.6f}] {line}")
|
||||||
|
else:
|
||||||
|
stdout.write(f"{duration:0.6f} {line}")
|
||||||
|
|||||||
Reference in New Issue
Block a user