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

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

Issue 2632803002: Remove all blimp network code. (Closed)
Patch Set: merge from origin/master for good measure Created 3 years, 11 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
« no previous file with comments | « blimp/net/blimp_net_export.h ('k') | blimp/net/blimp_stats.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_STATS_H_
6 #define BLIMP_NET_BLIMP_STATS_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/atomicops.h"
12 #include "base/lazy_instance.h"
13 #include "base/macros.h"
14 #include "blimp/net/blimp_net_export.h"
15
16 namespace blimp {
17
18 // Maintains counters for completed commits, network bytes sent and
19 // network bytes received. Counters increase monotonically over the
20 // lifetime of the process.
21 // Class is thread-safe. Individual metrics may be safely modified or retrieved
22 // concurrently.
23 class BLIMP_NET_EXPORT BlimpStats {
24 public:
25 enum EventType {
26 BYTES_SENT,
27 BYTES_RECEIVED,
28 COMMIT,
29 EVENT_TYPE_MAX = COMMIT,
30 };
31
32 static BlimpStats* GetInstance();
33
34 // Increments the metric |type| by |amount|. |amount| must be a positive
35 // value.
36 void Add(EventType type, base::subtle::Atomic32 amount);
37
38 // Returns value for the metric |type|.
39 base::subtle::Atomic32 Get(EventType type) const;
40
41 private:
42 friend struct base::DefaultLazyInstanceTraits<BlimpStats>;
43
44 static base::LazyInstance<BlimpStats> instance_;
45
46 BlimpStats();
47 ~BlimpStats();
48
49 // Values must be read or modified using base::subtle::NoBarrier* functions.
50 // We are using the NoBarrier* functions because we value performance over
51 // accuracy of the data.
52 base::subtle::Atomic32 values_[EVENT_TYPE_MAX + 1];
53
54 DISALLOW_COPY_AND_ASSIGN(BlimpStats);
55 };
56
57 } // namespace blimp
58
59 #endif // BLIMP_NET_BLIMP_STATS_H_
OLDNEW
« no previous file with comments | « blimp/net/blimp_net_export.h ('k') | blimp/net/blimp_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698