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: ...@@ -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 | 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. | 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. | 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. | 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: 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) ...@@ -81,8 +81,8 @@ void ProcfsConfigurator::sensorGroup(ProcfsSensorGroup &sGroup, CFG_VAL config)
sGroup.setCpuSet(parseCpuString(val.second.data())); sGroup.setCpuSet(parseCpuString(val.second.data()));
} else if (boost::iequals(val.first, "htVal")) { } else if (boost::iequals(val.first, "htVal")) {
sGroup.setHtVal(stoi(val.second.data())); sGroup.setHtVal(stoi(val.second.data()));
} else if (boost::iequals(val.first, "scalingFactor")) { } else if (boost::iequals(val.first, "sarMax")) {
sGroup.setScalingFactor(stoull(val.second.data())); sGroup.setSarMax(stoull(val.second.data()));
} }
} }
...@@ -110,7 +110,7 @@ void ProcfsConfigurator::sensorGroup(ProcfsSensorGroup &sGroup, CFG_VAL config) ...@@ -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 // all sensors not matching any parsed metrics, and arrange their order to respect the one in the file
derivedSensors = sGroup.getDerivedSensors(); derivedSensors = sGroup.getDerivedSensors();
parser->setHtVal(sGroup.getHtVal()); 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 // If no metrics were found in the file (or the file is unreadable) the configuration aborts
int numMetrics = 0; int numMetrics = 0;
......
...@@ -49,7 +49,7 @@ ProcfsParser::ProcfsParser(std::string path) { ...@@ -49,7 +49,7 @@ ProcfsParser::ProcfsParser(std::string path) {
_stringBuffer = NULL; _stringBuffer = NULL;
_chars_read = 0; _chars_read = 0;
_cacheIndex = 0; _cacheIndex = 0;
_scalingFactor = 1000000; _sarMax = 1000000;
} }
/** /**
...@@ -664,7 +664,7 @@ bool SARParser::_readMetrics() { ...@@ -664,7 +664,7 @@ bool SARParser::_readMetrics() {
// Percentages are computed only once per hyperthreading "bin" // Percentages are computed only once per hyperthreading "bin"
if (!l.skip && l.multi && _accumulators[effCpu + 1] != 1) { if (!l.skip && l.multi && _accumulators[effCpu + 1] != 1) {
for (colCtr = 0; colCtr < (unsigned) l.columns; colCtr++) 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; _accumulators[effCpu + 1] = 1;
} }
} }
......
...@@ -71,7 +71,7 @@ class ProcfsParser { ...@@ -71,7 +71,7 @@ class ProcfsParser {
unsigned int getNumMetrics() { return _numMetrics; } unsigned int getNumMetrics() { return _numMetrics; }
unsigned int getNumCPUs() { return _numCPUs; } unsigned int getNumCPUs() { return _numCPUs; }
unsigned int getCacheIndex() { return _cacheIndex; } unsigned int getCacheIndex() { return _cacheIndex; }
uint64_t getScalingFactor() { return _scalingFactor; } uint64_t getSarMax() { return _sarMax; }
void setCacheIndex(unsigned int c) { _cacheIndex = c; } void setCacheIndex(unsigned int c) { _cacheIndex = c; }
void setHtVal(int v) { void setHtVal(int v) {
_htVal = v; _htVal = v;
...@@ -81,7 +81,7 @@ class ProcfsParser { ...@@ -81,7 +81,7 @@ class ProcfsParser {
_path = new_path; _path = new_path;
close(); close();
} }
void setScalingFactor(uint64_t sf) { _scalingFactor = sf; } void setSarMax(uint64_t sf) { _sarMax = sf; }
std::vector<ProcfsSBPtr> *getSensors(); std::vector<ProcfsSBPtr> *getSensors();
std::vector<ureading_t> * readSensors(); std::vector<ureading_t> * readSensors();
...@@ -107,7 +107,7 @@ class ProcfsParser { ...@@ -107,7 +107,7 @@ class ProcfsParser {
// Internal variables // Internal variables
std::set<int> _foundCPUs; std::set<int> _foundCPUs;
bool _initialized; bool _initialized;
uint64_t _scalingFactor; uint64_t _sarMax;
unsigned int _cacheIndex; unsigned int _cacheIndex;
unsigned int _numMetrics; unsigned int _numMetrics;
unsigned int _numInternalMetrics; unsigned int _numInternalMetrics;
......
...@@ -37,7 +37,7 @@ ProcfsSensorGroup &ProcfsSensorGroup::operator=(const ProcfsSensorGroup &other) ...@@ -37,7 +37,7 @@ ProcfsSensorGroup &ProcfsSensorGroup::operator=(const ProcfsSensorGroup &other)
_type = other._type; _type = other._type;
_path = other._path; _path = other._path;
_htVal = other._htVal; _htVal = other._htVal;
_scalingFactor = other._scalingFactor; _sarMax = other._sarMax;
return *this; return *this;
} }
...@@ -145,6 +145,6 @@ void ProcfsSensorGroup::printGroupConfig(LOG_LEVEL ll, unsigned leadingSpaces) { ...@@ -145,6 +145,6 @@ void ProcfsSensorGroup::printGroupConfig(LOG_LEVEL ll, unsigned leadingSpaces) {
LOG_VAR(ll) << leading << "Type: " << _type; LOG_VAR(ll) << leading << "Type: " << _type;
LOG_VAR(ll) << leading << "Path: " << _path; LOG_VAR(ll) << leading << "Path: " << _path;
LOG_VAR(ll) << leading << "HTVal: " << _htVal; 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"); LOG_VAR(ll) << leading << "Parser: " << (_parser ? "true" : "false");
} }
...@@ -48,7 +48,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> { ...@@ -48,7 +48,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
: SensorGroupTemplate(name) { : SensorGroupTemplate(name) {
_parser = NULL; _parser = NULL;
_htVal = 0; _htVal = 0;
_scalingFactor = 1000000; _sarMax = 1000000;
} }
ProcfsSensorGroup &operator=(const ProcfsSensorGroup &other); ProcfsSensorGroup &operator=(const ProcfsSensorGroup &other);
virtual ~ProcfsSensorGroup(); virtual ~ProcfsSensorGroup();
...@@ -62,9 +62,9 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> { ...@@ -62,9 +62,9 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
void setType(std::string t) { this->_type = t; } void setType(std::string t) { this->_type = t; }
void setPath(std::string p) { this->_path = p; } void setPath(std::string p) { this->_path = p; }
void setCpuSet(std::set<int> s) { this->_cpuSet = s; } void setCpuSet(std::set<int> s) { this->_cpuSet = s; }
void setScalingFactor(uint64_t sf) { void setSarMax(uint64_t sf) {
if (sf > 0) if (sf > 0)
this->_scalingFactor = sf; this->_sarMax = sf;
} }
int getHtVal() { return this->_htVal; } int getHtVal() { return this->_htVal; }
...@@ -72,7 +72,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> { ...@@ -72,7 +72,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
std::string getType() { return this->_type; } std::string getType() { return this->_type; }
std::string getPath() { return this->_path; } std::string getPath() { return this->_path; }
std::set<int> *getCpuSet() { return &this->_cpuSet; } 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; void printGroupConfig(LOG_LEVEL ll, unsigned leadingSpaces = 16) final override;
...@@ -91,7 +91,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> { ...@@ -91,7 +91,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
// Set of cpu ids read during configuration // Set of cpu ids read during configuration
std::set<int> _cpuSet; std::set<int> _cpuSet;
// Scaling factor to be used for ratio metrics // Scaling factor to be used for ratio metrics
uint64_t _scalingFactor; uint64_t _sarMax;
std::vector<ureading_t> *_readingVector; std::vector<ureading_t> *_readingVector;
ureading_t _readingBuffer; 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