aboutsummaryrefslogtreecommitdiff
path: root/daemon/ConfigurationXML.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/ConfigurationXML.cpp')
-rw-r--r--daemon/ConfigurationXML.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/daemon/ConfigurationXML.cpp b/daemon/ConfigurationXML.cpp
index 145ddbd..a213cbb 100644
--- a/daemon/ConfigurationXML.cpp
+++ b/daemon/ConfigurationXML.cpp
@@ -21,20 +21,19 @@ static const char* ATTR_REVISION = "revision";
static const char* ATTR_TITLE = "title";
static const char* ATTR_NAME = "name";
static const char* ATTR_EVENT = "event";
-static const char* ATTR_COLOR = "color";
static const char* ATTR_COUNT = "count";
-static const char* ATTR_OPERATION = "operation";
static const char* ATTR_PER_CPU = "per_cpu";
static const char* ATTR_DESCRIPTION = "description";
-static const char* ATTR_EBS = "event_based_sampling";
-static const char* ATTR_LEVEL = "level";
-static const char* ATTR_ALIAS = "alias";
+static const char* ATTR_EBS = "supports_event_based_sampling";
static const char* ATTR_DISPLAY = "display";
static const char* ATTR_UNITS = "units";
static const char* ATTR_AVERAGE_SELECTION = "average_selection";
ConfigurationXML::ConfigurationXML() {
-#include "configuration_xml.h" // defines and initializes char configuration_xml[] and int configuration_xml_len
+ const char * configuration_xml;
+ unsigned int configuration_xml_len;
+ getDefaultConfigurationXml(configuration_xml, configuration_xml_len);
+
mIndex = 0;
char* path = (char*)malloc(PATH_MAX);
@@ -61,6 +60,9 @@ ConfigurationXML::ConfigurationXML() {
gSessionData->mPerfCounterEnabled[i] = 0;
}
+ // clear counter overflow
+ gSessionData->mCounterOverflow = false;
+
int ret = parse(mConfigurationXML);
if (ret == 1) {
// remove configuration.xml on disk to use the default
@@ -151,8 +153,8 @@ int ConfigurationXML::configurationsTag(mxml_node_t *node) {
void ConfigurationXML::configurationTag(mxml_node_t *node) {
// handle all other performance counters
if (mIndex >= MAX_PERFORMANCE_COUNTERS) {
- logg->logError(__FILE__, __LINE__, "Exceeded maximum number of %d performance counters", MAX_PERFORMANCE_COUNTERS);
- handleException();
+ gSessionData->mCounterOverflow = true;
+ return;
}
// read attributes
@@ -162,12 +164,8 @@ void ConfigurationXML::configurationTag(mxml_node_t *node) {
if (mxmlElementGetAttr(node, ATTR_DESCRIPTION)) strncpy(gSessionData->mPerfCounterDescription[mIndex], mxmlElementGetAttr(node, ATTR_DESCRIPTION), sizeof(gSessionData->mPerfCounterDescription[mIndex]));
if (mxmlElementGetAttr(node, ATTR_EVENT)) gSessionData->mPerfCounterEvent[mIndex] = strtol(mxmlElementGetAttr(node, ATTR_EVENT), NULL, 16);
if (mxmlElementGetAttr(node, ATTR_COUNT)) gSessionData->mPerfCounterCount[mIndex] = strtol(mxmlElementGetAttr(node, ATTR_COUNT), NULL, 10);
- if (mxmlElementGetAttr(node, ATTR_COLOR)) gSessionData->mPerfCounterColor[mIndex] = strtol(mxmlElementGetAttr(node, ATTR_COLOR), NULL, 16);
if (mxmlElementGetAttr(node, ATTR_PER_CPU)) gSessionData->mPerfCounterPerCPU[mIndex] = util->stringToBool(mxmlElementGetAttr(node, ATTR_PER_CPU), false);
if (mxmlElementGetAttr(node, ATTR_EBS)) gSessionData->mPerfCounterEBSCapable[mIndex] = util->stringToBool(mxmlElementGetAttr(node, ATTR_EBS), false);
- if (mxmlElementGetAttr(node, ATTR_OPERATION)) strncpy(gSessionData->mPerfCounterOperation[mIndex], mxmlElementGetAttr(node, ATTR_OPERATION), sizeof(gSessionData->mPerfCounterOperation[mIndex]));
- if (mxmlElementGetAttr(node, ATTR_LEVEL)) gSessionData->mPerfCounterLevel[mIndex] = util->stringToBool(mxmlElementGetAttr(node, ATTR_LEVEL), false);
- if (mxmlElementGetAttr(node, ATTR_ALIAS)) strncpy(gSessionData->mPerfCounterAlias[mIndex], mxmlElementGetAttr(node, ATTR_ALIAS), sizeof(gSessionData->mPerfCounterAlias[mIndex]));
if (mxmlElementGetAttr(node, ATTR_DISPLAY)) strncpy(gSessionData->mPerfCounterDisplay[mIndex], mxmlElementGetAttr(node, ATTR_DISPLAY), sizeof(gSessionData->mPerfCounterDisplay[mIndex]));
if (mxmlElementGetAttr(node, ATTR_UNITS)) strncpy(gSessionData->mPerfCounterUnits[mIndex], mxmlElementGetAttr(node, ATTR_UNITS), sizeof(gSessionData->mPerfCounterUnits[mIndex]));
if (mxmlElementGetAttr(node, ATTR_AVERAGE_SELECTION)) gSessionData->mPerfCounterAverageSelection[mIndex] = util->stringToBool(mxmlElementGetAttr(node, ATTR_AVERAGE_SELECTION), false);
@@ -178,11 +176,17 @@ void ConfigurationXML::configurationTag(mxml_node_t *node) {
gSessionData->mPerfCounterTitle[mIndex][sizeof(gSessionData->mPerfCounterTitle[mIndex]) - 1] = 0;
gSessionData->mPerfCounterName[mIndex][sizeof(gSessionData->mPerfCounterName[mIndex]) - 1] = 0;
gSessionData->mPerfCounterDescription[mIndex][sizeof(gSessionData->mPerfCounterDescription[mIndex]) - 1] = 0;
- gSessionData->mPerfCounterOperation[mIndex][sizeof(gSessionData->mPerfCounterOperation[mIndex]) - 1] = 0;
- gSessionData->mPerfCounterAlias[mIndex][sizeof(gSessionData->mPerfCounterAlias[mIndex]) - 1] = 0;
gSessionData->mPerfCounterDisplay[mIndex][sizeof(gSessionData->mPerfCounterDisplay[mIndex]) - 1] = 0;
gSessionData->mPerfCounterUnits[mIndex][sizeof(gSessionData->mPerfCounterUnits[mIndex]) - 1] = 0;
// update counter index
mIndex++;
}
+
+void ConfigurationXML::getDefaultConfigurationXml(const char * & xml, unsigned int & len) {
+ // the first line of configuration_xml.h is "unsigned char configuration_xml", but configuration_xml needs to be const static as well
+ const static
+#include "configuration_xml.h" // defines and initializes char configuration_xml[] and int configuration_xml_len
+ xml = (const char *)configuration_xml;
+ len = configuration_xml_len;
+}