This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
mirrored from https://chromium.googlesource.com/catapult
-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland Replace ValueSetOutputFormatter with HistogramSetJsonOutputFor…
…matter. Currently, run_benchmark --output=valueset dumps TBMv2 Histograms to JSON, but it does not convert TBMv1 Values to Histograms, nor does it read existing results, nor does it support uploading. Also the name is wrong. This CL renames ValueSetOutputFormatter to HistogramSetJsonOutputFormatter, and re-conceptualizes it as a subclass of Html2OutputFormatter in order to support converting TBMv1 Values to Histograms and uploading. The new HistogramSetJsonOutputFormatter now also reads existing results. This JSON format will be documented in https://codereview.chromium.org/2563433002 Reverted by https://codereview.chromium.org/2556213002/ BUG=catapult:#3068 Review-Url: https://codereview.chromium.org/2556223002
- Loading branch information
1 parent
0b7222f
commit 658d759
Showing
9 changed files
with
95 additions
and
129 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
telemetry/telemetry/internal/results/histogram_set_json_output_formatter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import json | ||
import logging | ||
|
||
from telemetry.internal.results import output_formatter | ||
|
||
|
||
class HistogramSetJsonOutputFormatter(output_formatter.OutputFormatter): | ||
def __init__(self, output_stream, metadata, reset_results): | ||
super(HistogramSetJsonOutputFormatter, self).__init__(output_stream) | ||
self._metadata = metadata | ||
self._reset_results = reset_results | ||
|
||
def Format(self, page_test_results): | ||
histograms = page_test_results.AsHistogramDicts(self._metadata) | ||
self._output_stream.seek(0) | ||
if not self._reset_results: | ||
existing = self._output_stream.read() | ||
self._output_stream.seek(0) | ||
if existing: | ||
try: | ||
histograms += json.loads(existing) | ||
except ValueError: | ||
logging.warn('Found existing histograms json but failed to parse it.') | ||
json.dump(histograms, self._output_stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
telemetry/telemetry/internal/results/valueset_output_formatter.py
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
telemetry/telemetry/internal/results/valueset_output_formatter_unittest.py
This file was deleted.
Oops, something went wrong.