OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 |
| 5 #include "blimp/net/blimp_connection_statistics.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 namespace blimp { |
| 10 |
| 11 BlimpConnectionStatistics::BlimpConnectionStatistics() |
| 12 : histogram_( |
| 13 base::SparseHistogram::FactoryGet("BlimpSparseHistogram", |
| 14 base::HistogramBase::kNoFlags)) {} |
| 15 |
| 16 BlimpConnectionStatistics::~BlimpConnectionStatistics() {} |
| 17 |
| 18 void BlimpConnectionStatistics::Add(EventType type, int data) { |
| 19 histogram_->AddCount(type, data); |
| 20 } |
| 21 |
| 22 int BlimpConnectionStatistics::Get(EventType type) { |
| 23 std::unique_ptr<base::HistogramSamples> snapshot = |
| 24 histogram_->SnapshotSamples(); |
| 25 return snapshot->GetCount(type); |
| 26 } |
| 27 |
| 28 } // namespace blimp |
OLD | NEW |