PCMGPU.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "../include/PCMGPU.h"
00030
00031 namespace ParCompMark
00032 {
00033
00034
00035
00036
00037
00038 GPU::GPU(const std::string & name, const OutputNode::NodeType & type):
00039
00040 OutputNode(name
00041 , type
00042 )
00043
00044
00045
00046
00047
00048 {
00049
00050 mVendor = "";
00051 mModel = "";
00052 mMemorySize = 0;
00053 mLoadPerSecond = 0.0;
00054
00055 }
00056
00057
00058
00059 GPU::~GPU()
00060 {
00061 }
00062
00063
00064
00065
00066
00067
00068
00069 GPU::Pointer GPU::parseXML(TiXmlElement * &tiGPU)
00070 {
00071
00072 std::string gpuNamespace;
00073 std::string gpuName;
00074
00075 std::string gpuTag(tiGPU->Value());
00076 std::string::size_type pos = gpuTag.find_first_of(":");
00077 if(pos != std::string::npos)
00078 {
00079 gpuNamespace = gpuTag.substr(0, pos);
00080 gpuName = gpuTag.substr(pos + 1);
00081 } else
00082 {
00083 gpuNamespace = "info";
00084 gpuName = "NoNameGPU";
00085 }
00086
00087 OutputNode::NodeType nspace;
00088
00089 if(gpuNamespace == "def")
00090 nspace = OutputNode::DEFINITION;
00091 else if(gpuNamespace == "info")
00092 nspace = OutputNode::INFORMATION;
00093 else if(gpuNamespace == "ref")
00094 nspace = OutputNode::REFERENCE;
00095 else if(gpuNamespace == "stat")
00096 nspace = OutputNode::STATISTICS;
00097
00098 GPU::Pointer myGPU = GPU::Pointer(new GPU(gpuName, nspace));
00099
00100 TiXmlElement *tiParam = tiGPU->FirstChildElement();
00101
00102 for(; tiParam != NULL; tiParam = tiParam->NextSiblingElement())
00103 {
00104 std::string name(tiParam->Attribute("name"));
00105 std::string value(tiParam->Attribute("value"));
00106
00107
00108
00109 }
00110
00111 return GPU::Pointer(myGPU);
00112 }
00113
00114
00115
00116
00117
00118
00119
00120 void GPU::refreshData()
00121 {
00122
00123 XDisplay::Pointer display(new XDisplay(""));
00124
00125 display->initialize();
00126
00127 int num = ScreenCount(display->getDisplay());
00128
00129 OutputNode::Pointer p = createChildNode("screen-number", OutputNode::INFORMATION);
00130
00131 p->setAttribute("screen-number", StringConverter::toString(num));
00132
00133 }
00134
00135
00136
00137 }