Hi,
here some changes for the processor related code in Solid.
1.) change return type of maxSpeed() from qulonglong to int since there is a
bug in the HAL spec, it should be int and the only case where this property
is currently set (in the freebsd code of HAL) it's also in.
Note: Currently the property is not mandatory in HAL and the key get never set
for the Linux backend. I work on a patch for HAL to fix this if possible.
2.) replace canThrottle() with canChangeFrequency(): Throtttling is not useful
and should never used. It reduce only the CPU performance and don't reduce
power consumption - in fact it cost more power than without throttle the CPU.
What really interesting is: can the processor change the CPU frequency
(support the machine e.g. speedstep).
The function is only a dummy for now - we need a change in HAL to set a useful
property to the processor device which indicates if CPU freq is supported. I
work also on this.
Danny
Index: ifaces/processor.h
===================================================================
--- ifaces/processor.h (Revision 659745)
+++ ifaces/processor.h (Arbeitskopie)
@@ -49,17 +49,17 @@
*
* @return the maximum speed in MHz
*/
- virtual qulonglong maxSpeed() const = 0;
+ virtual int maxSpeed() const = 0;
/**
- * Indicates if the processor can throttle.
+ * Indicates if the processor can change the CPU frequency.
*
- * A processor supports throttling when it's able of decreasing
- * it's own clockspeed (generally for power management).
+ * True if a processor is able to change it's own CPU frequency.
+ * (generally for power management).
*
- * @return true if the processor can throttle, false otherwise
+ * @return true if the processor can change CPU frequency, false otherwise
*/
- virtual bool canThrottle() const = 0;
+ virtual bool canChangeFrequency() const = 0;
};
}
}
Index: processor.h
===================================================================
--- processor.h (Revision 659745)
+++ processor.h (Arbeitskopie)
@@ -76,17 +76,17 @@
*
* @return the maximum speed in MHz
*/
- qulonglong maxSpeed() const;
+ int maxSpeed() const;
/**
- * Indicates if the processor can throttle.
+ * Indicates if the processor can change the CPU frequency.
*
- * A processor supports throttling when it's able of decreasing
- * it's own clockspeed (generally for power management).
+ * True if a processor is able to change it's own CPU frequency.
+ * (generally for power management).
*
- * @return true if the processor can throttle, false otherwise
+ * @return true if the processor can change CPU frequency, false otherwise
*/
- bool canThrottle() const;
+ bool canChangeFrequency();
};
}
Index: processor.cpp
===================================================================
--- processor.cpp (Revision 659745)
+++ processor.cpp (Arbeitskopie)
@@ -40,16 +40,16 @@
return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), 0, number());
}
-qulonglong Solid::Processor::maxSpeed() const
+int Solid::Processor::maxSpeed() const
{
Q_D(const Processor);
return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), 0, maxSpeed());
}
-bool Solid::Processor::canThrottle() const
+bool Solid::Processor::canChangeFrequency() const
{
Q_D(const Processor);
- return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), false, canThrottle());
+ return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), false, canChangeFrequency());
}
#include "processor.moc"
Index: backends/hal/halprocessor.h
===================================================================
--- backends/hal/halprocessor.h (Revision 659745)
+++ backends/hal/halprocessor.h (Arbeitskopie)
@@ -35,8 +35,8 @@
virtual ~Processor();
virtual int number() const;
- virtual qulonglong maxSpeed() const;
- virtual bool canThrottle() const;
+ virtual int maxSpeed() const;
+ virtual bool canChangeFrequency() const;
};
#endif
Index: backends/hal/halprocessor.cpp
===================================================================
--- backends/hal/halprocessor.cpp (Revision 659745)
+++ backends/hal/halprocessor.cpp (Arbeitskopie)
@@ -37,14 +37,16 @@
return m_device->property("processor.number").toInt();
}
-qulonglong Processor::maxSpeed() const
+int Processor::maxSpeed() const
{
- return m_device->property("processor.maximum_speed").toULongLong();
+ // the property is not mandatory in HAL
+ return m_device->property("processor.maximum_speed").toInt();
}
-bool Processor::canThrottle() const
+bool Processor::canChangeFrequency() const
{
- return m_device->property("processor.can_throttle").toBool();
+ // dummy for now, need some changes in HAL!
+ return false;
}
#include "backends/hal/halprocessor.moc"
_______________________________________________
Kde-hardware-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-hardware-devel