Commit 6ca11dc3 authored by Carla Guillen Carias's avatar Carla Guillen Carias
Browse files

Removing puning of ints to doubles and viceversa, and implementing use of...

Removing puning of ints to doubles and viceversa, and implementing use of scaling factor from metadata
parent d5e7a0fa
......@@ -59,6 +59,40 @@ PerSystSqlOperator::PerSystSqlOperator(const std::string& name) :
PerSystSqlOperator::~PerSystSqlOperator() {
}
PerSystSqlOperator::PerSystSqlOperator(const PerSystSqlOperator& other) : OperatorTemplate(other._name), JobOperatorTemplate(other._name){
copy(other);
}
PerSystSqlOperator& PerSystSqlOperator::operator=(const PerSystSqlOperator& other){
OperatorTemplate::operator=(other);
JobOperatorTemplate::operator=(other);
copy(other);
return *this;
}
void PerSystSqlOperator::copy(const PerSystSqlOperator& other){
this->_buffer = other._buffer;
this->_quantileSensors = other._quantileSensors;
this->_number_of_even_quantiles = other._number_of_even_quantiles;
this->_severity_formula = other._severity_formula;
this->_severity_threshold = other._severity_threshold;
this->_severity_exponent = other._severity_exponent;
this->_severity_max_memory = other._severity_max_memory;
this->_severities = other._severities;
this->_go_back_ns = other._go_back_ns;
this->_backend = other._backend;
this->_scaling_factor = other._scaling_factor;
this->_conn.database_name = other._conn.database_name;
this->_conn.every_x_days = other._conn.every_x_days;
this->_conn.host = other._conn.host;
this->_conn.password = other._conn.password;
this->_conn.port = other._conn.port;
this->_conn.rotation = other._conn.rotation;
this->_conn.user = other._conn.user;
this->_property_id = other._property_id;
}
void PerSystSqlOperator::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << "backend=" << _backend;
LOG_VAR(ll) << "go_back_ms=" << _go_back_ns/1e6;
......@@ -74,7 +108,6 @@ void PerSystSqlOperator::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << "Property Configuration:";
LOG_VAR(ll) << "\tnumber_of_even_quantiles=" << _number_of_even_quantiles;
LOG_VAR(ll) << "\tproperty_id=" << _property_id;
LOG_VAR(ll) << "\tscaling_factor=" << _scaling_factor;
LOG_VAR(ll) << "Severity Configuration:";
LOG_VAR(ll) << "\tseverity_formula=" << _severity_formula;
LOG_VAR(ll) << "\tseverity_exponent=" << _severity_exponent;
......@@ -88,16 +121,13 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
size_t elCtr = 0;
uint64_t my_timestamp = getTimestamp() - _go_back_ns;
// Making sure that the aggregation boundaries do not go past the job start/end time
uint64_t jobEnd =
jobData.endTime != 0 && my_timestamp > jobData.endTime ?
jobData.endTime : my_timestamp;
uint64_t jobStart =
jobEnd - my_timestamp < jobData.startTime ?
jobData.startTime : jobEnd - my_timestamp;
uint64_t jobEnd = jobData.endTime != 0 && my_timestamp > jobData.endTime ? jobData.endTime : my_timestamp;
uint64_t jobStart = jobEnd - my_timestamp < jobData.startTime ? jobData.startTime : jobEnd - my_timestamp;
// Job units are hierarchical, and thus we iterate over all sub-units associated to each single node
for (const auto& subUnit : unit->getSubUnits()) {
// Since we do not clear the internal buffer, all sensor readings will be accumulated in the same vector
for (const auto& in : subUnit->getInputs()) {
_scaling_factor = in->getMetadata()->scale;
if (!_queryEngine.querySensor(in->getName(), my_timestamp, my_timestamp, _buffer, false)) {
LOG(debug)<< "PerSystSql Operator " << _name << " cannot read from sensor " << in->getName() << "!";
}
......@@ -121,16 +151,16 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
job_ids.push_back(jobidBuilder.str());
std::map<std::string, std::string> job_map;
if(!persystdb.getTableSuffix(table_suffix)){
LOG(error) << "failed to create table!";
return;
}
if(!persystdb.getDBJobIDs(job_ids, job_map)){
return;
}
if(!persystdb.getTableSuffix(table_suffix)){
LOG(error) << "failed to create table!";
return;
}
if(!persystdb.getDBJobIDs(job_ids, job_map)){
return;
}
// handle jobs which are not present
for(auto &job_id_string : job_ids ){
for(auto &job_id_string : job_ids ){
auto search = job_map.find(job_id_string);
if(search == job_map.end()){ //Not found
int job_id_db;
......@@ -140,7 +170,7 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
continue;
}
}
}
}
agg_info.timestamp = (my_timestamp/1e9);
}
......@@ -156,6 +186,14 @@ void PerSystSqlOperator::compute(U_Ptr unit, qeJobData& jobData) {
}
}
void PerSystSqlOperator::convertToDoubles(std::vector<reading_t> &buffer, std::vector<double> &douBuffer){
for(auto &reading: buffer){
double value = reading.value/_scaling_factor;
douBuffer.push_back(value);
}
}
void PerSystSqlOperator::compute_internal(U_Ptr& unit, vector<reading_t>& buffer, Aggregate_info_t & agg_info) {
_quantileSensors.clear();
......@@ -164,7 +202,7 @@ void PerSystSqlOperator::compute_internal(U_Ptr& unit, vector<reading_t>& buffer
reading.timestamp = getTimestamp() - _go_back_ns;
std::vector<double> douBuffer;
punToDoubles(buffer, douBuffer);
convertToDoubles(buffer, douBuffer);
// Performing the actual aggregation operation
for (const auto& out : unit->getOutputs()) {
op = out->getOperation();
......@@ -183,7 +221,7 @@ void PerSystSqlOperator::compute_internal(U_Ptr& unit, vector<reading_t>& buffer
break;
case AggregatorSensorBase::AVG_SEV:
if (_backend == CASSANDRA) {
reading.value = computeSeverityAverage(douBuffer) * _scaling_factor;
reading.value = computeSeverityAverage(douBuffer) * SCALING_FACTOR_SEVERITY;
} else {
agg_info.severity_average = computeSeverityAverage(douBuffer);
}
......@@ -288,29 +326,25 @@ double PerSystSqlOperator::computeSeverityAverage(
switch (_severity_formula) {
case (FORMULA1):
for (auto val : buffer) {
auto severity = severity_formula1(val, _severity_threshold,
_severity_exponent);
auto severity = severity_formula1(val, _severity_threshold, _severity_exponent);
severities.push_back(severity);
}
break;
case (FORMULA2):
for (auto val : buffer) {
auto severity = severity_formula2(val, _severity_threshold,
_severity_exponent);
auto severity = severity_formula2(val, _severity_threshold, _severity_exponent);
severities.push_back(severity);
}
break;
case (FORMULA3):
for (auto val : buffer) {
auto severity = severity_formula3(val, _severity_threshold,
_severity_exponent);
auto severity = severity_formula3(val, _severity_threshold, _severity_exponent);
severities.push_back(severity);
}
break;
case (MEMORY_FORMULA):
for (auto val : buffer) {
auto severity = severity_memory(val, _severity_threshold,
_severity_max_memory);
auto severity = severity_memory(val, _severity_threshold, _severity_max_memory);
severities.push_back(severity);
}
break;
......@@ -330,28 +364,7 @@ double PerSystSqlOperator::computeSeverityAverage(
return 0.0;
}
void punToDoubles(std::vector<reading_t> & buffer,
std::vector<double> & outDoubleVec) {
for (auto & reading : buffer) {
outDoubleVec.push_back(punLLToDouble(reading.value));
}
}
double punLLToDouble(long long value) {
double * returnval;
returnval = (double *) (&value);
return *returnval;
}
long long punDoubleToLL(double value) {
long long * returnval;
returnval = (long long *) (&value);
return *returnval;
}
void computeEvenQuantiles(std::vector<double> &data,
const unsigned int NUMBER_QUANTILES, std::vector<double> &quantiles) {
void computeEvenQuantiles(std::vector<double> &data, const unsigned int NUMBER_QUANTILES, std::vector<double> &quantiles) {
if (data.empty() || NUMBER_QUANTILES == 0) {
return;
}
......@@ -368,8 +381,7 @@ void computeEvenQuantiles(std::vector<double> &data,
quantiles[i] = data[0];
} else {
double rest = (i * factor) - idx;
quantiles[i] = data[idx - 1]
+ rest * (data[idx] - data[idx - 1]); //ToDo scaling factor??
quantiles[i] = data[idx - 1] + rest * (data[idx] - data[idx - 1]);
}
} else { //optimization, we don't need to calculate all the quantiles
quantiles[i] = data[0];
......
......@@ -54,6 +54,10 @@ public:
public:
PerSystSqlOperator(const std::string& name);
virtual ~PerSystSqlOperator();
PerSystSqlOperator(const PerSystSqlOperator& other);
PerSystSqlOperator& operator=(const PerSystSqlOperator& other);
void copy(const PerSystSqlOperator& other);
void compute(U_Ptr unit, qeJobData& jobData) override;
void printConfig(LOG_LEVEL ll) override;
......@@ -138,11 +142,13 @@ private:
static int _number_of_calls;
int _property_id;
static PerSystDB persystdb;
const int SCALING_FACTOR_SEVERITY=1000000;
protected:
virtual void compute(U_Ptr unit) override;
void compute_internal(U_Ptr& unit, vector<reading_t>& buffer, Aggregate_info_t &agg_info);
double computeSeverityAverage(vector<double> & buffer);
void convertToDoubles(std::vector<reading_t> &buffer, std::vector<double> &douBuffer);
};
double severity_formula1(double metric, double threshold, double exponent);
......@@ -150,10 +156,7 @@ double severity_formula2(double metric, double threshold, double exponent);
double severity_formula3(double metric, double threshold, double exponent);
double severity_memory(double metric, double threshold, double max_memory);
constexpr double severity_noformula(){return 0.0;} //No severity
void punToDoubles(std::vector<reading_t> & buffer, std::vector<double> & outDoubleVec);
void computeEvenQuantiles(std::vector<double> &data, const unsigned int NUMBER_QUANTILES, std::vector<double> &quantiles);
double punLLToDouble(long long value);
long long punDoubleToLL(double value);
#endif /* ANALYTICS_OPERATORS_PERSYSTSQL_PERSYSTSQLOPERATOR_H_ */
......@@ -28,27 +28,15 @@
#include "SKXPMUMetrics.h"
double punLLToDouble(long long value){
double * returnval;
returnval = (double *)(&value);
return *returnval;
}
long long punDoubleToLL(double value){
long long * returnval;
returnval = (long long *)(&value);
return *returnval;
}
bool calculateFlopsPerSec(reading_t &scalarDB, reading_t & scalarSP,
reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512, reading_t & result, double measuring_interval_s) {
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result, double scaling_factor, double measuring_interval_s) {
if(!measuring_interval_s) return false;
result.value = punDoubleToLL(packedDP128.value * 2 + packedSP128.value * 4
result.value = scaling_factor * (packedDP128.value * 2 + packedSP128.value * 4
+ packedDP256.value * 4 + packedSP256.value * 8
+ packedDP512.value * 8 + packedSP512.value * 16 + scalarDB.value
+ scalarSP.value)/measuring_interval_s;
......@@ -58,23 +46,23 @@ bool calculateFlopsPerSec(reading_t &scalarDB, reading_t & scalarSP,
bool calculatePackedFlopsPerSec(reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result, double measuring_interval_s) {
result.value = punDoubleToLL((packedDP128.value * 2 + packedSP128.value * 4
reading_t & result, double scaling_factor, double measuring_interval_s) {
result.value = scaling_factor * (packedDP128.value * 2 + packedSP128.value * 4
+ packedDP256.value * 4 + packedSP256.value * 8
+ packedDP512.value * 8 + packedSP512.value * 16)/measuring_interval_s);
+ packedDP512.value * 8 + packedSP512.value * 16)/measuring_interval_s;
return getTimestampFromReadings(result.timestamp, packedDP128, packedSP128, packedDP256, packedSP256, packedDP512, packedSP512);
}
bool calculateVectorizationRatio(reading_t & scalarDB, reading_t & scalarSP,
reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512, reading_t & result) {
reading_t & packedDP512, reading_t & packedSP512, reading_t & result, double scaling_factor) {
double denominator = static_cast<double>(scalarDB.value + scalarSP.value +
packedDP128.value + packedSP128.value +
packedDP256.value + packedSP256.value +
packedDP512.value + packedSP512.value);
if(denominator > 0 ){
result.value = punDoubleToLL((packedDP128.value + packedSP128.value + packedDP256.value
result.value = scaling_factor*((packedDP128.value + packedSP128.value + packedDP256.value
+ packedSP256.value + packedDP256.value + packedSP512.value + packedDP512.value)/denominator);
return getTimestampFromReadings(result.timestamp, scalarDB, scalarSP,
packedDP128, packedSP128, packedDP256, packedSP256, packedDP512,
......@@ -86,12 +74,12 @@ bool calculateVectorizationRatio(reading_t & scalarDB, reading_t & scalarSP,
bool calculateAVX512FlopsToVectorizedRatio(reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result){
reading_t & result, double scaling_factor){
double denominator = static_cast<double>(packedDP128.value + packedSP128.value +
packedDP256.value + packedSP256.value +
packedDP512.value + packedSP512.value);
if(denominator > 0){
result.value = punDoubleToLL((packedDP512.value * 8 + packedSP512.value * 16)/denominator);
result.value = scaling_factor* ((packedDP512.value * 8 + packedSP512.value * 16)/denominator);
return getTimestampFromReadings(result.timestamp, packedDP128, packedSP128, packedDP256, packedSP256, packedDP512, packedSP512);
}
return false;
......@@ -102,12 +90,12 @@ bool calculateSP_TO_TOTAL_RATIO(reading_t &scalarDB, reading_t & scalarSP,
reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result){
reading_t & result, double scaling_factor){
auto single_precision = packedSP128.value * 4 + packedSP256.value * 8
+ packedSP512.value * 16 + scalarSP.value;
double total = single_precision = packedDP128.value * 2 + packedDP256.value * 4 + packedDP512.value * 8 + scalarDB.value;
if(total > 0){
result.value = punDoubleToLL(single_precision/total);
result.value = scaling_factor * (single_precision/total);
return getTimestampFromReadings(result.timestamp, scalarDB, scalarSP,
packedDP128, packedSP128, packedDP256, packedSP256, packedDP512,
packedSP512);
......@@ -116,16 +104,16 @@ bool calculateSP_TO_TOTAL_RATIO(reading_t &scalarDB, reading_t & scalarSP,
}
bool calculateL3HitToL3MissRatio(reading_t & l3_misses, reading_t& l3_load_hits,
reading_t & l3_load_misses, reading_t & result){
reading_t & l3_load_misses, reading_t & result, double scaling_factor){
double denominator = static_cast<double>(l3_load_hits.value + l3_load_misses.value);
if(denominator > 0){
result.value = punDoubleToLL(l3_misses.value/denominator);
result.value = scaling_factor*(l3_misses.value/denominator);
return getTimestampFromReadings(result.timestamp, l3_misses, l3_load_hits, l3_load_misses);
}
return false;
}
bool calculateMemoryBandwidth(std::vector<reading_t> membw_counts, reading_t & result, double measuring_interval_s ) {
bool calculateMemoryBandwidth(std::vector<reading_t> membw_counts, reading_t & result, double measuring_interval_s, double scaling_factor ) {
result.value = 0;
const unsigned int SIZEPERACCESS = 64;
bool ret_val = false;
......@@ -136,7 +124,7 @@ bool calculateMemoryBandwidth(std::vector<reading_t> membw_counts, reading_t & r
ret_val = true;
}
}
result.value = punDoubleToLL(result.value/measuring_interval_s);
result.value = scaling_factor * (result.value/measuring_interval_s);
return ret_val;
}
......@@ -144,31 +132,31 @@ bool calculateMemoryBandwidth(std::vector<reading_t> membw_counts, reading_t & r
/**
* For CPI, LoadsToStore, Branch rate, miss branch ratio, etc..
*/
bool calculateMetricRatio(reading_t & dividend, reading_t & divisor, reading_t & result) {
bool calculateMetricRatio(reading_t & dividend, reading_t & divisor, reading_t & result, double scaling_factor) {
if(divisor.value > 0){
result.value = punDoubleToLL(dividend.value / static_cast<double>(divisor.value));
result.value = scaling_factor * (dividend.value / static_cast<double>(divisor.value));
return getTimestampFromReadings(result.timestamp, dividend, divisor);
}
return false; //Division by zero
}
/** Any generic metric per second. For instance: instructions per second, l2 misses per second **/
bool calculateMetricPerSec(reading_t & metric, double measuring_interval_s, reading_t & result) {
bool calculateMetricPerSec(reading_t & metric, double measuring_interval_s, reading_t & result, double scaling_factor) {
if(measuring_interval_s > 0) {
result.value = punDoubleToLL(metric.value / measuring_interval_s);
result.value = scaling_factor * (metric.value / measuring_interval_s);
return getTimestampFromReadings(result.timestamp, metric);
}
return false; //Division by zero
}
bool calculateFrequency(reading_t & unhaltedRef, reading_t & unhaltedClocks,
unsigned int min_freq, unsigned int max_freq, reading_t & result) {
unsigned int min_freq, unsigned int max_freq, reading_t & result, double scaling_factor) {
if(unhaltedRef.value > 0){
double resValue = (unhaltedClocks.value / static_cast<double>(unhaltedRef.value)) * max_freq;
if(resValue > (max_freq * 1.1) || resValue < (min_freq*0.9)) { //There is something wrong here...
return false;
}
result.value = punDoubleToLL(resValue);
result.value = scaling_factor * resValue;
return getTimestampFromReadings(result.timestamp, unhaltedRef, unhaltedClocks);
}
return false; //Division by zero
......
......@@ -42,50 +42,46 @@ bool getTimestampFromReadings(uint64_t & timestamp, Args&...args){
return false;
}
double punLLToDouble(long long value);
long long punDoubleToLL(double value);
bool calculateFlopsPerSec(reading_t &scalarDB, reading_t & scalarSP,
reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result, double measuring_interval_s);
reading_t & result, double scaling_factor, double measuring_interval_s);
bool calculatePackedFlopsPerSec(reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result, double measuring_interval_s);
reading_t & result, double scaling_factor, double measuring_interval_s);
bool calculateVectorizationRatio(reading_t & scalarDB, reading_t & scalarSP,
reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512, reading_t & result);
reading_t & packedDP512, reading_t & packedSP512, reading_t & result, double scaling_factor);
bool calculateAVX512FlopsToVectorizedRatio(reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result);
reading_t & result, double scaling_factor);
bool calculateSP_TO_TOTAL_RATIO(reading_t &scalarDB, reading_t & scalarSP,
reading_t & packedDP128, reading_t & packedSP128,
reading_t & packedDP256, reading_t & packedSP256,
reading_t & packedDP512, reading_t & packedSP512,
reading_t & result);
reading_t & result, double scaling_factor);
bool calculateL3HitToL3MissRatio(reading_t & l3_misses, reading_t& l3_load_hits,
reading_t & l3_load_misses, reading_t & result);
reading_t & l3_load_misses, reading_t & result, double scaling_factor);
bool calculateMemoryBandwidth(std::vector<reading_t> membw_counts, reading_t & result, double measuring_interval_s);
bool calculateMemoryBandwidth(std::vector<reading_t> membw_counts, reading_t & result, double measuring_interval_s, double scaling_factor);
bool calculateMetricRatio(reading_t & dividend, reading_t & divisor, reading_t & result);
bool calculateMetricRatio(reading_t & dividend, reading_t & divisor, reading_t & result, double scaling_factor);
/** Any generic metric per second. For instance: instructions per second, l2 misses per second **/
bool calculateMetricPerSec(reading_t & metric, double measuring_interval_s, reading_t & result) ;
bool calculateMetricPerSec(reading_t & metric, double measuring_interval_s, reading_t & result, double scaling_factor) ;
bool calculateFrequency(reading_t & unhaltedRef, reading_t & unhaltedClocks,
unsigned int min_freq, unsigned int max_freq, reading_t & result);
unsigned int min_freq, unsigned int max_freq, reading_t & result, double scaling_factor);
#endif /* ANALYTICS_ANALYZERS_SMUCNGPERFANALYZER_SKXDERIVEDMETRICS_SKXPMUMETRICS_H_ */
......@@ -146,7 +146,7 @@ void SMUCNGPerfOperator::computeCPI(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &o
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], cpi)) {
if (instructions.size() > 0 && clocks.size() > 0 && calculateMetricRatio(clocks[0], instructions[0], cpi, outSensor->getMetadata()->scale)) {
outSensor->storeReading(cpi);
}
}
......@@ -157,7 +157,7 @@ void SMUCNGPerfOperator::computeFREQUENCY(std::vector<SMUCNGPtr>& inputs, SMUCNG
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)) {
if( clocks.size() > 0 && clocks_ref.size() > 0 && calculateFrequency(clocks_ref[0],clocks[0], MIN_FREQ_MHZ, MAX_FREQ_MHZ, frequency, outSensor->getMetadata()->scale)) {
outSensor->storeReading(frequency);
}
}
......@@ -198,29 +198,31 @@ void SMUCNGPerfOperator::computeFLOPS(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr&
if(flop_metric == SMUCSensorBase::FLOPS) {
if (calculateFlopsPerSec(scalar_double, scalar_single, packed128_double,
packed128_single, packed256_double, packed256_single,
packed512_double, packed512_single, result, _measuring_interval_s) ) {
packed512_double, packed512_single, result, outSensor->getMetadata()->scale, _measuring_interval_s) ) {
outSensor->storeReading(result);
}
} else if(flop_metric == SMUCSensorBase::PACKED_FLOPS){
if(calculatePackedFlopsPerSec(packed128_double,packed128_single,packed256_double,packed256_single,packed512_double,packed512_single, result, _measuring_interval_s)){
if (calculatePackedFlopsPerSec(packed128_double, packed128_single,
packed256_double, packed256_single, packed512_double,
packed512_single, result, outSensor->getMetadata()->scale, _measuring_interval_s)) {
outSensor->storeReading(result);
}
} else if(flop_metric == SMUCSensorBase::VECTORIZED_RATIO) {
if(calculateVectorizationRatio(scalar_double, scalar_single, packed128_double,
packed128_single, packed256_double, packed256_single,
packed512_double, packed512_single, result)) {
packed512_double, packed512_single, result, outSensor->getMetadata()->scale)) {
outSensor->storeReading(result);
}
} else if (flop_metric == SMUCSensorBase::AVX512_TOVECTORIZED_RATIO) {
if (calculateAVX512FlopsToVectorizedRatio(packed128_double,
packed128_single, packed256_double, packed256_single,
packed512_double, packed512_single, result )) {
packed512_double, packed512_single, result, outSensor->getMetadata()->scale )) {
outSensor->storeReading(result);
}
} else if (flop_metric == SMUCSensorBase::SINGLE_PRECISION_TO_TOTAL_RATIO) {
if(calculateSP_TO_TOTAL_RATIO(scalar_double, scalar_single, packed128_double,
packed128_single, packed256_double, packed256_single,
packed512_double, packed512_single, result)){
packed512_double, packed512_single, result, outSensor->getMetadata()->scale)){
outSensor->storeReading(result);
}
}
......@@ -239,7 +241,7 @@ void SMUCNGPerfOperator::computeL3_TO_INSTRUCTIONS_RATIO(std::vector<SMUCNGPtr>&
query(inputs[_metricToPosition[SMUCSensorBase::MEM_LOAD_UOPS_RETIRED_L3_MISS]]->getName(), timestamp, l3_misses);
query(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, instructions);
reading_t l3toinstrRatio;
if (instructions.size() > 0 && l3_misses.size() > 0 && calculateMetricRatio(instructions[0], l3_misses[0], l3toinstrRatio)) {
if (instructions.size() > 0 && l3_misses.size() > 0 && calculateMetricRatio(instructions[0], l3_misses[0], l3toinstrRatio, outSensor->getMetadata()->scale)) {
outSensor->storeReading(l3toinstrRatio);
}
}
......@@ -258,7 +260,7 @@ void SMUCNGPerfOperator::computeL3HIT_TO_L3MISS_RATIO(std::vector<SMUCNGPtr>& in
query(inputs[_metricToPosition[SMUCSensorBase::MEM_LOAD_RETIRED_L3_HIT]]->getName(), timestamp, l3_hits);
query(inputs[_metricToPosition[SMUCSensorBase::MEM_LOAD_RETIRED_L3_MISS]]->getName(), timestamp, l3_load_miss);
reading_t l3hitToMissRatio;
if (l3_misses.size() > 0 && l3_hits.size() > 0 && l3_load_miss.size() > 0 && calculateL3HitToL3MissRatio(l3_misses[0], l3_hits[0], l3_load_miss[0], l3hitToMissRatio)) {
if (l3_misses.size() > 0 && l3_hits.size() > 0 && l3_load_miss.size() > 0 && calculateL3HitToL3MissRatio(l3_misses[0], l3_hits[0], l3_load_miss[0], l3hitToMissRatio, outSensor->getMetadata()->scale)) {
outSensor->storeReading(l3hitToMissRatio);
}
}
......@@ -267,32 +269,30 @@ void SMUCNGPerfOperator::computeMetricPerSecond(SMUCSensorBase::Metric_t metric_
SMUCSensorBase::Metric_t metric = _metricPerSecToId[metric_ps];
query(inputs[_metricToPosition[metric]]->getName(), timestamp, _buffers[0]);
reading_t metricpersec;
if(_buffers[0].size() > 0 && calculateMetricPerSec(_buffers[0][0], _measuring_interval_s, metricpersec)){
if(_buffers[0].size() > 0 && calculateMetricPerSec(_buffers[0][0], _measuring_interval_s, metricpersec, outSensor->getMetadata()->scale)){
outSensor->storeReading(metricpersec);
}
}
void SMUCNGPerfOperator::computeLOADS_TO_STORES(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr& outSensor,
const uint64_t timestamp) {
void SMUCNGPerfOperator::computeLOADS_TO_STORES(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr& outSensor, const uint64_t timestamp) {
std::vector<reading_t> & loads = _buffers[0];
std::vector<reading_t> & stores = _buffers[1];
query(inputs[_metricToPosition[SMUCSensorBase::MEM_INST_RETIRED_ALL_LOADS]]->getName(), timestamp, loads);
query(inputs[_metricToPosition[SMUCSensorBase::MEM_INST_RETIRED_ALL_STORES]]->getName(), timestamp, stores);
reading_t loadToStoreRatio;
if(loads.size() > 0 && stores.size() > 0 && calculateMetricRatio(loads[0], stores[0], loadToStoreRatio)){
if(loads.size() > 0 && stores.size() > 0 && calculateMetricRatio(loads[0], stores[0], loadToStoreRatio, outSensor->getMetadata()->scale)){
outSensor->storeReading(loadToStoreRatio);
}
}
void SMUCNGPerfOperator::computeLOADS_TOL3MISS_RATIO(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr& outSensor,
const uint64_t timestamp) {
void SMUCNGPerfOperator::computeLOADS_TOL3MISS_RATIO(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr& outSensor, const uint64_t timestamp) {
std::vector<reading_t> & loads = _buffers[0];
std::vector<reading_t> & l3_misses = _buffers[1];
query(inputs[_metricToPosition[SMUCSensorBase::MEM_INST_RETIRED_ALL_LOADS]]->getName(), timestamp, loads);
query(inputs[_metricToPosition[SMUCSensorBase::MEM_LOAD_UOPS_RETIRED_L3_MISS]]->getName(), timestamp, l3_misses);
reading_t loads_to_l3misses;
if (loads.size() > 0 && l3_misses.size() > 0
&& calculateMetricRatio(loads[0], l3_misses[0], loads_to_l3misses)) {
&& calculateMetricRatio(loads[0], l3_misses[0], loads_to_l3misses, outSensor->getMetadata()->scale)) {
outSensor->storeReading(loads_to_l3misses);
}
}
......@@ -304,7 +304,7 @@ void SMUCNGPerfOperator::computeBRANCH_PER_INSTRUCTIONS(std::vector<SMUCNGPtr>&
query(inputs[_metricToPosition[SMUCSensorBase::INSTRUCTIONS]]->getName(), timestamp, instructions);