Commit 6e40c6fe authored by Micha Mueller's avatar Micha Mueller
Browse files

Update readme.txt; minor changes

parent dc8ccb69
......@@ -145,7 +145,7 @@ int Configuration::readCounter(PerfCounter& counter, boost::property_tree::iptre
enumMap_t::iterator it = _enumType.find(val.second.data());
if(it != _enumType.end()) {
counter.setType(it->second);
cout << " Type: " << val.second.data() << " (= " << counter.getType() << ")" << endl;
cout << " Type: " << val.second.data() << " (= " << counter.getType() << ")" << endl;
} else {
cout << " Type \"" << val.second.data() << "\" not known." << endl;
return 1;
......@@ -154,7 +154,7 @@ int Configuration::readCounter(PerfCounter& counter, boost::property_tree::iptre
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;
cout << " Config: " << val.second.data() << " (= " << counter.getConfig() << ")" << endl;
} else {
cout << " Config \"" << val.second.data() << "\" not known." << endl;
return 1;
......
......@@ -59,7 +59,7 @@ void MQTTPusher::push() {
while (keepRunning || totalCount) {
totalCount = 0;
BOOST_FOREACH(PerfCounter& counter, _cfg._perfCounters) {
for(cpu_t& cpu : counter._cpus) {
for(const cpu_t& cpu : counter.getCPUs()) {
if (cpu.readingQueue->read_available() >= counter.getMinValues()) {
if (!_connected) {
if (mosquitto_reconnect(_mosq) != MOSQ_ERR_SUCCESS) {
......
......@@ -101,9 +101,8 @@ void PerfCounter::startPolling(boost::asio::io_service& io) {
pe.size = sizeof(struct perf_event_attr);
pe.config = _config;
pe.disabled = 1;
pe.exclude_kernel = 1;
pe.exclude_kernel = 1; //TODO want to count kernel + hypervisor?
pe.exclude_hv = 1;
//TODO set other parameters?
for (cpu_t& cpu : _cpus) {
cpu.mqtt = increase(_startMqtt, cpu.id);
......@@ -118,7 +117,6 @@ void PerfCounter::startPolling(boost::asio::io_service& io) {
continue;
}
//TODO necessary? or just start with perf-counter enabled ( pe.disabled = 0)?
ioctl(cpu.fd, PERF_EVENT_IOC_RESET, 0);
ioctl(cpu.fd, PERF_EVENT_IOC_ENABLE, 0);
}
......
......@@ -25,6 +25,7 @@ typedef struct {
int fd;
std::string mqtt;
reading_t latestValue;
//TODO better way of storing values for different CPUs?
boost::lockfree::spsc_queue<reading_t>* readingQueue;
} cpu_t;
......@@ -81,6 +82,10 @@ public:
void setConfig(unsigned config) {
_config = config;
}
const std::vector<cpu_t>& getCPUs() const {
return _cpus;
}
/*
const std::size_t getSizeOfReadingQueue() const {
return _readingQueue->read_available();
......@@ -111,10 +116,6 @@ public:
*/
const std::string increase(const std::string& mqtt, int val);
//TODO better way than making it public?
//MQTTPusher doesnt want an complicated access to readingQueues
std::vector<cpu_t> _cpus;
private:
std::string _name;
std::string _startMqtt;
......@@ -123,6 +124,8 @@ private:
unsigned int _type;
unsigned int _config;
std::vector<cpu_t> _cpus;
boost::asio::deadline_timer* _timer;
};
......
Welcome to the perfpusher for DCDB!
This is a scratchpad used to collect useful information and notes on the perfpusher.
This could be considered a (uncomplete) documentation.
This could be considered a (incomplete) documentation.
Intro
DCDB is a database to collect various (sensor-)values of a datacenter for further anlysis.
For harvesting the data various pushers are available.
Perfpusher is tasked with collecting data from the CPUs various performance counters (PMUs) as configured in the config file.
Perfpusher is tasked with collecting data from the CPUs various performance counters (PMUs) as configured in the
config file.
Running perfpusher
An working installation of DCDB is required. Simply compile Perfpusher by running the given makefile. Run Perfpusher by executing the binary and specifying a 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").
Config-file
The config-file consists of a number of mandatory and optional values. The structure a config-file should follow can be seen in the example config-file "perfpusher.conf" which is provided in the repository.
The config-file consists of a number of mandatory and optional values. An example config-file "perfpusher.conf" is
provided in the repository.
The various parameters shall be explained in the following ([m] = mandatory, [o] = optional):
global { [m]
......@@ -24,33 +28,40 @@ global { [m]
perfpusher
mqttprefix /XXXXXXX [m] // to not rewrite a full mqtt-topic for every counter one can specify here the
consistend prefix
threads N [o] // specify how many threads should be created to collect values. If one configures
more counters than one thread can handle in time values are not guaranteed to be
consistent anymore. Default value of threads is 1. Note that the MQTTPusher
always starts an extra thread. So the actual number of started threads is always
N+1.
threads N [o] // specify how many threads should be created to collect values. Default value of
threads is 1. Note that the MQTTPusher always starts an extra thread. So the
actual number of started threads is always N+1.
}
CounterTemplate { [m] // Here one can define template counters which then can be referenced further below
counter A {...} [o] by a real sensor. This field is mainly for convenience reasons. One is not
counter B {...} [o] obligated to define any template sensors. However it is required to at least
... [o] define an empty CounterTemplate {} structure.
... [o] define an empty CounterTemplate {} structure. A template counter is defined
similiar to the normal counters as described below.
}
counters { [m] // Wrapper structure where the "real" counters are specified.
counter c_name { // Every counter has to be announced with the word "counter" followed by a freely
selectable name.
default defC_name [o] // Specify name of default template sensor which values should be used as default.
All values can be overwritten by specifying them again here.
default A [o] // Specify name of default template sensor which values should be used as default.
All default values can be overwritten by specifying them here.
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!
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
00A8, 00A9, 00AA, 00AB, 00AC, 00AD, 00AE, 00AF for the 8 cores.
As they are already used by counter A, any other counter must not use those.
Counter B can e.g. start with mqttsuffix 00B0.
minValues 1 [o] // Number of values which the counter should read before they are pushed to the
broker. Default (if not specified) is 1.
type XX [m] // TODO explain different types
config YY [m] // TODO explain different configs per type
broker. Default (if not specified) is 1. Main purpose is to reduce MQTT-overhead
type XX [m] // Type of which the counter should be. Each type determines different possible
values for the config-field. Possible type-values are described below.
config YY [m] // Together with the type-field config determines which performance counter should
be read. Possible values and what they measure are listed below.
}
counter c_name2 {
......@@ -59,3 +70,62 @@ 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)
type = PERF_TYPE_HARDWARE // generalized hardware CPU events
config = PERF_COUNT_HW_CPU_CYCLES // total cycles (affected by frequency scaling)
= PERF_COUNT_HW_INSTRUCTIONS // retired instructions
= PERF_COUNT_HW_CACHE_REFERENCES // cache accesses (usually last level)
= PERF_COUNT_HW_CACHE_MISSES // cache misses (usually last level)
= PERF_COUNT_HW_BRANCH_INSTRUCTIONS // retired branch instructions
= PERF_COUNT_HW_BRANCH_MISSES // mispredicted branch instructions
= PERF_COUNT_HW_BUS_CYCLES // bus cycles
= PERF_COUNT_HW_STALLED_CYCLES_FRONTEND // stalled cycles during issue
= PERF_COUNT_HW_STALLED_CYCLES_BACKEND // stalled cycles during retirement
= PERF_COUNT_HW_REF_CPU_CYCLES // total cycles (unaffected by frequency scaling)
type = PERF_TYPE_SOFTWARE // software events provided by the kernel
config = PERF_COUNT_SW_CPU_CLOCK // reports CPU clock
PERF_COUNT_SW_TASK_CLOCK // clock count specific to the running task
PERF_COUNT_SW_PAGE_FAULTS // number of page faults
PERF_COUNT_SW_CONTEXT_SWITCHES // count of context switches
PERF_COUNT_SW_CPU_MIGRATIONS // times the process has migrated to a new CPU
PERF_COUNT_SW_PAGE_FAULTS_MIN // number of minor page faults (no disk-I/O)
PERF_COUNT_SW_PAGE_FAULTS_MAJ // number of major page faults (disk-I/O was required)
PERF_COUNT_SW_ALIGNMENT_FAULTS // alignment faults when accessing unaligned memory
PERF_COUNT_SW_EMULATION_FAULTS //number of unimplemented instructions which had to be emulated
PERF_COUNT_SW_DUMMY // placeholder which counts nothing
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_BREAKPOINT // not yet implemented
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