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

Side by Side Diff: blimp/net/blimp_connection_statistics.h

Issue 1962393004: Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added statistics object to BlimpEngineSession Created 4 years, 7 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 unified diff | Download patch
OLDNEW
(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 #ifndef BLIMP_NET_BLIMP_CONNECTION_STATISTICS_H_
6 #define BLIMP_NET_BLIMP_CONNECTION_STATISTICS_H_
7
8 #include <map>
9 #include "base/macros.h"
10 #include "base/metrics/sparse_histogram.h"
11 #include "blimp/net/blimp_net_export.h"
12
13 namespace blimp {
14
15 // Collects network traffic statistics. Maintains a counter for number of
16 // completed commits, bytes sent and received over network and notifies its
17 // observers on the main thread.
18 // This class is supposed to live an entire session, created and destroyed along
19 // it. This class is thread-safe.
20 class BLIMP_NET_EXPORT BlimpConnectionStatistics {
21 public:
22 enum EventType {
23 BYTES_SENT = 0,
24 BYTES_RECEIVED = 1,
25 COMMIT = 2,
26 };
27
28 BlimpConnectionStatistics();
29
30 ~BlimpConnectionStatistics();
31
32 // Accumulates values for a metrics.
Kevin M 2016/05/24 22:56:40 a metric
33 void Add(EventType type, int data);
34
35 // Returns value for a metric.
36 int Get(EventType type);
37
38 private:
39 // A histogram to hold the metrics. It will have one sample for each type of
40 // metric which will be accumulated on each subsequent call.
41 std::unique_ptr<base::HistogramBase> histogram_;
42
43 DISALLOW_COPY_AND_ASSIGN(BlimpConnectionStatistics);
44 };
45
46 } // namespace blimp
47
48 #endif // BLIMP_NET_BLIMP_CONNECTION_STATISTICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698