Index: blimp/net/blimp_connection_statistics.cc |
diff --git a/blimp/net/blimp_connection_statistics.cc b/blimp/net/blimp_connection_statistics.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b61d23b718aec45a70451f66cc4a33a3edadbad7 |
--- /dev/null |
+++ b/blimp/net/blimp_connection_statistics.cc |
@@ -0,0 +1,26 @@ |
+// 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. |
+ |
+#include "blimp/net/blimp_connection_statistics.h" |
+ |
+namespace blimp { |
+ |
+BlimpConnectionStatistics::BlimpConnectionStatistics() |
+ : histogram_( |
+ base::SparseHistogram::FactoryGet("BlimpSparseHistogram", |
+ base::HistogramBase::kNoFlags)) {} |
+ |
+BlimpConnectionStatistics::~BlimpConnectionStatistics() {} |
+ |
+void BlimpConnectionStatistics::Add(EventType type, int data) { |
+ histogram_->AddCount(type, data); |
+} |
+ |
+int BlimpConnectionStatistics::Get(EventType type) { |
+ std::unique_ptr<base::HistogramSamples> snapshot = |
+ histogram_->SnapshotSamples(); |
+ return snapshot->GetCount(type); |
+} |
+ |
+} // namespace blimp |