Commit be0defe1 authored by Carla Guillen's avatar Carla Guillen
Browse files

fixing bugs

parent de8e771e
......@@ -42,19 +42,19 @@ void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL config) {
unsigned int position = std::stoul(val.second.data());
s.setPosition(position);
std::string name = s.getName();
if(name.compare("instructions")==0){
if(name.find("instructions") != std::string::npos){
_metricToPosition[SMUCSensorBase::INSTRUCTIONS] = position;
s.setMetric(SMUCSensorBase::INSTRUCTIONS);
} else if(name.compare("clocks") == 0){
} else if(name.find("clocks") != std::string::npos){
_metricToPosition[SMUCSensorBase::CLOCKS] = position;
s.setMetric(SMUCSensorBase::CLOCKS);
} else if(name.compare("ref_clocks") == 0){
} else if(name.find("ref_clocks") != std::string::npos){
_metricToPosition[SMUCSensorBase::CLOCKS_REF] = position;
s.setMetric(SMUCSensorBase::CLOCKS_REF);
} else if(name.compare("cpi") == 0){
} else if(name.find("cpi") != std::string::npos){
_metricToPosition[SMUCSensorBase::CPI] = position;
s.setMetric(SMUCSensorBase::CPI);
} else if(name.compare("frequency") == 0){
} else if(name.find("frequency") != std::string::npos){
_metricToPosition[SMUCSensorBase::FREQUENCY] = position;
s.setMetric(SMUCSensorBase::FREQUENCY);
}
......
......@@ -29,20 +29,22 @@
#include "SMUCNGPerfOperator.h"
SMUCNGPerfOperator::SMUCNGPerfOperator(const std::string& name): OperatorTemplate(name) {
_buffers.resize(10);
_buffers.resize(10);
}
SMUCNGPerfOperator::~SMUCNGPerfOperator() {
}
SMUCNGPerfOperator::SMUCNGPerfOperator(const SMUCNGPerfOperator& other) : OperatorTemplate(other){
this->_buffers = other._buffers;
this->_buffers = other._buffers;
this->_metricToPosition = other._metricToPosition;
}
SMUCNGPerfOperator& SMUCNGPerfOperator::operator=(const SMUCNGPerfOperator& other){
OperatorTemplate::operator =(other);
this->_buffers = other._buffers;
return *this;
OperatorTemplate::operator =(other);
this->_buffers = other._buffers;
this->_metricToPosition = other._metricToPosition;
return *this;
}
void SMUCNGPerfOperator::printConfig(LOG_LEVEL ll) {
......@@ -67,7 +69,6 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) {
for(auto& outSensor : unit->getOutputs()){
if( outSensor->getMetric() == SMUCSensorBase::CPI) {
std::cout << "CPI found!";
std::vector<reading_t> & instructions = _buffers[0];
std::vector<reading_t> & clocks = _buffers[1];
query(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, instructions);
......@@ -78,7 +79,6 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) {
outSensor->storeReading(cpi);
}
} else if (outSensor->getMetric() == SMUCSensorBase::FREQUENCY) {
std::cout << "Frequency found!";
std::vector<reading_t> & clocks = _buffers[0];
std::vector<reading_t> & clocks_ref = _buffers[1];
query(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, clocks);
......
......@@ -37,24 +37,24 @@ private:
std::map<SMUCSensorBase::Metric_t, unsigned int> _metricToPosition;
public:
SMUCNGPerfOperator(const std::string& name);
virtual ~SMUCNGPerfOperator();
SMUCNGPerfOperator(const SMUCNGPerfOperator& other);
SMUCNGPerfOperator& operator=(const SMUCNGPerfOperator& other);
SMUCNGPerfOperator(const std::string& name);
virtual ~SMUCNGPerfOperator();
SMUCNGPerfOperator(const SMUCNGPerfOperator& other);
SMUCNGPerfOperator& operator=(const SMUCNGPerfOperator& other);
void printConfig(LOG_LEVEL ll) override;
void setMetricToPosition(const std::map<SMUCSensorBase::Metric_t,unsigned int>&metricToPosition) {
void setMetricToPosition(const std::map<SMUCSensorBase::Metric_t,unsigned int>&metricToPosition) {
_metricToPosition = metricToPosition;
}
}
protected:
virtual void compute(U_Ptr unit) override;
vector<vector<reading_t>> _buffers;
const unsigned int MAX_FREQ_MHZ = 2700;
const unsigned int MIN_FREQ_MHZ = 1200;
const unsigned int MAX_FREQ_MHZ = 2700;
const unsigned int MIN_FREQ_MHZ = 1200;
void resetBuffers();
void query(const std::string & sensor_name, const uint64_t timestamp, vector<reading_t> &buffer);
void resetBuffers();
void query(const std::string & sensor_name, const uint64_t timestamp, vector<reading_t> &buffer);
};
#endif /* ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_ */
......@@ -48,6 +48,7 @@ public:
SMUCSensorBase& operator=(const SMUCSensorBase& other){
SensorBase::operator=(other);
copy(other);
return *this;
}
virtual ~SMUCSensorBase(){}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment