Commit 669e5303 authored by Carla Guillen's avatar Carla Guillen

Adding analyzer plugin for supemucng. Now compilable

parent 143b4024
......@@ -4,7 +4,7 @@ include ../config.mk
CXXFLAGS += -DBOOST_NETWORK_ENABLE_HTTPS -I../common/include -I$(DCDBDEPLOYPATH)/include -I$(DCDBDEPLOYPATH)/include/opencv4
LIBS = -L../lib -L$(DCDBDEPLOYPATH)/lib/ -ldl -lboost_system -lboost_thread -lboost_log_setup -lboost_log -lboost_regex -lpthread -rdynamic
ANALYZERS = aggregator regressor job_aggregator testeranalyzer
ANALYZERS = aggregator regressor job_aggregator testeranalyzer smucngperfanalyzer
ifeq ($(OS),Darwin)
BACNET_PORT = bsd
......@@ -54,3 +54,6 @@ libdcdbanalyzer_job_aggregator.$(LIBEXT): analyzers/aggregator/AggregatorAnalyze
libdcdbanalyzer_testeranalyzer.$(LIBEXT): analyzers/testeranalyzer/TesterAnalyzer.o analyzers/testeranalyzer/TesterAnalyzerConfigurator.o ../common/src/sensornavigator.o
$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lboost_regex
libdcdbanalyzer_smucngperfanalyzer.$(LIBEXT): analyzers/smucngperfanalyzer/SMUCNGPerfAnalyzer.o analyzers/smucngperfanalyzer/SMUCNGPerfConfigurator.o ../common/src/sensornavigator.o
$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lboost_regex
......@@ -5,29 +5,32 @@
* Author: carla
*/
#include "../../commonderivedmetrics/DerivedMetrics.h"
#include "SMUCNGPerfAnalyzer.h"
SMUCNGPerfAnalyzer::SMUCNGPerfAnalyzer() {
SMUCNGPerfAnalyzer::SMUCNGPerfAnalyzer(const std::string& name): AnalyzerTemplate(name) {
}
SMUCNGPerfAnalyzer::~SMUCNGPerfAnalyzer() {
}
void SMUCNGPerfAnalyzer::printConfig(LOG_LEVELll) {
LOG_VAR(ll) << " Window: " << _window;
AnalyzerTemplate<AggregatorSensorBase>::printConfig(ll);
void SMUCNGPerfAnalyzer::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << " No Window: ";
AnalyzerTemplate<SMUCSensorBase>::printConfig(ll);
}
void SMUCNGPerfAnalyzer::compute(U_Ptr unit) {
auto inputs = unit->getInputs();
auto timestamp = getTimestamp(); //ToDo timestamp minus some time...
vector<reading_t> * _bufferInstructions = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, timestamp, _bufferInstructions, false); //use absolute timestamp
vector<reading_t> * _bufferClocks = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, _bufferClocks, false); //use absolute timestamp
vector<reading_t> * bufferInstructions = nullptr;
bufferInstructions = _queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, timestamp, bufferInstructions, false); //use absolute timestamp
vector<reading_t> * bufferClocks = nullptr;
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;
bool wascalced = calculateMetricRatio(*(bufferClocks->begin()),*(bufferInstructions->begin()), 1, clockspersecond);
delete bufferInstructions;
delete bufferClocks;
if(wascalced) {
auto outputs = unit->getOutputs();
outputs[0]->storeReading(clockspersecond);
......
......@@ -9,6 +9,7 @@
#define ANALYTICS_ANALYZERS_SMUCNGPERFANALYZER_SMUCNGPERFANALYZER_H_
#include "../../includes/AnalyzerTemplate.h"
#include "SMUCSensorBase.h"
#include <map>
class SMUCNGPerfAnalyzer: virtual public AnalyzerTemplate<SMUCSensorBase>{
......@@ -16,7 +17,7 @@ private:
std::map<SMUCSensorBase::Metrics, int> _metricToPosition;
public:
SMUCNGPerfAnalyzer();
SMUCNGPerfAnalyzer(const std::string& name);
virtual ~SMUCNGPerfAnalyzer();
void printConfig(LOG_LEVEL ll) override;
......
......@@ -15,7 +15,7 @@ SMUCNGPerfConfigurator::SMUCNGPerfConfigurator() : AnalyzerConfiguratorTemplate(
SMUCNGPerfConfigurator::~SMUCNGPerfConfigurator() {
}
void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL& config) {
void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL config) {
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
{
if (boost::iequals(val.first, "position")) {
......@@ -28,7 +28,7 @@ void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL& config) {
}
}
void SMUCNGPerfConfigurator::analyzer(SMUCNGPerfAnalyzer& a, CFG_VAL& config){
void SMUCNGPerfConfigurator::analyzer(SMUCNGPerfAnalyzer& a, CFG_VAL config){
a.setMetricToPosition(_metricToPosition);
}
......
......@@ -17,7 +17,7 @@ public:
CLOCKS
};
public:
SMUCSensorBase(){}
SMUCSensorBase(const std::string& name): SensorBase(name){}
virtual ~SMUCSensorBase(){}
};
......
......@@ -8,6 +8,7 @@
#ifndef ANALYTICS_COMMONDERIVEDMETRICS_DERIVEDMETRICS_H_
#define ANALYTICS_COMMONDERIVEDMETRICS_DERIVEDMETRICS_H_
#include "cacheentry.h"
/**
* For CPI, LoadsToStore, Branch rate, miss branch ratio, etc..
......
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