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

Side by Side Diff: client/third_party/infra_libs/ts_mon/common/distribution.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 import bisect 5 import bisect
6 import collections 6 import collections
7 7
8 8
9 class Bucketer(object): 9 class Bucketer(object):
10 """Bucketing function for histograms recorded by the Distribution class.""" 10 """Bucketing function for histograms recorded by the Distribution class."""
11 11
12 def __init__(self, width, growth_factor, num_finite_buckets): 12 def __init__(self, width, growth_factor, num_finite_buckets):
13 """The bucket sizes are controlled by width and growth_factor, and the total 13 """The bucket sizes are controlled by width and growth_factor, and the total
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 def __init__(self, bucketer): 115 def __init__(self, bucketer):
116 self.bucketer = bucketer 116 self.bucketer = bucketer
117 self.sum = 0 117 self.sum = 0
118 self.count = 0 118 self.count = 0
119 self.buckets = collections.defaultdict(int) 119 self.buckets = collections.defaultdict(int)
120 120
121 def add(self, value): 121 def add(self, value):
122 self.buckets[self.bucketer.bucket_for_value(value)] += 1 122 self.buckets[self.bucketer.bucket_for_value(value)] += 1
123 self.sum += value 123 self.sum += value
124 self.count += 1 124 self.count += 1
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698