From 4b775b444d1558705c4aa9a0b5f1d18e2a81f092 Mon Sep 17 00:00:00 2001 From: Golubev Alexander Date: Sat, 27 Jul 2013 03:05:37 +0400 Subject: tdehw: three more classes splited --- tdecore/tdehw/tdecpudevice.h | 186 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 tdecore/tdehw/tdecpudevice.h (limited to 'tdecore/tdehw/tdecpudevice.h') diff --git a/tdecore/tdehw/tdecpudevice.h b/tdecore/tdehw/tdecpudevice.h new file mode 100644 index 000000000..6037fcb69 --- /dev/null +++ b/tdecore/tdehw/tdecpudevice.h @@ -0,0 +1,186 @@ +/* This file is part of the TDE libraries + Copyright (C) 2012 Timothy Pearson + (C) 2013 Golubev Alexander + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _TDECPUDEVICE_H +#define _TDECPUDEVICE_H + +#include "tdegenericdevice.h" + +class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice +{ + public: + /** + * Constructor. + * @param Device type + */ + TDECPUDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null); + + /** + * Destructor. + */ + ~TDECPUDevice(); + + /** + * @return a double with the current CPU frequency in MHz, if available + */ + double frequency(); + + /** + * @return a double with the minimum CPU frequency in MHz, if available + */ + double minFrequency(); + + /** + * @return a double with the maximum CPU frequency in MHz, if available + */ + double maxFrequency(); + + /** + * @return a double with the transition latency in ns, if available + */ + double transitionLatency(); + + /** + * @return a TQString with the current CPU governor policy, if available + */ + TQString governor(); + + /** + * @return a TQString with the current CPU scaling driver, if available + */ + TQString scalingDriver(); + + /** + * @return a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available + */ + TQStringList dependentProcessors(); + + /** + * @return a TQStringList with all valid scaling frequencies in Hz, if available + */ + TQStringList availableFrequencies(); + + /** + * @return a TQStringList with all available governor policies, if available + */ + TQStringList availableGovernors(); + + /** + * @return TRUE if permissions allow the CPU governor to be set, FALSE if not + */ + bool canSetGovernor(); + + /** + * @param gv a TQString with the new CPU governor policy name + */ + void setGovernor(TQString gv); + + /** + * @return TRUE if permissions allow the CPU maximum frequency to be set, FALSE if not + */ + bool canSetMaximumScalingFrequency(); + + /** + * @param gv a double with the new CPU maximum frequency in MHz + */ + void setMaximumScalingFrequency(double fr); + + /** + * @return an integer with the core number, starting at 0 + */ + int coreNumber(); + + protected: + /** + * @param fr a double with the current CPU frequency in MHz, if available + * @internal + */ + void internalSetFrequency(double fr); + + /** + * @param fr a double with the minimum CPU frequency in MHz, if available + * @internal + */ + void internalSetMinFrequency(double fr); + + /** + * @param fr a double with the maximum CPU frequency in MHz, if available + * @internal + */ + void internalSetMaxFrequency(double fr); + + /** + * @param tl a double with the transition latency in ns, if available + * @internal + */ + void internalSetTransitionLatency(double tl); + + /** + * @param gr a TQString with the current CPU governor policy, if available + * @internal + */ + void internalSetGovernor(TQString gr); + + /** + * @param dr a TQString with the current CPU scaling driver, if available + * @internal + */ + void internalSetScalingDriver(TQString dr); + + /** + * @param dp a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available + * @internal + */ + void internalSetDependentProcessors(TQStringList dp); + + /** + * @param af a TQStringList with all valid scaling frequencies in Hz, if available + * @internal + */ + void internalSetAvailableFrequencies(TQStringList af); + + /** + * @param gp a TQStringList with all available governor policies, if available + * @internal + */ + void internalSetAvailableGovernors(TQStringList gp); + + /** + * @param cn an integer with the core number, starting at 0 + * @internal + */ + void internalSetCoreNumber(int cn); + + private: + double m_frequency; + double m_minfrequency; + double m_maxfrequency; + double m_transitionlatency; + TQString m_governor; + TQString m_scalingdriver; + TQStringList m_tiedprocs; + TQStringList m_frequencies; + TQStringList m_governers; + int m_corenumber; + + friend class TDEHardwareDevices; +}; + + +#endif // _TDECPUDEVICE_H -- cgit v1.2.1