diff options
Diffstat (limited to 'daemon/CapturedXML.cpp')
-rw-r--r-- | daemon/CapturedXML.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/daemon/CapturedXML.cpp b/daemon/CapturedXML.cpp index f02ed2a..30d984f 100644 --- a/daemon/CapturedXML.cpp +++ b/daemon/CapturedXML.cpp @@ -22,12 +22,12 @@ CapturedXML::CapturedXML() { CapturedXML::~CapturedXML() { } -mxml_node_t* CapturedXML::getTree() { +mxml_node_t* CapturedXML::getTree(bool includeTime) { bool perfCounters = false; mxml_node_t *xml; - mxml_node_t *captured; - mxml_node_t *target; - mxml_node_t *counters; + mxml_node_t *captured; + mxml_node_t *target; + mxml_node_t *counters; mxml_node_t *counter; int x; @@ -43,11 +43,10 @@ mxml_node_t* CapturedXML::getTree() { captured = mxmlNewElement(xml, "captured"); mxmlElementSetAttr(captured, "version", "1"); mxmlElementSetAttrf(captured, "protocol", "%d", PROTOCOL_VERSION); - if (gSessionData->mBytes > 0) { // Send the following only after the capture is complete + if (includeTime) { // Send the following only after the capture is complete if (time(NULL) > 1267000000) { // If the time is reasonable (after Feb 23, 2010) mxmlElementSetAttrf(captured, "created", "%lu", time(NULL)); // Valid until the year 2038 } - mxmlElementSetAttrf(captured, "bytes", "%d", gSessionData->mBytes); } target = mxmlNewElement(captured, "target"); @@ -69,18 +68,9 @@ mxml_node_t* CapturedXML::getTree() { if (gSessionData->mPerfCounterPerCPU[x]) { mxmlElementSetAttr(counter, "per_cpu", "yes"); } - if (strlen(gSessionData->mPerfCounterOperation[x]) > 0) { - mxmlElementSetAttr(counter, "operation", gSessionData->mPerfCounterOperation[x]); - } if (gSessionData->mPerfCounterCount[x] > 0) { mxmlElementSetAttrf(counter, "count", "%d", gSessionData->mPerfCounterCount[x]); } - if (gSessionData->mPerfCounterLevel[x]) { - mxmlElementSetAttr(counter, "level", "yes"); - } - if (strlen(gSessionData->mPerfCounterAlias[x]) > 0) { - mxmlElementSetAttr(counter, "alias", gSessionData->mPerfCounterAlias[x]); - } if (strlen(gSessionData->mPerfCounterDisplay[x]) > 0) { mxmlElementSetAttr(counter, "display", gSessionData->mPerfCounterDisplay[x]); } @@ -98,9 +88,9 @@ mxml_node_t* CapturedXML::getTree() { return xml; } -char* CapturedXML::getXML() { +char* CapturedXML::getXML(bool includeTime) { char* xml_string; - mxml_node_t *xml = getTree(); + mxml_node_t *xml = getTree(includeTime); xml_string = mxmlSaveAllocString(xml, mxmlWhitespaceCB); mxmlDelete(xml); return xml_string; @@ -112,7 +102,7 @@ void CapturedXML::write(char* path) { // Set full path snprintf(file, PATH_MAX, "%s/captured.xml", path); - char* xml = getXML(); + char* xml = getXML(true); if (util->writeToDisk(file, xml) < 0) { logg->logError(__FILE__, __LINE__, "Error writing %s\nPlease verify the path.", file); handleException(); |