Commit 5cfee0d8 authored by Alessio Netti's avatar Alessio Netti
Browse files

Renaming ProcFS SAR multiplier to avoid confusion with sensor scaling factor

parent 9f9d3a6a
......@@ -666,7 +666,7 @@ Explanation of the values specific for the ProcFS plugin:
| path | Path of the file, if different from the default path in the /proc filesystem
| cpus | Defines the set of CPU cores for which metrics must be collected. Only affects extraction of core-specific metrics (e.g. those in /proc/stat), whereas system-level metrics are acquired regardless of this setting. If no CPU cores set is defined, metrics for all available CPU cores will be collected. This parameter follows the same syntax as in the Perf-event plugin.
| htVal | Specify a multiplier for CPU aggregation. All CPUs where (CPU-number % htVal) has the same result are aggregated together. If specified, only CPUs which are included in the "cpus" field are aggregated. See Perf-event plugin for more details.
| scalingFactor | A scaling factor to be applied to ratio-like metrics. Default is 1000000.
| sarMax | A scaling factor to be applied to ratio-like metrics with the sar parser. Default is 1000000.
| mqttSuffix | the mqttSuffix field in the ProcFS plugin, for sensors that are CPU-related such as the ones in procstat files, behaves as described for the perf-event plugin.
Additionally, sensors in the ProcFS plugin (defined with the "metric" keyword) support the following additional values:
......
......@@ -81,8 +81,8 @@ void ProcfsConfigurator::sensorGroup(ProcfsSensorGroup &sGroup, CFG_VAL config)
sGroup.setCpuSet(parseCpuString(val.second.data()));
} else if (boost::iequals(val.first, "htVal")) {
sGroup.setHtVal(stoi(val.second.data()));
} else if (boost::iequals(val.first, "scalingFactor")) {
sGroup.setScalingFactor(stoull(val.second.data()));
} else if (boost::iequals(val.first, "sarMax")) {
sGroup.setSarMax(stoull(val.second.data()));
}
}
......@@ -110,7 +110,7 @@ void ProcfsConfigurator::sensorGroup(ProcfsSensorGroup &sGroup, CFG_VAL config)
// all sensors not matching any parsed metrics, and arrange their order to respect the one in the file
derivedSensors = sGroup.getDerivedSensors();
parser->setHtVal(sGroup.getHtVal());
parser->setScalingFactor(sGroup.getScalingFactor());
parser->setSarMax(sGroup.getSarMax());
// If no metrics were found in the file (or the file is unreadable) the configuration aborts
int numMetrics = 0;
......
......@@ -49,7 +49,7 @@ ProcfsParser::ProcfsParser(std::string path) {
_stringBuffer = NULL;
_chars_read = 0;
_cacheIndex = 0;
_scalingFactor = 1000000;
_sarMax = 1000000;
}
/**
......@@ -664,7 +664,7 @@ bool SARParser::_readMetrics() {
// Percentages are computed only once per hyperthreading "bin"
if (!l.skip && l.multi && _accumulators[effCpu + 1] != 1) {
for (colCtr = 0; colCtr < (unsigned) l.columns; colCtr++)
_readings->at(l.dest + colCtr).value = _readings->at(l.dest + colCtr).value * _scalingFactor / _accumulators[effCpu + 1];
_readings->at(l.dest + colCtr).value = _readings->at(l.dest + colCtr).value * _sarMax / _accumulators[effCpu + 1];
_accumulators[effCpu + 1] = 1;
}
}
......
......@@ -71,7 +71,7 @@ class ProcfsParser {
unsigned int getNumMetrics() { return _numMetrics; }
unsigned int getNumCPUs() { return _numCPUs; }
unsigned int getCacheIndex() { return _cacheIndex; }
uint64_t getScalingFactor() { return _scalingFactor; }
uint64_t getSarMax() { return _sarMax; }
void setCacheIndex(unsigned int c) { _cacheIndex = c; }
void setHtVal(int v) {
_htVal = v;
......@@ -81,7 +81,7 @@ class ProcfsParser {
_path = new_path;
close();
}
void setScalingFactor(uint64_t sf) { _scalingFactor = sf; }
void setSarMax(uint64_t sf) { _sarMax = sf; }
std::vector<ProcfsSBPtr> *getSensors();
std::vector<ureading_t> * readSensors();
......@@ -107,7 +107,7 @@ class ProcfsParser {
// Internal variables
std::set<int> _foundCPUs;
bool _initialized;
uint64_t _scalingFactor;
uint64_t _sarMax;
unsigned int _cacheIndex;
unsigned int _numMetrics;
unsigned int _numInternalMetrics;
......
......@@ -37,7 +37,7 @@ ProcfsSensorGroup &ProcfsSensorGroup::operator=(const ProcfsSensorGroup &other)
_type = other._type;
_path = other._path;
_htVal = other._htVal;
_scalingFactor = other._scalingFactor;
_sarMax = other._sarMax;
return *this;
}
......@@ -145,6 +145,6 @@ void ProcfsSensorGroup::printGroupConfig(LOG_LEVEL ll, unsigned leadingSpaces) {
LOG_VAR(ll) << leading << "Type: " << _type;
LOG_VAR(ll) << leading << "Path: " << _path;
LOG_VAR(ll) << leading << "HTVal: " << _htVal;
LOG_VAR(ll) << leading << "Scaling: " << _scalingFactor;
LOG_VAR(ll) << leading << "SarMax: " << _sarMax;
LOG_VAR(ll) << leading << "Parser: " << (_parser ? "true" : "false");
}
......@@ -48,7 +48,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
: SensorGroupTemplate(name) {
_parser = NULL;
_htVal = 0;
_scalingFactor = 1000000;
_sarMax = 1000000;
}
ProcfsSensorGroup &operator=(const ProcfsSensorGroup &other);
virtual ~ProcfsSensorGroup();
......@@ -62,9 +62,9 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
void setType(std::string t) { this->_type = t; }
void setPath(std::string p) { this->_path = p; }
void setCpuSet(std::set<int> s) { this->_cpuSet = s; }
void setScalingFactor(uint64_t sf) {
void setSarMax(uint64_t sf) {
if (sf > 0)
this->_scalingFactor = sf;
this->_sarMax = sf;
}
int getHtVal() { return this->_htVal; }
......@@ -72,7 +72,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
std::string getType() { return this->_type; }
std::string getPath() { return this->_path; }
std::set<int> *getCpuSet() { return &this->_cpuSet; }
uint64_t getScalingFactor() { return this->_scalingFactor; }
uint64_t getSarMax() { return this->_sarMax; }
void printGroupConfig(LOG_LEVEL ll, unsigned leadingSpaces = 16) final override;
......@@ -91,7 +91,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
// Set of cpu ids read during configuration
std::set<int> _cpuSet;
// Scaling factor to be used for ratio metrics
uint64_t _scalingFactor;
uint64_t _sarMax;
std::vector<ureading_t> *_readingVector;
ureading_t _readingBuffer;
......
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