Chromium Code Reviews| 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..541e860f74525a36ccf6cbcfa132c17ea5092149 |
| --- /dev/null |
| +++ b/blimp/net/blimp_connection_statistics.cc |
| @@ -0,0 +1,28 @@ |
| +// 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" |
| + |
| +#include "base/logging.h" |
|
Kevin M
2016/05/24 21:49:00
Not used.
shaktisahu
2016/05/24 22:42:14
Done.
shaktisahu
2016/05/24 22:42:14
Done.
|
| + |
| +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 |