Commit d53a8c09 authored by Micha Mueller's avatar Micha Mueller
Browse files

Add implementation for PERF_TYPE_RAW

parent 59925921
......@@ -125,7 +125,7 @@ Configuration::Configuration(std::string cfgFile) {
//read remaining values
if(!readCounter(perfCounter, counter.second)) {
//now create distinct perfCounter and mqttSuffix per CPU
//create distinct perfCounter and mqttSuffix per CPU
string startMqtt = perfCounter.getMqtt();
......@@ -175,13 +175,24 @@ int Configuration::readCounter(PerfCounter& counter, boost::property_tree::iptre
return 1;
}
} else if (boost::iequals(val.first, "config")) {
enumMap_t::iterator it = _enumConfig.find(val.second.data());
if(it != _enumConfig.end()) {
counter.setConfig(it->second);
cout << " Config: " << val.second.data() << " (= " << counter.getConfig() << ")" << endl;
if (counter.getType() == PERF_TYPE_BREAKPOINT) {
//leave config zero
} else if (counter.getType() == PERF_TYPE_RAW) {
//read in custom hex-value
//TODO read in string-name and map to hex-value here?
// see info to perf_event_open and libpfm4
unsigned long config = stoul(val.second.data(), 0, 16);
counter.setConfig(config);
cout << " Config: Raw value: " << counter.getConfig() << endl;
} else {
cout << " Config \"" << val.second.data() << "\" not known." << endl;
return 1;
enumMap_t::iterator it = _enumConfig.find(val.second.data());
if(it != _enumConfig.end()) {
counter.setConfig(it->second);
cout << " Config: " << val.second.data() << " (= " << counter.getConfig() << ")" << endl;
} else {
cout << " Config \"" << val.second.data() << "\" not known." << endl;
return 1;
}
}
} else if (boost::iequals(val.first, "default")) {
//avoid unnecessary "Value not recognized" message
......
......@@ -15,7 +15,7 @@ config file.
A working broker is required to which Perfpusher can send its messages. Simply compile Perfpusher by running the
given makefile. Run Perfpusher by executing the binary and specifying a config file. NOTE: Access to some PMUs is
restricted, if the value in /proc/sys/kernel/perf_event_paranoid is too high (see sections "Access PMUs").
restricted, if the value in /proc/sys/kernel/perf_event_paranoid is too high (see [1]).
Config-file
......@@ -48,8 +48,8 @@ counters { [m] // Wrapper structure where the "real" counters
interval 1000 [o] // Time in [ms] between two reads. Default is 1000ms = 1s.
mqttsuffix 0000 [m] // MQTT-suffix to append to the global prefix to obtain a full MQTT-topic.
Perfpusher uses a separate MQTT-topic for every CPU. For every found CPU the
mqttsuffix is increased by one. The user has to make sure that the ranges of the
mqtt-suffixes do not overlap!
mqttsuffix is increased by one. Perfpusher will terminate if an suffix is used
twice!
Example:
For counter A the mqttsuffix 00A8 is given and the system on which perfpusher is
run has 8 cores. Then perfpusher uses the mqtt-suffixe
......@@ -72,25 +72,6 @@ counters { [m] // Wrapper structure where the "real" counters
}
Access PMUs
Cited from "http://man7.org/linux/man-pages/man2/perf_event_open.2.html":
The perf_event_paranoid file can be set to restrict access to the performance counters.
2 allow only user-space measurements (default since
Linux 4.6).
1 allow both kernel and user measurements (default
before Linux 4.6).
0 allow access to CPU-specific data but not raw trace‐
point samples.
-1 no restrictions.
The existence of the perf_event_paranoid file is the offi‐
cial method for determining if a kernel supports
perf_event_open().
type + config
(see "http://man7.org/linux/man-pages/man2/perf_event_open.2.html" for more detailed explanations)
......@@ -123,9 +104,39 @@ type = PERF_TYPE_TRACEPOINT // not yet implemented
type = PERF_TYPE_HW_CACHE // not yet implemented
type = PERF_TYPE_RAW // not yet implemented
type = PERF_TYPE_RAW // user can define architecture-specific raw events here.
config = XXXX // Config must be an hex value (without 0x prefix). See [2]
type = PERF_TYPE_BREAKPOINT // not yet implemented
type = PERF_TYPE_BREAKPOINT // config not required, any values will be ignored.
config = // However config must be specified (even if empty)
Cited from "http://man7.org/linux/man-pages/man2/perf_event_open.2.html":
[1]
The perf_event_paranoid file can be set to restrict access to the performance counters.
2 allow only user-space measurements (default since
Linux 4.6).
1 allow both kernel and user measurements (default
before Linux 4.6).
0 allow access to CPU-specific data but not raw trace‐
point samples.
-1 no restrictions.
The existence of the perf_event_paranoid file is the offi‐
cial method for determining if a kernel supports
perf_event_open().
[2]
If type is PERF_TYPE_RAW, then a custom "raw" config value is
needed. Most CPUs support events that are not covered by the
"generalized" events. These are implementation defined; see
your CPU manual (for example the Intel Volume 3B documentation
or the AMD BIOS and Kernel Developer Guide). The libpfm4
library can be used to translate from the name in the archi‐
tectural manuals to the raw hex value perf_event_open()
expects in this field
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