00001 /*************************************************************************** 00002 * * 00003 * Powersave Daemon * 00004 * * 00005 * Copyright (C) 2004,2005 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 THROTTLE_INTERFACE_H 00026 #define THROTTLE_INTERFACE_H 00027 00028 class EventManagement; 00029 00032 enum PROCESSOR_EVENT_STATE { PROCESSOR_BUSY_THROWN, 00033 PROCESSOR_IDLE_THROWN, 00034 NO_PROCESSOR_EVENT_THROWN }; 00035 00037 class ThrottleInterface { 00038 public: 00040 ThrottleInterface(); 00041 00045 bool updateCPUState(EventManagement *eM); 00046 00053 bool throttle(int percent = -1); 00054 00059 bool dethrottle(); 00060 00064 void restart(); 00065 00067 void disableThrottling(); 00068 00069 private: 00072 unsigned long _msecs_cpu_idle; 00073 00079 bool _cpu_is_idle; 00080 00087 PROCESSOR_EVENT_STATE _event_state; 00088 00090 bool _throttling_supported; 00091 }; 00092 00093 #endif // THROTTLE_INTERFACE_H