2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

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

Adding nullptr checks to sensors

parent 1fa777cf
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "SMUCNGPerfConfigurator.h" #include "SMUCNGPerfConfigurator.h"
SMUCNGPerfConfigurator::SMUCNGPerfConfigurator() : OperatorConfiguratorTemplate(){ SMUCNGPerfConfigurator::SMUCNGPerfConfigurator() : OperatorConfiguratorTemplate(){
_operatorName = "supermucngperf"; _operatorName = "supermucngperf";
_baseName = "sensor"; _baseName = "sensor";
} }
......
...@@ -16,8 +16,11 @@ SMUCNGPerfOperator::~SMUCNGPerfOperator() { ...@@ -16,8 +16,11 @@ SMUCNGPerfOperator::~SMUCNGPerfOperator() {
} }
void SMUCNGPerfOperator::printConfig(LOG_LEVEL ll) { void SMUCNGPerfOperator::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << " No Window: "; OperatorTemplate<SMUCSensorBase>::printConfig(ll);
OperatorTemplate<SMUCSensorBase>::printConfig(ll); LOG_VAR(ll) << " metric to position map: ";
for(auto &kv : _metricToPosition){
LOG_VAR(ll) << "Metric = " << kv.first << "Position = " << kv.second;
}
} }
void SMUCNGPerfOperator::compute(U_Ptr unit) { void SMUCNGPerfOperator::compute(U_Ptr unit) {
...@@ -31,7 +34,10 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) { ...@@ -31,7 +34,10 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) {
vector<reading_t> * bufferClocks = nullptr; vector<reading_t> * bufferClocks = nullptr;
bufferClocks = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, bufferClocks, false); //use absolute timestamp bufferClocks = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, bufferClocks, false); //use absolute timestamp
reading_t clockspersecond; reading_t clockspersecond;
bool wascalced = calculateMetricRatio(*(bufferClocks->begin()),*(bufferInstructions->begin()), outSensor->getScalingFactor(), clockspersecond); bool wascalced = false;
if(bufferInstructions != nullptr && bufferClocks != nullptr && bufferInstructions->size() > 0 && bufferClocks->size() > 0) {
wascalced = calculateMetricRatio(*(bufferClocks->begin()),*(bufferInstructions->begin()), outSensor->getScalingFactor(), clockspersecond);
}
delete bufferInstructions; delete bufferInstructions;
delete bufferClocks; delete bufferClocks;
if(wascalced) { if(wascalced) {
...@@ -43,9 +49,12 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) { ...@@ -43,9 +49,12 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) {
vector<reading_t> * bufferClocks = nullptr; vector<reading_t> * bufferClocks = nullptr;
bufferClocks = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, bufferClocks, false); //use absolute timestamp bufferClocks = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, bufferClocks, false); //use absolute timestamp
vector<reading_t> * bufferClockRef = nullptr; vector<reading_t> * bufferClockRef = nullptr;
bufferClockRef = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS_REF]]->getName(), timestamp, timestamp, bufferClockRef, false); //use absolute timestamp bufferClockRef = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS_REF]]->getName(), timestamp, timestamp, bufferClockRef, false); //use absolute timestamp
reading_t frequency; reading_t frequency;
bool wascalced = calculateFrequency(*(bufferClockRef->begin()),*(bufferClocks->begin()), MIN_FREQ_MHZ, MAX_FREQ_MHZ, frequency); bool wascalced = false;
if( bufferClocks != nullptr && bufferClockRef != nullptr && bufferClocks->size() > 0 && bufferClockRef->size() > 0){
wascalced = calculateFrequency(*(bufferClockRef->begin()),*(bufferClocks->begin()), MIN_FREQ_MHZ, MAX_FREQ_MHZ, frequency);
}
delete bufferClocks; delete bufferClocks;
delete bufferClockRef; delete bufferClockRef;
if(wascalced) { if(wascalced) {
......
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