mach: Add test-speedometer command and --bmf-output to speedometer and dromaeo (#33247)

* Allow exporting Dromaeo results as BMF JSON

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Add speedometer runner

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-08-29 17:58:57 +02:00 committed by GitHub
parent 0643aa4708
commit 8dd40ed2bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 56 additions and 6 deletions

View file

@ -26,7 +26,7 @@ def run_servo(servo_exe, tests):
# Print usage if command line args are incorrect
def print_usage():
print("USAGE: {0} tests servo_binary dromaeo_base_dir".format(sys.argv[0]))
print("USAGE: {0} tests servo_binary dromaeo_base_dir [BMF JSON output]".format(sys.argv[0]))
post_data = None
@ -48,10 +48,13 @@ class RequestHandler(SimpleHTTPRequestHandler):
if __name__ == '__main__':
if len(sys.argv) == 4:
if len(sys.argv) == 4 or len(sys.argv) == 5:
tests = sys.argv[1]
servo_exe = sys.argv[2]
base_dir = sys.argv[3]
bmf_output = ""
if len(sys.argv) == 5:
bmf_output = sys.argv[4]
os.chdir(base_dir)
# Ensure servo binary can be found
@ -76,6 +79,12 @@ if __name__ == '__main__':
print("-{0}-|-{1}-".format("-" * length, "-" * number))
for test in data:
print(" {0}{1} | {2}".format(test, " " * (length - len(test)), data[test]))
if bmf_output:
output = dict()
for (k, v) in data.items():
output[f"Dromaeo/{k}"] = {'throughput': {'value': float(v)}}
with open(bmf_output, 'w', encoding='utf-8') as f:
json.dump(output, f, indent=4)
proc.kill()
else:
print_usage()