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