Commit 4aee2d17 authored by Michael Ott's avatar Michael Ott
Browse files

Change semantics of MQTT topic for perf events: the mqttpart string in a...

Change semantics of MQTT topic for perf events: the mqttpart string in a perfevents group is only used as a place holder for the CPU id and determines the width to be used for the CPU id in the MQTT string.
parent 5929511b
......@@ -281,7 +281,7 @@ Explanation of the values specific for the perfevent plugin:
| Value | Explanation |
|:----- |:----------- |
| mqttsuffix | In the context of the perfevent plugin the mqttsuffixes are interpreted as start mqttsuffix. A perfsensor uses a separate MQTT-topic for every CPU. For every used CPU the mqttsuffix is incremented by one. However, dcdbpusher does not allow the same suffix twice! Example: For sensor A the mqttsuffix 00A8 is given and the system on which perfpusher is run has 8 cores. Then perfpusher uses the mqtt-suffixe 00A8, 00A9, 00AA, 00AB, 00AC, 00AD, 00AE, 00AF for the 8 cores. As they are already used by counter A, any other sensor must not use those. Counter B can e.g. start with mqttsuffix 00B0.
| mqttpart | In the context of the perfevent plugin the mqttpart of a group is only used as a place holder for the CPU id. It will be replaced by a string of the same width that holds the CPU id for the event.
| type | Type of which the counter should be. Each type determines different possible values for the config-field. Possible type-values are described below.
| config | Together with the type-field config determines which performance counter should be read. Possible values and what they measure are listed below.
| cpus | One can define a comma-separated list of cpu numbers (also value ranges can be specified, e.g. 2-4 equals 2,3,4). The hardware counter will then be only opened on the specified cpus.
......@@ -474,4 +474,4 @@ TODO!
#### TODOS <a name="todos"></a>
* explain special cases in the code for every plugin?
* more about mqtt-topic
\ No newline at end of file
* more about mqtt-topic
template_group def1 {
interval 5000
mqttpart 02
mqttpart xx
minValues 5
counter hw_instructions {
......@@ -12,20 +12,21 @@ template_group def1 {
template_group def2 {
interval 2000
cpus 1,2
cpus 1,2
mqttpart xx
}
group hw_i {
default def1
mqttpart 23
mqttpart xx
}
group hw_bi {
default def2
mqttpart 0024
mqttpart xx
counter hw_branch_instructions {
mqttsuffix
mqttsuffix 24
type PERF_TYPE_HARDWARE
config PERF_COUNT_HW_BRANCH_INSTRUCTIONS
}
......@@ -34,10 +35,10 @@ group hw_bi {
group hw_bm {
default def2
cpus 0,2-3
mqttpart 002C
mqttpart xx
counter hw_branch_misses {
mqttsuffix
mqttsuffix 2c
type PERF_TYPE_HARDWARE
config PERF_COUNT_HW_BRANCH_MISSES
}
......@@ -45,7 +46,7 @@ group hw_bm {
group cache {
interval 2000
mqttpart 02
mqttpart xx
minValues 3
cpus 2-3
......@@ -64,7 +65,7 @@ group cache {
group sw {
interval 1000
mqttpart 03
mqttpart xx
minValues 3
cpus 1-4
......
......@@ -158,16 +158,19 @@ bool PerfeventConfigurator::readConfig(std::string cfgPath) {
}
}
string startMqtt = group.getMqttPart();
if (group.getMqttPart().size() == 0) {
LOG(warning) << _groupName << " \"" << val.second.data() << "\" has no mqttPart entry set. This is required as a place holder for the CPU id!";
}
//customize perfCounterGroup for every CPU
for (auto i : cpuSet) {
PerfSensorGroup* perfSG = new PerfSensorGroup(group);
string incMqtt = increaseMqtt(startMqtt, i);
std::stringstream mqttPart;
mqttPart << std::setfill ('0') << std::setw(group.getMqttPart().size()) << std::hex << i << "/";
perfSG->setGroupName(perfSG->getGroupName() + std::to_string(i));
perfSG->setCpuId(i);
perfSG->setMqttPart(incMqtt);
perfSG->setMqttPart(mqttPart.str());
storeSensorGroup(perfSG);
}
} else {
......@@ -187,14 +190,6 @@ bool PerfeventConfigurator::readConfig(std::string cfgPath) {
return true;
}
const std::string PerfeventConfigurator::increaseMqtt(const std::string& mqtt, int val) {
unsigned long mqttDigits = stoul(mqtt, 0, 16);
mqttDigits += val;
std::stringstream stream;
stream << std::setfill ('0') << std::setw(mqtt.length()) << std::hex << mqttDigits;
return stream.str();
}
std::set<int> PerfeventConfigurator::parseCpuString(const std::string& cpuString) {
std::set<int> cpus;
int maxCpu = get_nprocs();
......
......@@ -29,17 +29,6 @@ protected:
bool readConfig(std::string cfgPath) override;
private:
/**
* Increase the mqtt by val means
* Example: increaseMqtt("003F", 1) returns "0040"
* increaseMqtt("003F", 15) returns "004D"
*
* @param mqtt The mqtt-topic to be increased
* @param val The value by which the mqtt-topic should be increased
* @return The increased mqtt-topic
*/
const std::string increaseMqtt(const std::string& mqtt, int val);
/**
* Tries to parse the given cpuString as integer numbers. On success, the specified numbers will be inserted
* into a set, which will be returned. On failure, an empty set is returned. A set is used to maintain uniqueness
......
Supports Markdown
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