OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 REMOTING_BASE_PROCESS_STATS_H_ | |
6 #define REMOTING_BASE_PROCESS_STATS_H_ | |
7 | |
8 #include <memory> | |
9 #include <vector> | |
10 | |
11 #include "base/time/time.h" | |
12 #include "base/timer/timer.h" | |
13 #include "remoting/base/process_stats_agent.h" | |
14 #include "remoting/base/process_stats_stub.h" | |
15 #include "remoting/proto/process_stats.pb.h" | |
Sergey Ulanov
2017/04/03 23:50:21
base shouldn't depend on proto.
Hzj_jie
2017/04/05 20:52:16
These files have been moved to host.
| |
16 | |
17 namespace remoting { | |
18 | |
19 // A component to report process statistic data regularly. | |
20 class ProcessStats final { | |
Sergey Ulanov
2017/04/03 23:50:21
Maybe ProcessStatsSender?
Hzj_jie
2017/04/05 20:52:16
Done.
| |
21 public: | |
22 // ProcessStats does not take the ownership of |host_stats_stub|. It needs to | |
23 // be outlived this instance. | |
Sergey Ulanov
2017/04/03 23:50:21
s/It needs to be outlived this instance./It must o
Hzj_jie
2017/04/05 20:52:16
Done.
| |
24 ProcessStats(ProcessStatsStub* host_stats_stub, base::TimeDelta interval); | |
25 | |
26 // Needs to be destructed on the same thread as constructing. | |
27 ~ProcessStats(); | |
28 | |
29 void AddProcessStatsAgent(std::unique_ptr<ProcessStatsAgent> agent); | |
30 | |
31 // ProcessStats starts immediately, and reports the statistic data to | |
32 // |host_stats_stub| once per |interval_|. | |
33 void Start(); | |
34 | |
35 void Stop(); | |
Sergey Ulanov
2017/04/03 23:50:21
Do we need this methods? Would it be better just d
Hzj_jie
2017/04/05 20:52:16
Emmm, indeed I believe this class should start imm
| |
36 | |
37 private: | |
38 void ReportUsage(); | |
39 | |
40 ProcessStatsStub* const host_stats_stub_; | |
41 const base::TimeDelta interval_; | |
42 std::vector<std::unique_ptr<ProcessStatsAgent>> agents_; | |
43 base::RepeatingTimer timer_; | |
44 }; | |
45 | |
46 } // namespace remoting | |
47 | |
48 #endif // REMOTING_BASE_PROCESS_STATS_H_ | |
OLD | NEW |