| // Copyright 2020 The Chromium OS Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "vm_tools/concierge/vm_base_impl.h" |
| |
| #include <base/files/file_path.h> |
| #include "vm_tools/concierge/vm_util.h" |
| |
| namespace vm_tools { |
| namespace concierge { |
| |
| // static |
| bool VmBaseImpl::SetVmCpuRestriction(CpuRestrictionState cpu_restriction_state, |
| const char* CpuCgroup) { |
| int cpu_shares = 1024; // TODO(sonnyrao): Adjust |cpu_shares|. |
| switch (cpu_restriction_state) { |
| case CPU_RESTRICTION_FOREGROUND: |
| break; |
| case CPU_RESTRICTION_BACKGROUND: |
| cpu_shares = 64; |
| break; |
| default: |
| NOTREACHED(); |
| } |
| return UpdateCpuShares(base::FilePath(CpuCgroup), cpu_shares); |
| } |
| |
| } // namespace concierge |
| } // namespace vm_tools |