00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <iostream>
00026 #include <qvgui/qvcpuplot.h>
00027
00028 QVCpuPlot::QVCpuPlot(const QString name, bool decorations, bool autoShow, bool time, int step, QWidget *parent):
00029 QVPlot(name, decorations, true, true, autoShow, time, step, parent)
00030 { }
00031
00032 bool QVCpuPlot::linkProperty(QVWorker &worker, const QString propertyName)
00033 {
00034 int propType = worker.getPropertyType(propertyName);
00035 int cpusType = QVariant::fromValue(QVStat()).userType();
00036
00037 if (propType != cpusType) {
00038 std::cerr << "Warning: a cpuplot only can be linked to a QVStat property." << std::endl;
00039 return false;
00040 }
00041 else
00042 return QVPlot::linkProperty(worker, propertyName);
00043 }
00044
00045 bool QVCpuPlot::linkProperty(QVWorker &worker)
00046 {
00047 return QVPlot::linkProperty(worker, "cpu stats");
00048 }
00049
00050 QStringList QVCpuPlot::getPropertyCurvNames(QString property) const
00051 {
00052 const QVStat stat = getPropertyValue<QVStat>(property);
00053 return stat.getFlagNames();
00054 }
00055
00056 QList<double> QVCpuPlot::getPropertyCurvValues(QString property) const
00057 {
00058 const QVStat stat = getPropertyValue<QVStat>(property);
00059 return stat.getLastStats();
00060 }
00061
00062 QList<int> QVCpuPlot::getPropertyCurvOrders(QString property) const
00063 {
00064 const QVStat stat = getPropertyValue<QVStat>(property);
00065 return stat.getFlagOrder();
00066 }
00067