Commit 4527b4e1 authored by Carla Guillen Carias's avatar Carla Guillen Carias
Browse files

Small corrections on the configuration files

parent bef55e84
......@@ -37,18 +37,18 @@ default def1
number_quantiles 10
input {
sensor "<bottomup 1>cpi"
sensor "<bottomup 1>frequency"
}
output {
; In this case "bottomup 1" is the sensor tree level associated to compute nodes
sensor "<bottomup 1>avg/frequency" {
mqttsuffix /avg/frequency
sensor "<bottomup 1>frequency/avg" {
mqttsuffix /frequency/avg
operation average
}
sensor "<bottomup 1>numobs/frequency" {
mqttsuffix /numobs/frequency
sensor "<bottomup 1>frequency/numobs" {
mqttsuffix frequency/numobs
operation numobs
}
......
......@@ -93,8 +93,9 @@ bool JobTSAggregatorConfigurator::readUnits(JobTSAggregatorOperator& op,
}
for(int i = 0; i <= num_quantiles; ++i){
std::stringstream builder;
builder << "quantile" << i << " from " << num_quantiles << op.getName();
builder << "quantile" << i << "/" << num_quantiles << "/" << op.getName();
auto outputSensor = std::make_shared<AggregatorSensorBase>(builder.str());
//ToDo how do we set the mqtt? here?
outputSensor->setOperation(AggregatorSensorBase::QTL);
outputSensor->setPercentile(i);
protoOutputs.push_back(outputSensor);
......
......@@ -56,23 +56,22 @@ void SMUCNGPerfOperator::printConfig(LOG_LEVEL ll) {
void SMUCNGPerfOperator::compute(U_Ptr unit) {
auto inputs = unit->getInputs();
auto timestamp = getTimestamp(); //ToDo timestamp minus some time...
auto outputs = unit->getOutputs();
for(auto& outSensor : outputs){
for(auto& outSensor : unit->getOutputs()){
if( outSensor->getPosition() == _metricToPosition[SMUCSensorBase::CPI]) {
std::vector<reading_t> & instructions = _buffers[0];
std::vector<reading_t> & clocks = _buffers[1];
_queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, timestamp, instructions, false); //use absolute timestamp
_queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, clocks, false); //use absolute timestamp
reading_t cpi;
query(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, instructions);
query(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, clocks);
bool wascalced = false;
reading_t cpi;
if (instructions.size() > 0 && clocks.size() > 0 && calculateMetricRatio(clocks[0], instructions[0], outSensor->getScalingFactor(), cpi)) {
outSensor->storeReading(cpi);
}
} else if (outSensor->getPosition() == _metricToPosition[SMUCSensorBase::FREQUENCY]) {
std::vector<reading_t> & clocks = _buffers[0];
std::vector<reading_t> & clocks_ref = _buffers[1];
_queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, timestamp, clocks, false); //use absolute timestamp
_queryEngine.querySensor(inputs[_metricToPosition[SMUCSensorBase::CLOCKS_REF]]->getName(), timestamp, timestamp, clocks_ref, false); //use absolute timestamp
query(inputs[_metricToPosition[SMUCSensorBase::CLOCKS]]->getName(), timestamp, clocks);
query(inputs[_metricToPosition[SMUCSensorBase::CLOCKS_REF]]->getName(), timestamp, clocks_ref);
reading_t frequency;
if( clocks.size() > 0 && clocks_ref.size() > 0 && calculateFrequency(clocks_ref[0],clocks[0], MIN_FREQ_MHZ, MAX_FREQ_MHZ, frequency)) {
outSensor->storeReading(frequency);
......@@ -82,6 +81,10 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) {
}
}
void SMUCNGPerfOperator::query(std::string & sensor_name, const uint64_t timestamp, vector<reading_t> &buffer){
_queryEngine.querySensor(sensor_name, timestamp, timestamp, buffer, false); //use absolute timestamp and always false
}
void SMUCNGPerfOperator::resetBuffers(){
for(auto &buffer: _buffers){
buffer.clear();
......
......@@ -54,6 +54,7 @@ protected:
const unsigned int MIN_FREQ_MHZ = 1200;
void resetBuffers();
void query(std::string & sensor_name, const uint64_t timestamp, vector<reading_t> &buffer);
};
#endif /* ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_ */
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