diff --git a/etc/ci/performance/page_load_test/example/example_sync.html b/etc/ci/performance/page_load_test/example/example_sync.html index 2d5b0c72aec..0ee4ef3469b 100644 --- a/etc/ci/performance/page_load_test/example/example_sync.html +++ b/etc/ci/performance/page_load_test/example/example_sync.html @@ -3,7 +3,7 @@ - + An example pageload test Hello World diff --git a/etc/ci/performance/runner.py b/etc/ci/performance/runner.py index 0fcc2b109b0..5bc5c57724f 100644 --- a/etc/ci/performance/runner.py +++ b/etc/ci/performance/runner.py @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import argparse +import csv import itertools import json import os @@ -236,6 +237,40 @@ def save_result_json(results, filename, manifest, expected_runs, base): print("Result saved to {}".format(filename)) +def save_result_csv(results, filename, manifest, expected_runs, base): + + fieldnames = [ + 'testcase', + 'title', + 'connectEnd', + 'connectStart', + 'domComplete', + 'domContentLoadedEventEnd', + 'domContentLoadedEventStart', + 'domInteractive', + 'domLoading', + 'domainLookupEnd', + 'domainLookupStart', + 'fetchStart', + 'loadEventEnd', + 'loadEventStart', + 'navigationStart', + 'redirectEnd', + 'redirectStart', + 'requestStart', + 'responseEnd', + 'responseStart', + 'secureConnectionStart', + 'unloadEventEnd', + 'unloadEventStart', + ] + + with open(filename, 'w') as csvfile: + writer = csv.DictWriter(csvfile, fieldnames) + writer.writeheader() + writer.writerows(results) + + def format_result_summary(results): failures = list(filter(lambda x: x['domComplete'] == -1, results)) result_log = """ @@ -306,7 +341,10 @@ def main(): # TODO: Record and analyze other performance.timing properties print(format_result_summary(results)) - save_result_json(results, args.output_file, testcases, args.runs, args.base) + if args.output_file.endswith('.csv'): + save_result_csv(results, args.output_file, testcases, args.runs, args.base) + else: + save_result_json(results, args.output_file, testcases, args.runs, args.base) except KeyboardInterrupt: print("Test stopped by user, saving partial result") diff --git a/etc/ci/performance/test_all.sh b/etc/ci/performance/test_all.sh index c112a20c8b3..77fce655e8a 100755 --- a/etc/ci/performance/test_all.sh +++ b/etc/ci/performance/test_all.sh @@ -49,7 +49,7 @@ python3 -m http.server > /dev/null 2>&1 & # MANIFEST="page_load_test/tp5n/20160509.manifest" # A manifest that excludes MANIFEST="page_load_test/example.manifest" # A manifest that excludes # timeout test cases -PERF_FILE="output/perf-$(date +%s).json" +PERF_FILE="output/perf-$(date +%s).csv" echo "Running tests" python3 runner.py ${engine} --runs 4 --timeout "${timeout}" --base "${base}" \