Example of using CPU counters: implements a graphical plugin for KDE ksysguard.
More...
#include <iostream>
#include <string>
#include <sstream>
#include "cpuasynchcounter.h"
|
#define | HACK_TO_REMOVE_DUPLICATE_ERROR |
|
#define | OUTPUT_CORE_METRIC(name, function) |
|
#define | OUTPUT_SOCKET_METRIC(name, function) |
|
#define | OUTPUT_SYSTEM_METRIC(name, function) |
|
Example of using CPU counters: implements a graphical plugin for KDE ksysguard.
#define OUTPUT_CORE_METRIC |
( |
|
name, |
|
|
|
function |
|
) |
| |
Value:for (uint32 i = 0; i < counters.getNumCores(); ++i) { \
for (uint32 a = 0; a < counters.getNumSockets(); ++a) \
if (a == counters.getSocketId(i)) { \
stringstream c; \
c << "Socket" << a << "/CPU" << i << name; \
if (s == c.str()) { \
cout << function << endl; \
} \
} \
}
#define OUTPUT_SOCKET_METRIC |
( |
|
name, |
|
|
|
function |
|
) |
| |
Value:for (uint32 i = 0; i < counters.getNumSockets(); ++i) { \
stringstream c; \
c << "Socket" << i << name; \
if (s == c.str()) { \
cout << function << endl; \
} \
}
#define OUTPUT_SYSTEM_METRIC |
( |
|
name, |
|
|
|
function |
|
) |
| |
Value:{ \
stringstream c; \
c << name; \
if (s == c.str()) { \
cout << function << endl; \
} \
}