/* * SMUCNGPerfAnalyzer.cpp * * Created on: Jul 20, 2019 * Author: carla */ #include "SMUCNGPerfAnalyzer.h" SMUCNGPerfAnalyzer::SMUCNGPerfAnalyzer() { } SMUCNGPerfAnalyzer::~SMUCNGPerfAnalyzer() { } void SMUCNGPerfAnalyzer::printConfig(LOG_LEVELll) { LOG_VAR(ll) << " Window: " << _window; AnalyzerTemplate::printConfig(ll); } void SMUCNGPerfAnalyzer::compute(U_Ptr unit) { auto inputs = unit->getInputs(); auto timestamp = getTimestamp(); //ToDo timestamp minus some time... vector * _bufferInstructions = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, timestamp, _bufferInstructions, false); //use absolute timestamp vector * _bufferClocks = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, _bufferClocks, false); //use absolute timestamp reading_t clockspersecond; bool wascalced = calculateMetricRatio(*(_bufferClocks->begin()),*(_bufferInstructions->begin()), 1, clockspersecond); delete _bufferInstructions; delete _bufferClocks; if(wascalced) { auto outputs = unit->getOutputs(); outputs[0]->storeReading(clockspersecond); } }