Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: tools/perf/perf_tools/histogram_unittest.py

Issue 12221137: Telemetry / Memory benchmark fix: Separate histograms for different tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add error msg if we do nonsensemaking histogram stuff Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/perf_tools/histogram_measurement.py ('k') | tools/perf/perf_tools/memory_benchmark.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/perf_tools/histogram_unittest.py
diff --git a/tools/perf/perf_tools/histogram_unittest.py b/tools/perf/perf_tools/histogram_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..5f27dadf5007327d67367ffe9300efb9483a887a
--- /dev/null
+++ b/tools/perf/perf_tools/histogram_unittest.py
@@ -0,0 +1,27 @@
+# Copyright (c) 2013 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 unittest
+
+from perf_tools import histogram as histogram_module
+
+class TestHistogram(unittest.TestCase):
+ def testSubtractHistogram(self):
+ baseline_histogram = """{"count": 3, "buckets": [
+{"low": 1, "high": 2, "count": 1},
+{"low": 2, "high": 3, "count": 2}]}"""
+
+ histogram = """{"count": 14, "buckets": [
+{"low": 1, "high": 2, "count": 1},
+{"low": 2, "high": 3, "count": 3},
+{"low": 3, "high": 4, "count": 10}]}"""
+
+ new_histogram = json.loads(
+ histogram_module.SubtractHistogram(histogram, baseline_histogram))
+ new_buckets = dict()
+ for b in new_histogram['buckets']:
+ new_buckets[b['low']] = b['count']
+ self.assertFalse(1 in new_buckets)
+ self.assertEquals(1, new_buckets[2])
+ self.assertEquals(10, new_buckets[3])
« no previous file with comments | « tools/perf/perf_tools/histogram_measurement.py ('k') | tools/perf/perf_tools/memory_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698