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::linkUnspecifiedInputProperty(QVPropertyContainer *sourceContainer, QString sourcePropName, LinkType linkType)
00033 {
00034 QVWorker* worker;
00035 if((worker = dynamic_cast<QVWorker*>(sourceContainer)) != NULL)
00036 {
00037 int propType = worker->getPropertyType(sourcePropName);
00038 int cpusType = QVariant::fromValue(QVStat()).userType();
00039
00040 if (propType != cpusType) {
00041 std::cerr << "Warning: a cpuplot only can be linked to a QVStat property." << std::endl;
00042 return false;
00043 }
00044 else
00045 return QVPlot::linkUnspecifiedInputProperty(worker, sourcePropName, linkType);
00046 }
00047 else
00048 return false;
00049 }
00050
00051 QStringList QVCPUPlot::getPropertyCurvNames(QString property) const
00052 {
00053 const QVStat stat = getPropertyValue<QVStat>(property);
00054 return stat.getFlagNames();
00055 }
00056
00057 QList<double> QVCPUPlot::getPropertyCurvValues(QString property) const
00058 {
00059 const QVStat stat = getPropertyValue<QVStat>(property);
00060 return stat.getLastStats();
00061 }
00062
00063 QList<int> QVCPUPlot::getPropertyCurvOrders(QString property) const
00064 {
00065 const QVStat stat = getPropertyValue<QVStat>(property);
00066 return stat.getFlagOrder();
00067 }
00068