aboutsummaryrefslogtreecommitdiff
path: root/daemon/StreamlineSetup.cpp
diff options
context:
space:
mode:
authorDrew Richardson <drew.richardson@arm.com>2014-04-07 12:00:00 -0700
committerDrew Richardson <drew.richardson@arm.com>2014-12-19 15:54:15 -0800
commit020278c1a682ea75ddb63fe4e0d373116935199f (patch)
tree697ac3d6fc26467eca30e00d0e6bed1d6f6f1c5b /daemon/StreamlineSetup.cpp
parentf1f81bcde6ec1647ad617d68b4626951e3c1d019 (diff)
gator: Version 5.185.18
Signed-off-by: Drew Richardson <drew.richardson@arm.com>
Diffstat (limited to 'daemon/StreamlineSetup.cpp')
-rw-r--r--daemon/StreamlineSetup.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/daemon/StreamlineSetup.cpp b/daemon/StreamlineSetup.cpp
index 2faada2..caa665e 100644
--- a/daemon/StreamlineSetup.cpp
+++ b/daemon/StreamlineSetup.cpp
@@ -1,26 +1,23 @@
/**
- * Copyright (C) ARM Limited 2011-2013. All rights reserved.
+ * Copyright (C) ARM Limited 2011-2014. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include "Sender.h"
-#include "Logging.h"
-#include "OlyUtility.h"
-#include "SessionData.h"
-#include "CapturedXML.h"
#include "StreamlineSetup.h"
+
+#include "Buffer.h"
+#include "CapturedXML.h"
#include "ConfigurationXML.h"
#include "Driver.h"
#include "EventsXML.h"
+#include "Logging.h"
+#include "OlySocket.h"
+#include "OlyUtility.h"
+#include "Sender.h"
+#include "SessionData.h"
static const char* TAG_SESSION = "session";
static const char* TAG_REQUEST = "request";
@@ -198,12 +195,9 @@ void StreamlineSetup::handleDeliver(char* xml) {
void StreamlineSetup::sendData(const char* data, uint32_t length, char type) {
unsigned char header[5];
header[0] = type;
- header[1] = (length >> 0) & 0xff;
- header[2] = (length >> 8) & 0xff;
- header[3] = (length >> 16) & 0xff;
- header[4] = (length >> 24) & 0xff;
+ Buffer::writeLEInt(header + 1, length);
mSocket->send((char*)&header, sizeof(header));
- mSocket->send((char*)data, length);
+ mSocket->send((const char*)data, length);
}
void StreamlineSetup::sendEvents() {
@@ -241,8 +235,14 @@ void StreamlineSetup::sendCounters() {
xml = mxmlNewXML("1.0");
counters = mxmlNewElement(xml, "counters");
+ int count = 0;
for (Driver *driver = Driver::getHead(); driver != NULL; driver = driver->getNext()) {
- driver->writeCounters(counters);
+ count += driver->writeCounters(counters);
+ }
+
+ if (count == 0) {
+ logg->logError(__FILE__, __LINE__, "No counters found, this could be because /dev/gator/events can not be read or because perf is not working correctly");
+ handleException();
}
char* string = mxmlSaveAllocString(xml, mxmlWhitespaceCB);