| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PROCESS_COORDINATION_UNI
T_IMPL_H_ | 5 #ifndef SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PROCESS_COORDINATION_UNI
T_IMPL_H_ |
| 6 #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PROCESS_COORDINATION_UNI
T_IMPL_H_ | 6 #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PROCESS_COORDINATION_UNI
T_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/process/process_metrics.h" | 11 #include "base/process/process_metrics.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "services/resource_coordinator/coordination_unit/coordination_unit_impl
.h" | 13 #include "services/resource_coordinator/coordination_unit/coordination_unit_impl
.h" |
| 14 | 14 |
| 15 namespace service_manager { | 15 namespace service_manager { |
| 16 class ServiceContextRef; | 16 class ServiceContextRef; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace resource_coordinator { | 19 namespace resource_coordinator { |
| 20 | 20 |
| 21 struct CoordinationUnitID; | 21 struct CoordinationUnitID; |
| 22 | 22 |
| 23 class ProcessCoordinationUnitImpl : public CoordinationUnitImpl { | 23 class ProcessCoordinationUnitImpl : public CoordinationUnitImpl { |
| 24 public: | 24 public: |
| 25 ProcessCoordinationUnitImpl( | 25 ProcessCoordinationUnitImpl( |
| 26 const CoordinationUnitID& id, | 26 const CoordinationUnitID& id, |
| 27 std::unique_ptr<service_manager::ServiceContextRef> service_ref); | 27 std::unique_ptr<service_manager::ServiceContextRef> service_ref); |
| 28 ~ProcessCoordinationUnitImpl() override; | 28 ~ProcessCoordinationUnitImpl() override; |
| 29 void MeasureProcessCPUUsage(); | 29 void MeasureProcessCPUUsage(); |
| 30 double GetCPUUsageForTesting() override; | |
| 31 | 30 |
| 32 private: | 31 private: |
| 33 std::unique_ptr<base::ProcessMetrics> process_metrics_; | 32 std::unique_ptr<base::ProcessMetrics> process_metrics_; |
| 34 base::OneShotTimer repeating_timer_; | 33 base::OneShotTimer repeating_timer_; |
| 35 double cpu_usage_; | |
| 36 | 34 |
| 37 DISALLOW_COPY_AND_ASSIGN(ProcessCoordinationUnitImpl); | 35 DISALLOW_COPY_AND_ASSIGN(ProcessCoordinationUnitImpl); |
| 38 }; | 36 }; |
| 39 | 37 |
| 40 } // namespace resource_coordinator | 38 } // namespace resource_coordinator |
| 41 | 39 |
| 42 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PROCESS_COORDINATION_
UNIT_IMPL_H_ | 40 #endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_PROCESS_COORDINATION_
UNIT_IMPL_H_ |
| OLD | NEW |