SMUCNGPerfConfigurator.cpp 1.72 KB
Newer Older
1
2
3
4
5
6
7
8
9
/*
 * SMUCNGPerfConfigurator.cpp
 *
 *  Created on: Jul 22, 2019
 *      Author: carla
 */

#include "SMUCNGPerfConfigurator.h"

10
SMUCNGPerfConfigurator::SMUCNGPerfConfigurator() : OperatorConfiguratorTemplate(){
11
    _operatorName = "supermucngperf";
12
13
14
15
16
17
    _baseName     = "sensor";
}

SMUCNGPerfConfigurator::~SMUCNGPerfConfigurator() {
}

18
void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL config) {
19
20
21
    BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
     {
             if (boost::iequals(val.first, "position")) {
22
23
                 unsigned int position = std::stoul(val.second.data());
		 s.setPosition(position);
24
25
26
27
28
                 std::string name = s.getName();
                 if(name.compare("instructions")==0){
                  	 _metricToPosition[SMUCSensorBase::INSTRUCTIONS] = position;
                 } else if(name.compare("clocks") == 0){
                  	 _metricToPosition[SMUCSensorBase::CLOCKS] = position;
Carla Guillen Carias's avatar
Carla Guillen Carias committed
29
                 } else if(name.compare("ref_clocks") == 0){
30
                	 _metricToPosition[SMUCSensorBase::CLOCKS_REF] = position;
31
32
33
34
35
                 } else if(name.compare("cpi") == 0){
			_metricToPosition[SMUCSensorBase::CPI] = position;
		 } else if(name.compare("frequency") == 0){
			_metricToPosition[SMUCSensorBase::FREQUENCY] = position;
		 }
36
37
38
             } else if (boost::iequals(val.first, "scaling_factor")){
            	 unsigned int scaling_factor = std::stoul(val.second.data());
            	 s.setScalingFactor(scaling_factor);
39
40
41
42
             }
     }
}

43
44
void SMUCNGPerfConfigurator::operatorAttributes(SMUCNGPerfOperator& op, CFG_VAL config){
	op.setMetricToPosition(_metricToPosition);
45
46
47
48
49
}

bool SMUCNGPerfConfigurator::unit(UnitTemplate<SMUCSensorBase>& u) {
	return true;
}