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