servo: Merge #19257 - Include a YYYYMMDD date field in the raw test-perf CSV to make Google Data Studio happy (from asajeffrey:test-perf-include-date-in-csv); r=jdm
authorAlan Jeffrey <ajeffrey@mozilla.com>
Thu, 16 Nov 2017 16:46:26 -0600
changeset 436938 5a316435958f6a00c099963f0567f851b89b15bd
parent 436937 42ae97964e3ef469b1c0b82dc032c5c2beea1d24
child 436939 da98c602b3c66030b9df0e2443cf5ec6243626ae
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersjdm
milestone59.0a1
servo: Merge #19257 - Include a YYYYMMDD date field in the raw test-perf CSV to make Google Data Studio happy (from asajeffrey:test-perf-include-date-in-csv); r=jdm <!-- Please describe your changes on the following line: --> AFAICT Google Data Studio needs a YYYMMDD date string in the raw data to be able to provide time-indexed graphs. `TODATE` is not converting unix timestamps to YYYYMMDD. https://www.en.advertisercommunity.com/t5/Data-Studio/Can-Data-Studio-Date-Dimension-use-epoch-in-seconds-from/td-p/839649 This PR is a workaround, and includes a date field in the raw CSV. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because this is test infrastructure <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: b5a205d92e3c78c71598795317d601f39152f314
servo/etc/ci/performance/runner.py
--- a/servo/etc/ci/performance/runner.py
+++ b/servo/etc/ci/performance/runner.py
@@ -5,21 +5,25 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import argparse
 import csv
 import itertools
 import json
 import os
 import subprocess
+from datetime import datetime
 from functools import partial
 from statistics import median, StatisticsError
 from urllib.parse import urlsplit, urlunsplit, urljoin
 
 
+DATE = datetime.now().strftime("%Y%m%d")
+
+
 def load_manifest(filename):
     with open(filename, 'r') as f:
         text = f.read()
     return list(parse_manifest(text))
 
 
 def parse_manifest(text):
     lines = filter(lambda x: x != "" and not x.startswith("#"),
@@ -164,16 +168,17 @@ def parse_log(log, testcase, url):
             "responseEnd": -1,
             "domComplete": -1,
         }
 
     # Set the testcase field to contain the original testcase name,
     # rather than the url.
     def set_testcase(timing, testcase=None):
         timing['testcase'] = testcase
+        timing['date'] = DATE
         return timing
 
     valid_timing_for_case = partial(valid_timing, url=url)
     set_testcase_for_case = partial(set_testcase, testcase=testcase)
     timings = list(map(set_testcase_for_case, filter(valid_timing_for_case, map(parse_block, blocks))))
 
     if len(timings) == 0:
         print("Didn't find any perf data in the log, test timeout?")
@@ -235,16 +240,17 @@ def save_result_json(results, filename, 
         with open(filename, 'w') as f:
             json.dump(results, f, indent=2)
     print("Result saved to {}".format(filename))
 
 
 def save_result_csv(results, filename, manifest, expected_runs, base):
 
     fieldnames = [
+        'date',
         'testcase',
         'title',
         'connectEnd',
         'connectStart',
         'domComplete',
         'domContentLoadedEventEnd',
         'domContentLoadedEventStart',
         'domInteractive',