Commit a0304326 authored by Carla Guillen's avatar Carla Guillen
Browse files

Merge branch 'development' of https://gitlab.lrz.de/dcdb/dcdb into development

parents 16a36578 4bfabbfc
......@@ -643,6 +643,8 @@ Explanation of the values specific for the ProcFS plugin:
| type | The type of the file parsed by the sensor group. Can be either "vmstat", "meminfo", "procstat" or "sar"
| 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.
| 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:
......
......@@ -135,6 +135,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()));
}
}
......@@ -160,6 +162,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());
// If no metrics were found in the file (or the file is unreadable) the configuration aborts
int numMetrics = 0;
......
......@@ -49,6 +49,7 @@ ProcfsParser::ProcfsParser(std::string path) {
_stringBuffer = NULL;
_chars_read = 0;
_cacheIndex = 0;
_scalingFactor = 1000000;
}
/**
......@@ -625,7 +626,7 @@ bool SARParser::_readMetrics() {
for(auto& l : _lines)
if(!l.skip && l.multi && (!_htAggr || l.cpuID<_htVal)) {
for (colCtr = 0; colCtr < (unsigned)l.columns; colCtr++)
_readings->at(l.dest + colCtr).value = _readings->at(l.dest + colCtr).value * SAR_MULTIPLIER / _accumulators[l.cpuID + 1];
_readings->at(l.dest + colCtr).value = _readings->at(l.dest + colCtr).value * _scalingFactor / _accumulators[l.cpuID + 1];
_accumulators[l.cpuID + 1] = 1;
}
......
......@@ -39,7 +39,6 @@
#include <string.h>
#include <exception>
#define SAR_MULTIPLIER 1000000
/**
* @brief Provides an interface to parse metrics (and their values) from files
......@@ -73,9 +72,11 @@ public:
unsigned int getNumMetrics() { return _numMetrics; }
unsigned int getNumCPUs() { return _numCPUs; }
unsigned int getCacheIndex() { return _cacheIndex; }
uint64_t getScalingFactor() { return _scalingFactor; }
void setCacheIndex(unsigned int c) { _cacheIndex = c; }
void setHtVal(int v) { _htVal = v; _htAggr = v>0; }
void setPath(std::string new_path) { _path = new_path; close(); }
void setScalingFactor(uint64_t sf) { _scalingFactor = sf; }
std::vector<ProcfsSBPtr> *getSensors();
std::vector<ureading_t> *readSensors();
......@@ -100,6 +101,7 @@ protected:
// Internal variables
bool _initialized;
uint64_t _scalingFactor;
unsigned int _cacheIndex;
unsigned int _numMetrics;
unsigned int _numInternalMetrics;
......
......@@ -37,6 +37,7 @@ ProcfsSensorGroup& ProcfsSensorGroup::operator=(const ProcfsSensorGroup& other)
_type = other._type;
_path = other._path;
_htVal = other._htVal;
_scalingFactor = other._scalingFactor;
return *this;
}
......@@ -140,5 +141,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 << "Parser: " << (_parser ? "true" : "false");
}
......@@ -44,7 +44,7 @@ class ProcfsSensorGroup : public SensorGroupTemplate<ProcfsSensorBase> {
public:
// Constructor and destructor
ProcfsSensorGroup(const std::string& name) : SensorGroupTemplate(name) { this->_parser = NULL; this->_htVal=0; }
ProcfsSensorGroup(const std::string& name) : SensorGroupTemplate(name) { _parser = NULL; _htVal=0; _scalingFactor=1000000; }
ProcfsSensorGroup& operator=(const ProcfsSensorGroup& other);
virtual ~ProcfsSensorGroup();
......@@ -57,12 +57,14 @@ public:
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) { if(sf>0) this->_scalingFactor = sf; }
int getHtVal() { return this->_htVal; }
ProcfsParser *getParser() { return this->_parser; }
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; }
// Method to get the internal sensor vector used by the sensor group (different from getSensors)
std::vector<ProcfsSBPtr>& getDerivedSensors() { return this->_sensors; }
......@@ -84,6 +86,8 @@ private:
int _htVal;
// Set of cpu ids read during configuration
std::set<int> _cpuSet;
// Scaling factor to be used for ratio metrics
uint64_t _scalingFactor;
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