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

Side by Side Diff: src/procfs_byte_counter.h

Issue 6250171: cashew: reset local counter on plan transition (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: ers review comments Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/device_mock.h ('k') | src/procfs_byte_counter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SRC_PROCFS_BYTE_COUNTER_H_ 5 #ifndef SRC_PROCFS_BYTE_COUNTER_H_
6 #define SRC_PROCFS_BYTE_COUNTER_H_ 6 #define SRC_PROCFS_BYTE_COUNTER_H_
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include <glib.h> 10 #include <glib.h>
11 #include <sys/socket.h> 11 #include <sys/socket.h>
12 #include <linux/netdevice.h> 12 #include <linux/netdevice.h>
13 13
14 #include <string> 14 #include <string>
15 15
16 #include <base/basictypes.h> // NOLINT 16 #include <base/basictypes.h> // NOLINT
17 17
18 #include "src/byte_counter.h" 18 #include "src/byte_counter.h"
19 19
20 namespace cashew { 20 namespace cashew {
21 21
22 // a procfs-based implementation of the ByteCounter interface 22 // a procfs-based implementation of the ByteCounter interface
23 class ProcfsByteCounter: public ByteCounter { 23 class ProcfsByteCounter: public ByteCounter {
24 public: 24 public:
25 explicit ProcfsByteCounter(const std::string& interface); 25 explicit ProcfsByteCounter(const std::string& interface);
26 virtual ~ProcfsByteCounter(); 26 virtual ~ProcfsByteCounter();
27 virtual const std::string& GetInterface() const; 27 virtual const std::string& GetInterface() const;
28 virtual uint64 GetRxBytes() const; 28 virtual uint64 GetRxBytes() const;
29 virtual void SetRxBytes(uint64 rx_bytes);
29 virtual uint64 GetTxBytes() const; 30 virtual uint64 GetTxBytes() const;
31 virtual void SetTxBytes(uint64 tx_bytes);
30 virtual void SetDelegate(ByteCounterDelegate *delegate); 32 virtual void SetDelegate(ByteCounterDelegate *delegate);
31 33
32 private: 34 private:
33 // interface name 35 // interface name
34 const std::string interface_; 36 const std::string interface_;
35 37
36 // file pointer for open /proc/net/dev virtual file 38 // file pointer for open /proc/net/dev virtual file
37 // can be NULL 39 // can be NULL
38 FILE *proc_net_dev_fp_; 40 FILE *proc_net_dev_fp_;
39 41
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 // new stats are available, update counter 84 // new stats are available, update counter
83 void OnStatsUpdate(const struct net_device_stats& stats); 85 void OnStatsUpdate(const struct net_device_stats& stats);
84 86
85 DISALLOW_COPY_AND_ASSIGN(ProcfsByteCounter); 87 DISALLOW_COPY_AND_ASSIGN(ProcfsByteCounter);
86 }; 88 };
87 89
88 } // namespace cashew 90 } // namespace cashew
89 91
90 #endif // SRC_PROCFS_BYTE_COUNTER_H_ 92 #endif // SRC_PROCFS_BYTE_COUNTER_H_
OLDNEW
« no previous file with comments | « src/device_mock.h ('k') | src/procfs_byte_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698