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

Unified Diff: remoting/base/running_average.cc

Issue 1811833002: Show max latency on client's status bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: JS compiler fix and lld fix Created 4 years, 9 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 | « remoting/base/running_average.h ('k') | remoting/base/running_average_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/running_average.cc
diff --git a/remoting/base/running_average.cc b/remoting/base/running_average.cc
deleted file mode 100644
index 5e24c0de3a95672c1e4f8d4c5b67cf5b11db81ba..0000000000000000000000000000000000000000
--- a/remoting/base/running_average.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "remoting/base/running_average.h"
-
-#include "base/logging.h"
-
-namespace remoting {
-
-RunningAverage::RunningAverage(int window_size)
- : window_size_(window_size),
- sum_(0) {
- DCHECK_GT(window_size, 0);
-}
-
-RunningAverage::~RunningAverage() {}
-
-void RunningAverage::Record(int64_t value) {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- data_points_.push_back(value);
- sum_ += value;
-
- if (data_points_.size() > window_size_) {
- sum_ -= data_points_[0];
- data_points_.pop_front();
- }
-}
-
-double RunningAverage::Average() {
- DCHECK(thread_checker_.CalledOnValidThread());
-
- if (data_points_.empty())
- return 0;
- return static_cast<double>(sum_) / data_points_.size();
-}
-
-} // namespace remoting
« no previous file with comments | « remoting/base/running_average.h ('k') | remoting/base/running_average_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698