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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import json
5 import unittest
6
7 from perf_tools import histogram as histogram_module
8
9 class TestHistogram(unittest.TestCase):
10 def testSubtractHistogram(self):
11 baseline_histogram = """{"count": 3, "buckets": [
12 {"low": 1, "high": 2, "count": 1},
13 {"low": 2, "high": 3, "count": 2}]}"""
14
15 histogram = """{"count": 14, "buckets": [
16 {"low": 1, "high": 2, "count": 1},
17 {"low": 2, "high": 3, "count": 3},
18 {"low": 3, "high": 4, "count": 10}]}"""
19
20 new_histogram = json.loads(
21 histogram_module.SubtractHistogram(histogram, baseline_histogram))
22 new_buckets = dict()
23 for b in new_histogram['buckets']:
24 new_buckets[b['low']] = b['count']
25 self.assertFalse(1 in new_buckets)
26 self.assertEquals(1, new_buckets[2])
27 self.assertEquals(10, new_buckets[3])
OLDNEW
« 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