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
00029 QVCpuPlot::QVCpuPlot(const QString name, bool decorations, bool autoShow, bool time, int step, QWidget *parent):
00030 QVPlot(name, decorations, true, true, autoShow, time, step, parent)
00031 { }
00032
00033 void QVCpuPlot::linkProperty(QVWorker &worker, const QString propertyName)
00034 {
00035 int propType = worker.getPropertyType(propertyName);
00036 int cpusType = QVariant::fromValue(QVStat()).userType();
00037
00038 if (propType != cpusType)
00039 std::cerr << "Warning: a cpuplot only can be linked to a QVStat property." << std::endl;
00040 else
00041 QVPlot::linkProperty(worker, propertyName);
00042 }
00043
00044 void QVCpuPlot::linkProperty(QVWorker &worker)
00045 {
00046 QVPlot::linkProperty(worker, "cpu stats");
00047 }
00048
00049 QStringList QVCpuPlot::getPropertyCurvNames(QString property) const
00050 {
00051 const QVStat stat = getPropertyValue<QVStat>(property);
00052 return stat.getFlagNames();
00053 }
00054
00055 QList<double> QVCpuPlot::getPropertyCurvValues(QString property) const
00056 {
00057 const QVStat stat = getPropertyValue<QVStat>(property);
00058 return stat.getLastStats();
00059 }
00060
00061 QList<int> QVCpuPlot::getPropertyCurvOrders(QString property) const
00062 {
00063 const QVStat stat = getPropertyValue<QVStat>(property);
00064 return stat.getFlagOrder();
00065 }
00066