cpufreq_management.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *                         Powersave Daemon                                *
00004  *                                                                         *
00005  *          Copyright (C) 2004,2005,2006 SUSE Linux Products GmbH          *
00006  *                                                                         *
00007  *               Author(s): Holger Macht <hmacht@suse.de>                  *
00008  *                                                                         *
00009  * This program is free software; you can redistribute it and/or modify it *
00010  * under the terms of the GNU General Public License as published by the   *
00011  * Free Software Foundation; either version 2 of the License, or (at you   *
00012  * option) any later version.                                              *
00013  *                                                                         *
00014  * This program is distributed in the hope that it will be useful, but     *
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of              *
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
00017  * General Public License for more details.                                *
00018  *                                                                         *
00019  * You should have received a copy of the GNU General Public License along *
00020  * with this program; if not, write to the Free Software Foundation, Inc., *
00021  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA                  *
00022  *                                                                         *
00023  ***************************************************************************/
00024 
00025 #ifndef CPUFREQ_MANAGEMENT_H
00026 #define CPUFREQ_MANAGEMENT_H
00027 
00028 #include <list>
00029 #include "cpufreq_interface.h"
00030 
00032 class CpufreqManagement {
00033 public:
00035         CpufreqManagement();
00036 
00038         ~CpufreqManagement();
00039 
00041         void init();
00042 
00047         bool isSupported();
00048 
00052         void adjustSpeeds();
00053 
00059         int setModes(CPUFREQ_MODE mode, EventManagement *eM);
00060 
00065         CPUFREQ_MODE getMode();
00066 
00075         void reinitSpeeds();
00076 
00081         void rereadFrequencies();
00082 
00084         int setGovernors(const string &new_governor);
00085 
00087         void setConfigs();
00088 
00093         CPUFREQ_CONTROL_MODE controlMode();
00094 
00100         int enableCPU(int cpu);
00101 
00107         int disableCPU(int cpu);
00108         
00110         bool hasControlMode(CPUFREQ_CONTROL_MODE control_mode);
00111 
00112 #ifdef CPUFREQ_MEASURE
00113 
00114         void startMeasures();
00116         void stopMeasures();
00117 #endif
00118 
00119 private:
00131         bool initSingleInterface(std::list< int > &cores, CPUFREQ_CONTROL_MODE control_mode);
00132 
00153         bool getCoresAffectedCpus(std::list< std::list< int> > &cpu_list, int num_cpus);
00154         
00165         bool getCoresProcfile(list< list< int > > & cpu_list, int num_cpus);
00166 
00174         bool readCpu(std::list< int > & core_list, int cpu);
00175 
00183         bool siblingExists(list< int > core_list, int core);
00184 
00186         void checkCPUHotplug();
00187 
00189         std::list< CPUFreq_Interface* > _cpufreq_objects;
00190 
00192         std::list< std::list< int > > _cpus;
00193 
00195         int _control_modes;
00196 
00203         CPUFREQ_CONTROL_MODE _initial_control_mode;
00204 
00206         int _initial_cpu_count;
00207 };
00208 
00209 
00210 #endif // CPUFREQ_MANAGEMENT_H

Generated on Mon Mar 27 09:27:19 2006 for Powersave Daemon by  doxygen 1.4.6