3 ** Copyright 2015, The Android Open Source Project
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
9 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
19 // Helper class to perform cpu setup (if needed) prior to a profile collection.
21 class HardwireCpuHelper {
24 // The constructor for this class checks to see if the 'mpdecision'
25 // service is running; if so (and if 'perform' is TRUE), then it
26 // disables the service and on-lines all of the available cores/cpus
27 // (anything listed in /sys/devices/system/cpu/possible). The
28 // destructor will re-enable the mpdecision service if it was
29 // previously disabled.
30 HardwireCpuHelper(bool perform);
31 virtual ~HardwireCpuHelper();
34 bool mpdecision_stopped_;
36 // Collect the number of available cpus/cores from /sys/devices/system/cpu/possible
39 // Returns TRUE if the system service 'mpdecision' is running
40 bool GetMpdecisionRunning();
42 // Online/offline the specified cpu
43 void OnlineCore(int whichCore, int onoff);
45 // Enable/disable the mpdecision service via the equivalent of
46 // setprop ctl.start mpdecision
47 // setprop ctl.stop mpdecision
48 void StopMpdecision();
49 void RestartMpdecision();