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

Side by Side Diff: remoting/base/process_stats.h

Issue 2775983003: [Chromoting] Retrieve process resource usage (ProcessStats) and its tests (Closed)
Patch Set: Resolve review comments Created 3 years, 8 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 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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698