mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Add performance tests
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
05a418592b
commit
2f6d12fc9e
2 changed files with 378 additions and 0 deletions
34
test/performance-plot.py
Executable file
34
test/performance-plot.py
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
parser = argparse.ArgumentParser(description='Display performance plots.')
|
||||
parser.add_argument('output_dir',
|
||||
help='directory containing the measurement files')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
output_directory = args.output_dir
|
||||
|
||||
plt.axes([0.1, 0.1, 0.6, 0.75])
|
||||
plt.xlabel("# database entries")
|
||||
plt.ylabel("time [s]")
|
||||
plt.title("timew performance")
|
||||
|
||||
for filename in os.listdir(output_directory):
|
||||
if filename.endswith(".log"):
|
||||
cmd = "-".join(filename.split('-')[1:-1])
|
||||
try:
|
||||
x, y = np.loadtxt(os.path.join(output_directory, filename),
|
||||
delimiter='\t',
|
||||
usecols=(1, 2),
|
||||
unpack=True)
|
||||
plt.plot(x, y, label=cmd, marker=".", linestyle='')
|
||||
except ValueError as e:
|
||||
print("Invalid file: {} {}".format(filename, e))
|
||||
|
||||
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0., ncol=2)
|
||||
plt.show()
|
Loading…
Add table
Add a link
Reference in a new issue