summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDrew Richardson <drew.richardson@arm.com>2015-11-18 12:00:00 -0800
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:49:42 +0900
commit48cd022f1369e1d002f77e9dcf6a839c36d80e6c (patch)
tree9f1a0313760507a5b3f593ea619b782c7591aae4 /tools
parent54aed7598bf0fffefcde7211224700d2a0f43cf4 (diff)
gator: Version 5.23
Signed-off-by: Drew Richardson <drew.richardson@arm.com> [Ported from https://github.com/ARM-software/gator.git to kernel tree, out of tree files are removed] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/gator/daemon/Android.mk2
-rw-r--r--tools/gator/daemon/AtraceDriver.cpp18
-rw-r--r--tools/gator/daemon/Buffer.cpp26
-rw-r--r--tools/gator/daemon/Buffer.h15
-rw-r--r--tools/gator/daemon/CCNDriver.cpp10
-rw-r--r--tools/gator/daemon/CapturedXML.cpp20
-rw-r--r--tools/gator/daemon/Child.cpp99
-rw-r--r--tools/gator/daemon/Command.cpp25
-rw-r--r--tools/gator/daemon/ConfigurationXML.cpp60
-rw-r--r--tools/gator/daemon/DiskIODriver.cpp6
-rw-r--r--tools/gator/daemon/DriverSource.cpp68
-rw-r--r--tools/gator/daemon/DynBuf.cpp52
-rw-r--r--tools/gator/daemon/DynBuf.h4
-rw-r--r--tools/gator/daemon/EventsXML.cpp95
-rw-r--r--tools/gator/daemon/ExternalDriver.cpp42
-rw-r--r--tools/gator/daemon/ExternalSource.cpp99
-rw-r--r--tools/gator/daemon/ExternalSource.h6
-rw-r--r--tools/gator/daemon/FSDriver.cpp10
-rw-r--r--tools/gator/daemon/Fifo.cpp4
-rw-r--r--tools/gator/daemon/FtraceDriver.cpp35
-rw-r--r--tools/gator/daemon/FtraceDriver.h4
-rw-r--r--tools/gator/daemon/HwmonDriver.cpp12
-rw-r--r--tools/gator/daemon/KMod.cpp4
-rw-r--r--tools/gator/daemon/LocalCapture.cpp30
-rw-r--r--tools/gator/daemon/Logging.cpp75
-rw-r--r--tools/gator/daemon/Logging.h24
-rw-r--r--tools/gator/daemon/Makefile2
-rw-r--r--tools/gator/daemon/MaliVideoDriver.cpp4
-rw-r--r--tools/gator/daemon/MemInfoDriver.cpp4
-rw-r--r--tools/gator/daemon/MidgardDriver.cpp325
-rw-r--r--tools/gator/daemon/MidgardDriver.h37
-rw-r--r--tools/gator/daemon/Monitor.cpp8
-rw-r--r--tools/gator/daemon/NetDriver.cpp6
-rw-r--r--tools/gator/daemon/OlySocket.cpp40
-rw-r--r--tools/gator/daemon/OlySocket.h2
-rw-r--r--tools/gator/daemon/OlyUtility.cpp20
-rw-r--r--tools/gator/daemon/OlyUtility.h26
-rw-r--r--tools/gator/daemon/PerfBuffer.cpp30
-rw-r--r--tools/gator/daemon/PerfBuffer.h2
-rw-r--r--tools/gator/daemon/PerfDriver.cpp197
-rw-r--r--tools/gator/daemon/PerfDriver.h8
-rw-r--r--tools/gator/daemon/PerfGroup.cpp95
-rw-r--r--tools/gator/daemon/PerfGroup.h2
-rw-r--r--tools/gator/daemon/PerfSource.cpp135
-rw-r--r--tools/gator/daemon/PmuXML.cpp138
-rw-r--r--tools/gator/daemon/PmuXML.h29
-rw-r--r--tools/gator/daemon/Proc.cpp54
-rw-r--r--tools/gator/daemon/Sender.cpp27
-rw-r--r--tools/gator/daemon/Sender.h3
-rw-r--r--tools/gator/daemon/SessionData.cpp104
-rw-r--r--tools/gator/daemon/SessionData.h100
-rw-r--r--tools/gator/daemon/SessionXML.cpp46
-rw-r--r--tools/gator/daemon/Setup.cpp34
-rw-r--r--tools/gator/daemon/Source.cpp2
-rw-r--r--tools/gator/daemon/StreamlineSetup.cpp79
-rw-r--r--tools/gator/daemon/UEvent.cpp8
-rw-r--r--tools/gator/daemon/UserSpaceSource.cpp32
-rw-r--r--tools/gator/daemon/common.mk6
-rw-r--r--tools/gator/daemon/defaults.xml7
-rw-r--r--tools/gator/daemon/events-Cortex-A5.xml4
-rw-r--r--tools/gator/daemon/events-Cortex-A7.xml4
-rw-r--r--tools/gator/daemon/events-Cortex-A8.xml4
-rw-r--r--tools/gator/daemon/events-Cortex-A9.xml4
-rw-r--r--tools/gator/daemon/events-Exynos-M1.xml89
-rw-r--r--tools/gator/daemon/events-Krait-architected.xml4
-rw-r--r--tools/gator/daemon/events-Linux.xml6
-rw-r--r--tools/gator/daemon/events-Mali-4xx.xml14
-rw-r--r--tools/gator/daemon/events-Mali-Midgard.xml29
-rw-r--r--tools/gator/daemon/events-Mali-T60x_hw.xml35
-rw-r--r--tools/gator/daemon/events-Mali-T62x_hw.xml34
-rw-r--r--tools/gator/daemon/events-Mali-T72x_hw.xml32
-rw-r--r--tools/gator/daemon/events-Mali-T76x_hw.xml35
-rw-r--r--tools/gator/daemon/events-Mali-T82x_hw.xml32
-rw-r--r--tools/gator/daemon/events-Mali-T83x_hw.xml32
-rw-r--r--tools/gator/daemon/events-Mali-T86x_hw.xml33
-rw-r--r--tools/gator/daemon/events-Mali-T88x_hw.xml33
-rw-r--r--tools/gator/daemon/events-Other.xml4
-rw-r--r--tools/gator/daemon/events-Scorpion.xml4
-rw-r--r--tools/gator/daemon/events-ScorpionMP.xml4
-rw-r--r--tools/gator/daemon/k/perf_event.h184
-rw-r--r--tools/gator/daemon/libsensors/access.c4
-rw-r--r--tools/gator/daemon/libsensors/access.h2
-rw-r--r--tools/gator/daemon/libsensors/conf-lex.c78
-rw-r--r--tools/gator/daemon/libsensors/conf-parse.c1157
-rw-r--r--tools/gator/daemon/libsensors/conf-parse.h75
-rw-r--r--tools/gator/daemon/libsensors/data.c2
-rw-r--r--tools/gator/daemon/libsensors/data.h2
-rw-r--r--tools/gator/daemon/libsensors/error.c27
-rw-r--r--tools/gator/daemon/libsensors/error.h2
-rw-r--r--tools/gator/daemon/libsensors/init.c8
-rw-r--r--tools/gator/daemon/libsensors/init.h2
-rw-r--r--tools/gator/daemon/libsensors/sensors.h7
-rw-r--r--tools/gator/daemon/libsensors/sysfs.c139
-rw-r--r--tools/gator/daemon/libsensors/sysfs.h2
-rw-r--r--tools/gator/daemon/libsensors/version.h2
-rw-r--r--tools/gator/daemon/main.cpp126
-rw-r--r--tools/gator/daemon/notify/COPYING339
-rw-r--r--tools/gator/daemon/notify/Makefile24
-rw-r--r--tools/gator/daemon/notify/Notify.java31
-rw-r--r--tools/gator/daemon/pmus.xml37
100 files changed, 2681 insertions, 2462 deletions
diff --git a/tools/gator/daemon/Android.mk b/tools/gator/daemon/Android.mk
index ae49e688c83a..96a2d1e61e62 100644
--- a/tools/gator/daemon/Android.mk
+++ b/tools/gator/daemon/Android.mk
@@ -29,6 +29,7 @@ LOCAL_SRC_FILES := \
main.cpp \
MaliVideoDriver.cpp \
MemInfoDriver.cpp\
+ MidgardDriver.cpp \
Monitor.cpp \
NetDriver.cpp \
OlySocket.cpp \
@@ -37,6 +38,7 @@ LOCAL_SRC_FILES := \
PerfDriver.cpp \
PerfGroup.cpp \
PerfSource.cpp \
+ PmuXML.cpp \
Proc.cpp \
Sender.cpp \
SessionData.cpp \
diff --git a/tools/gator/daemon/AtraceDriver.cpp b/tools/gator/daemon/AtraceDriver.cpp
index 78fe58a5c46a..8894c92fa5ba 100644
--- a/tools/gator/daemon/AtraceDriver.cpp
+++ b/tools/gator/daemon/AtraceDriver.cpp
@@ -52,21 +52,21 @@ AtraceDriver::~AtraceDriver() {
}
void AtraceDriver::readEvents(mxml_node_t *const xml) {
- if (!gSessionData->mFtraceDriver.isSupported()) {
- logg->logMessage("Atrace support disabled, ftrace support is required");
+ if (!gSessionData.mFtraceDriver.isSupported()) {
+ logg.logSetup("Atrace Disabled\nftrace support is required");
return;
}
if (access("/system/bin/setprop", X_OK) != 0) {
- logg->logMessage("Atrace support disabled, setprop is not found, this is not an Android target");
+ logg.logSetup("Atrace Disabled\nsetprop is not found, this is not an Android target");
return;
}
- if (util->getApplicationFullPath(mNotifyPath, sizeof(mNotifyPath)) != 0) {
- logg->logMessage("Unable to determine the full path of gatord, the cwd will be used");
+ if (getApplicationFullPath(mNotifyPath, sizeof(mNotifyPath)) != 0) {
+ logg.logMessage("Unable to determine the full path of gatord, the cwd will be used");
}
strncat(mNotifyPath, "notify.dex", sizeof(mNotifyPath) - strlen(mNotifyPath) - 1);
if (access(mNotifyPath, W_OK) != 0) {
- logg->logMessage("Atrace support disabled, unable to locate notify.dex");
+ logg.logSetup("Atrace Disabled\nunable to locate notify.dex");
return;
}
@@ -89,7 +89,7 @@ void AtraceDriver::readEvents(mxml_node_t *const xml) {
const char *flag = mxmlElementGetAttr(node, "flag");
if (flag == NULL) {
- logg->logError("The atrace counter %s is missing the required flag attribute", counter);
+ logg.logError("The atrace counter %s is missing the required flag attribute", counter);
handleException();
}
setCounters(new AtraceCounter(getCounters(), strdup(counter), strtol(flag, NULL, 16)));
@@ -97,10 +97,10 @@ void AtraceDriver::readEvents(mxml_node_t *const xml) {
}
void AtraceDriver::setAtrace(const int flags) {
- logg->logMessage("Setting atrace flags to %i\n", flags);
+ logg.logMessage("Setting atrace flags to %i", flags);
pid_t pid = fork();
if (pid < 0) {
- logg->logError("fork failed");
+ logg.logError("fork failed");
handleException();
} else if (pid == 0) {
char buf[1<<10];
diff --git a/tools/gator/daemon/Buffer.cpp b/tools/gator/daemon/Buffer.cpp
index 26deb2e43723..4ff4cb439030 100644
--- a/tools/gator/daemon/Buffer.cpp
+++ b/tools/gator/daemon/Buffer.cpp
@@ -47,9 +47,9 @@ enum {
/* Add another character so the length isn't 0x0a bytes */ \
"5"
-Buffer::Buffer(const int32_t core, const int32_t buftype, const int size, sem_t *const readerSem) : mBuf(new char[size]), mReaderSem(readerSem), mCommitTime(gSessionData->mLiveRate), mSize(size), mReadPos(0), mWritePos(0), mCommitPos(0), mAvailable(true), mIsDone(false), mCore(core), mBufType(buftype) {
+Buffer::Buffer(const int32_t core, const int32_t buftype, const int size, sem_t *const readerSem) : mBuf(new char[size]), mReaderSem(readerSem), mCommitTime(gSessionData.mLiveRate), mSize(size), mReadPos(0), mWritePos(0), mCommitPos(0), mAvailable(true), mIsDone(false), mCore(core), mBufType(buftype) {
if ((mSize & mask) != 0) {
- logg->logError("Buffer size is not a power of 2");
+ logg.logError("Buffer size is not a power of 2");
handleException();
}
sem_init(&mWriterSem, 0, 0);
@@ -80,7 +80,7 @@ void Buffer::write(Sender *const sender) {
length2 = commitPos;
}
- logg->logMessage("Sending data length1: %i length2: %i", length1, length2);
+ logg.logMessage("Sending data length1: %i length2: %i", length1, length2);
// start, middle or end
if (length1 > 0) {
@@ -144,7 +144,7 @@ int Buffer::contiguousSpaceAvailable() const {
}
bool Buffer::hasUncommittedMessages() const {
- const int typeLength = gSessionData->mLocalCapture ? 0 : 1;
+ const int typeLength = gSessionData.mLocalCapture ? 0 : 1;
int length = mWritePos - mCommitPos;
if (length < 0) {
length += mSize;
@@ -155,7 +155,7 @@ bool Buffer::hasUncommittedMessages() const {
void Buffer::commit(const uint64_t time, const bool force) {
// post-populate the length, which does not include the response type length nor the length itself, i.e. only the length of the payload
- const int typeLength = gSessionData->mLocalCapture ? 0 : 1;
+ const int typeLength = gSessionData.mLocalCapture ? 0 : 1;
int length = mWritePos - mCommitPos;
if (length < 0) {
length += mSize;
@@ -169,12 +169,12 @@ void Buffer::commit(const uint64_t time, const bool force) {
mBuf[(mCommitPos + typeLength + byte) & mask] = (length >> byte * 8) & 0xFF;
}
- logg->logMessage("Committing data mReadPos: %i mWritePos: %i mCommitPos: %i", mReadPos, mWritePos, mCommitPos);
+ logg.logMessage("Committing data mReadPos: %i mWritePos: %i mCommitPos: %i", mReadPos, mWritePos, mCommitPos);
mCommitPos = mWritePos;
- if (gSessionData->mLiveRate > 0) {
+ if (gSessionData.mLiveRate > 0) {
while (time > mCommitTime) {
- mCommitTime += gSessionData->mLiveRate;
+ mCommitTime += gSessionData.mLiveRate;
}
}
@@ -191,7 +191,7 @@ void Buffer::check(const uint64_t time) {
if (filled < 0) {
filled += mSize;
}
- if (filled >= ((mSize * 3) / 4) || (gSessionData->mLiveRate > 0 && time >= mCommitTime)) {
+ if (filled >= ((mSize * 3) / 4) || (gSessionData.mLiveRate > 0 && time >= mCommitTime)) {
commit(time);
}
}
@@ -262,7 +262,7 @@ void Buffer::writeString(const char *const str) {
}
void Buffer::frame() {
- if (!gSessionData->mLocalCapture) {
+ if (!gSessionData.mLocalCapture) {
packInt(RESPONSE_APC_DATA);
}
// Reserve space for the length
@@ -273,7 +273,7 @@ void Buffer::frame() {
}
}
-void Buffer::summary(const uint64_t currTime, const int64_t timestamp, const int64_t uptime, const int64_t monotonicDelta, const char *const uname, const long pageSize) {
+void Buffer::summary(const uint64_t currTime, const int64_t timestamp, const int64_t uptime, const int64_t monotonicDelta, const char *const uname, const long pageSize, const bool nosync) {
packInt(MESSAGE_SUMMARY);
writeString(NEWLINE_CANARY);
packInt64(timestamp);
@@ -285,6 +285,10 @@ void Buffer::summary(const uint64_t currTime, const int64_t timestamp, const int
char buf[32];
snprintf(buf, sizeof(buf), "%li", pageSize);
writeString(buf);
+ if (nosync) {
+ writeString("nosync");
+ writeString("");
+ }
writeString("");
check(currTime);
}
diff --git a/tools/gator/daemon/Buffer.h b/tools/gator/daemon/Buffer.h
index ea250a910e45..d4020d08b3a1 100644
--- a/tools/gator/daemon/Buffer.h
+++ b/tools/gator/daemon/Buffer.h
@@ -41,7 +41,7 @@ public:
void check(const uint64_t time);
// Summary messages
- void summary(const uint64_t currTime, const int64_t timestamp, const int64_t uptime, const int64_t monotonicDelta, const char *const uname, const long pageSize);
+ void summary(const uint64_t currTime, const int64_t timestamp, const int64_t uptime, const int64_t monotonicDelta, const char *const uname, const long pageSize, const bool nosync);
void coreName(const uint64_t currTime, const int core, const int cpuid, const char *const name);
// Block Counter messages
@@ -77,13 +77,24 @@ public:
void writeBytes(const void *const data, size_t count);
void writeString(const char *const str);
- static void writeLEInt(unsigned char *buf, int v) {
+ static void writeLEInt(unsigned char *buf, uint32_t v) {
buf[0] = (v >> 0) & 0xFF;
buf[1] = (v >> 8) & 0xFF;
buf[2] = (v >> 16) & 0xFF;
buf[3] = (v >> 24) & 0xFF;
}
+ static void writeLELong(unsigned char *buf, uint64_t v) {
+ buf[0] = (v >> 0) & 0xFF;
+ buf[1] = (v >> 8) & 0xFF;
+ buf[2] = (v >> 16) & 0xFF;
+ buf[3] = (v >> 24) & 0xFF;
+ buf[4] = (v >> 32) & 0xFF;
+ buf[5] = (v >> 40) & 0xFF;
+ buf[6] = (v >> 48) & 0xFF;
+ buf[7] = (v >> 56) & 0xFF;
+ }
+
private:
void frame();
bool commitReady() const;
diff --git a/tools/gator/daemon/CCNDriver.cpp b/tools/gator/daemon/CCNDriver.cpp
index 24eda03b8091..b881e8112ec2 100644
--- a/tools/gator/daemon/CCNDriver.cpp
+++ b/tools/gator/daemon/CCNDriver.cpp
@@ -112,7 +112,7 @@ void CCNDriver::readEvents(mxml_node_t *const) {
int type;
if (DriverSource::readIntDriver("/sys/bus/event_source/devices/ccn/type", &type) != 0) {
- logg->logError("Unable to read CCN-5xx type");
+ logg.logError("Unable to read CCN-5xx type");
handleException();
}
@@ -300,8 +300,8 @@ void CCNDriver::validateCounters() const {
int counts[CCN_COUNT][2] = { { 0 } };
const unsigned int mask = getConfig(0xff, 0xff, 0, 0, 0);
- for (int i = 0; i < ARRAY_LENGTH(gSessionData->mCounters); ++i) {
- const Counter *const counter = &gSessionData->mCounters[i];
+ for (int i = 0; i < ARRAY_LENGTH(gSessionData.mCounters); ++i) {
+ const Counter *const counter = &gSessionData.mCounters[i];
if (!counter->isEnabled()) {
continue;
@@ -317,8 +317,8 @@ void CCNDriver::validateCounters() const {
if (counts[j][0] == node) {
++counts[j][1];
if (counts[j][1] > 4) {
- if (asprintf(&gSessionData->mCountersError, "More than 4 events are assigned to the same CCN node") <= 0) {
- logg->logError("asprintf failed");
+ if (asprintf(&gSessionData.mCountersError, "More than 4 events are assigned to the same CCN node") <= 0) {
+ logg.logError("asprintf failed");
handleException();
}
}
diff --git a/tools/gator/daemon/CapturedXML.cpp b/tools/gator/daemon/CapturedXML.cpp
index e87c909afd56..7a91a79fb768 100644
--- a/tools/gator/daemon/CapturedXML.cpp
+++ b/tools/gator/daemon/CapturedXML.cpp
@@ -32,7 +32,7 @@ mxml_node_t* CapturedXML::getTree(bool includeTime) {
captured = mxmlNewElement(xml, "captured");
mxmlElementSetAttr(captured, "version", "1");
- if (gSessionData->mPerf.isSetup()) {
+ if (gSessionData.mPerf.isSetup()) {
mxmlElementSetAttr(captured, "type", "Perf");
}
mxmlElementSetAttrf(captured, "protocol", "%d", PROTOCOL_VERSION);
@@ -43,22 +43,22 @@ mxml_node_t* CapturedXML::getTree(bool includeTime) {
}
target = mxmlNewElement(captured, "target");
- mxmlElementSetAttr(target, "name", gSessionData->mCoreName);
- mxmlElementSetAttrf(target, "sample_rate", "%d", gSessionData->mSampleRate);
- mxmlElementSetAttrf(target, "cores", "%d", gSessionData->mCores);
- mxmlElementSetAttrf(target, "cpuid", "0x%x", gSessionData->mMaxCpuId);
+ mxmlElementSetAttr(target, "name", gSessionData.mCoreName);
+ mxmlElementSetAttrf(target, "sample_rate", "%d", gSessionData.mSampleRate);
+ mxmlElementSetAttrf(target, "cores", "%d", gSessionData.mCores);
+ mxmlElementSetAttrf(target, "cpuid", "0x%x", gSessionData.mMaxCpuId);
- if (!gSessionData->mOneShot && (gSessionData->mSampleRate > 0)) {
+ if (!gSessionData.mOneShot && (gSessionData.mSampleRate > 0)) {
mxmlElementSetAttr(target, "supports_live", "yes");
}
- if (gSessionData->mLocalCapture) {
+ if (gSessionData.mLocalCapture) {
mxmlElementSetAttr(target, "local_capture", "yes");
}
mxml_node_t *counters = NULL;
for (x = 0; x < MAX_PERFORMANCE_COUNTERS; x++) {
- const Counter & counter = gSessionData->mCounters[x];
+ const Counter & counter = gSessionData.mCounters[x];
if (counter.isEnabled()) {
if (counters == NULL) {
counters = mxmlNewElement(captured, "counters");
@@ -96,8 +96,8 @@ void CapturedXML::write(char* path) {
snprintf(file, PATH_MAX, "%s/captured.xml", path);
char* xml = getXML(true);
- if (util->writeToDisk(file, xml) < 0) {
- logg->logError("Error writing %s\nPlease verify the path.", file);
+ if (writeToDisk(file, xml) < 0) {
+ logg.logError("Error writing %s\nPlease verify the path.", file);
handleException();
}
diff --git a/tools/gator/daemon/Child.cpp b/tools/gator/daemon/Child.cpp
index 551ec6bd25f6..df9fe232cb07 100644
--- a/tools/gator/daemon/Child.cpp
+++ b/tools/gator/daemon/Child.cpp
@@ -41,19 +41,18 @@ extern void cleanUp();
void handleException() {
if (child && child->numExceptions++ > 0) {
// it is possible one of the below functions itself can cause an exception, thus allow only one exception
- logg->logMessage("Received multiple exceptions, terminating the child");
+ logg.logMessage("Received multiple exceptions, terminating the child");
// Something is really wrong, exit immediately
_exit(1);
}
- fprintf(stderr, "%s", logg->getLastError());
if (child && child->socket) {
if (sender) {
// send the error, regardless of the command sent by Streamline
- sender->writeData(logg->getLastError(), strlen(logg->getLastError()), RESPONSE_ERROR);
+ sender->writeData(logg.getLastError(), strlen(logg.getLastError()), RESPONSE_ERROR, true);
// cannot close the socket before Streamline issues the command, so wait for the command before exiting
- if (gSessionData->mWaitingOnCommand) {
+ if (gSessionData.mWaitingOnCommand) {
char discard;
child->socket->receiveNBytes(&discard, 1);
}
@@ -66,7 +65,7 @@ void handleException() {
}
}
- if (gSessionData->mLocalCapture) {
+ if (gSessionData.mLocalCapture) {
cleanUp();
}
@@ -77,11 +76,11 @@ void handleException() {
static void child_handler(int signum) {
static bool beenHere = false;
if (beenHere == true) {
- logg->logMessage("Gator is being forced to shut down.");
+ logg.logMessage("Gator is being forced to shut down.");
exit(1);
}
beenHere = true;
- logg->logMessage("Gator is shutting down.");
+ logg.logMessage("Gator is shutting down.");
if (signum == SIGALRM || !primarySource) {
exit(1);
} else {
@@ -93,16 +92,16 @@ static void child_handler(int signum) {
static void *durationThread(void *) {
prctl(PR_SET_NAME, (unsigned long)&"gatord-duration", 0, 0, 0);
sem_wait(&startProfile);
- if (gSessionData->mSessionIsActive) {
+ if (gSessionData.mSessionIsActive) {
// Time out after duration seconds
// Add a second for host-side filtering
- sleep(gSessionData->mDuration + 1);
- if (gSessionData->mSessionIsActive) {
- logg->logMessage("Duration expired.");
+ sleep(gSessionData.mDuration + 1);
+ if (gSessionData.mSessionIsActive) {
+ logg.logMessage("Duration expired.");
child->endSession();
}
}
- logg->logMessage("Exit duration thread");
+ logg.logMessage("Exit duration thread");
return 0;
}
@@ -110,7 +109,7 @@ static void *stopThread(void *) {
OlySocket* socket = child->socket;
prctl(PR_SET_NAME, (unsigned long)&"gatord-stopper", 0, 0, 0);
- while (gSessionData->mSessionIsActive) {
+ while (gSessionData.mSessionIsActive) {
// This thread will stall until the APC_STOP or PING command is received over the socket or the socket is disconnected
unsigned char header[5];
const int result = socket->receiveNBytes((char*)&header, sizeof(header));
@@ -120,26 +119,26 @@ static void *stopThread(void *) {
child->endSession();
} else if (result > 0) {
if ((type != COMMAND_APC_STOP) && (type != COMMAND_PING)) {
- logg->logMessage("INVESTIGATE: Received unknown command type %d", type);
+ logg.logMessage("INVESTIGATE: Received unknown command type %d", type);
} else {
// verify a length of zero
if (length == 0) {
if (type == COMMAND_APC_STOP) {
- logg->logMessage("Stop command received.");
+ logg.logMessage("Stop command received.");
child->endSession();
} else {
// Ping is used to make sure gator is alive and requires an ACK as the response
- logg->logMessage("Ping command received.");
+ logg.logMessage("Ping command received.");
sender->writeData(NULL, 0, RESPONSE_ACK);
}
} else {
- logg->logMessage("INVESTIGATE: Received stop command but with length = %d", length);
+ logg.logMessage("INVESTIGATE: Received stop command but with length = %d", length);
}
}
}
}
- logg->logMessage("Exit stop thread");
+ logg.logMessage("Exit stop thread");
return 0;
}
@@ -163,17 +162,17 @@ static void *senderThread(void *) {
}
// write end-of-capture sequence
- if (!gSessionData->mLocalCapture) {
+ if (!gSessionData.mLocalCapture) {
sender->writeData(end_sequence, sizeof(end_sequence), RESPONSE_APC_DATA);
}
- logg->logMessage("Exit sender thread");
+ logg.logMessage("Exit sender thread");
return 0;
}
Child::Child() {
initialization();
- gSessionData->mLocalCapture = true;
+ gSessionData.mLocalCapture = true;
}
Child::Child(OlySocket* sock, int conn) {
@@ -187,7 +186,7 @@ Child::~Child() {
void Child::initialization() {
// Set up different handlers for signals
- gSessionData->mSessionIsActive = true;
+ gSessionData.mSessionIsActive = true;
signal(SIGINT, child_handler);
signal(SIGTERM, child_handler);
signal(SIGABRT, child_handler);
@@ -203,7 +202,7 @@ void Child::initialization() {
}
void Child::endSession() {
- gSessionData->mSessionIsActive = false;
+ gSessionData.mSessionIsActive = false;
primarySource->interrupt();
externalSource->interrupt();
if (userSpaceSource != NULL) {
@@ -225,15 +224,15 @@ void Child::run() {
sender = new Sender(socket);
if (mNumConnections > 1) {
- logg->logError("Session already in progress");
+ logg.logError("Session already in progress");
handleException();
}
// Populate gSessionData with the configuration
{ ConfigurationXML configuration; }
- // Set up the driver; must be done after gSessionData->mPerfCounterType[] is populated
- if (!gSessionData->mPerf.isSetup()) {
+ // Set up the driver; must be done after gSessionData.mPerfCounterType[] is populated
+ if (!gSessionData.mPerf.isSetup()) {
primarySource = new DriverSource(&senderSem, &startProfile);
} else {
primarySource = new PerfSource(&senderSem, &startProfile);
@@ -246,7 +245,7 @@ void Child::run() {
// Set up counters using the associated driver's setup function
for (int i = 0; i < MAX_PERFORMANCE_COUNTERS; i++) {
- Counter & counter = gSessionData->mCounters[i];
+ Counter & counter = gSessionData.mCounters[i];
if (counter.isEnabled()) {
counter.getDriver()->setupCounter(counter);
}
@@ -258,22 +257,22 @@ void Child::run() {
StreamlineSetup ss(socket);
} else {
char* xmlString;
- xmlString = util->readFromDisk(gSessionData->mSessionXMLPath);
+ xmlString = readFromDisk(gSessionData.mSessionXMLPath);
if (xmlString == 0) {
- logg->logError("Unable to read session xml file: %s", gSessionData->mSessionXMLPath);
+ logg.logError("Unable to read session xml file: %s", gSessionData.mSessionXMLPath);
handleException();
}
- gSessionData->parseSessionXML(xmlString);
+ gSessionData.parseSessionXML(xmlString);
localCapture = new LocalCapture();
- localCapture->createAPCDirectory(gSessionData->mTargetPath);
- localCapture->copyImages(gSessionData->mImages);
+ localCapture->createAPCDirectory(gSessionData.mTargetPath);
+ localCapture->copyImages(gSessionData.mImages);
localCapture->write(xmlString);
- sender->createDataFile(gSessionData->mAPCDir);
+ sender->createDataFile(gSessionData.mAPCDir);
free(xmlString);
}
- if (gSessionData->mKmod.isMaliCapture() && (gSessionData->mSampleRate == 0)) {
- logg->logError("Mali counters are not supported with Sample Rate: None.");
+ if (gSessionData.mKmod.isMaliCapture() && (gSessionData.mSampleRate == 0)) {
+ logg.logError("Mali counters are not supported with Sample Rate: None.");
handleException();
}
@@ -282,27 +281,27 @@ void Child::run() {
// Must be initialized before senderThread is started as senderThread checks externalSource
externalSource = new ExternalSource(&senderSem);
if (!externalSource->prepare()) {
- logg->logError("Unable to prepare external source for capture");
+ logg.logError("Unable to prepare external source for capture");
handleException();
}
externalSource->start();
// Must be after session XML is parsed
if (!primarySource->prepare()) {
- if (gSessionData->mPerf.isSetup()) {
- logg->logError("Unable to communicate with the perf API, please ensure that CONFIG_TRACING and CONFIG_CONTEXT_SWITCH_TRACER are enabled. Please refer to README_Streamline.txt for more information.");
+ if (gSessionData.mPerf.isSetup()) {
+ logg.logError("Unable to communicate with the perf API, please ensure that CONFIG_TRACING and CONFIG_CONTEXT_SWITCH_TRACER are enabled. Please refer to streamline/gator/README.md for more information.");
} else {
- logg->logError("Unable to prepare gator driver for capture");
+ logg.logError("Unable to prepare gator driver for capture");
}
handleException();
}
// Sender thread shall be halted until it is signaled for one shot mode
- sem_init(&haltPipeline, 0, gSessionData->mOneShot ? 0 : 2);
+ sem_init(&haltPipeline, 0, gSessionData.mOneShot ? 0 : 2);
// Create the duration, stop, and sender threads
bool thread_creation_success = true;
- if (gSessionData->mDuration > 0 && pthread_create(&durationThreadID, NULL, durationThread, NULL)) {
+ if (gSessionData.mDuration > 0 && pthread_create(&durationThreadID, NULL, durationThread, NULL)) {
thread_creation_success = false;
} else if (socket && pthread_create(&stopThreadID, NULL, stopThread, NULL)) {
thread_creation_success = false;
@@ -311,21 +310,21 @@ void Child::run() {
}
bool startUSSource = false;
- for (int i = 0; i < ARRAY_LENGTH(gSessionData->mUsDrivers); ++i) {
- if (gSessionData->mUsDrivers[i]->countersEnabled()) {
+ for (int i = 0; i < ARRAY_LENGTH(gSessionData.mUsDrivers); ++i) {
+ if (gSessionData.mUsDrivers[i]->countersEnabled()) {
startUSSource = true;
}
}
if (startUSSource) {
userSpaceSource = new UserSpaceSource(&senderSem);
if (!userSpaceSource->prepare()) {
- logg->logError("Unable to prepare userspace source for capture");
+ logg.logError("Unable to prepare userspace source for capture");
handleException();
}
userSpaceSource->start();
}
- if (gSessionData->mAllowCommands && (gSessionData->mCaptureCommand != NULL)) {
+ if (gSessionData.mAllowCommands && (gSessionData.mCaptureCommand != NULL)) {
pthread_t thread;
if (pthread_create(&thread, NULL, commandThread, NULL)) {
thread_creation_success = false;
@@ -333,7 +332,7 @@ void Child::run() {
}
if (!thread_creation_success) {
- logg->logError("Failed to create gator threads");
+ logg.logError("Failed to create gator threads");
handleException();
}
@@ -352,18 +351,18 @@ void Child::run() {
// Shutting down the connection should break the stop thread which is stalling on the socket recv() function
if (socket) {
- logg->logMessage("Waiting on stop thread");
+ logg.logMessage("Waiting on stop thread");
socket->shutdownConnection();
pthread_join(stopThreadID, NULL);
}
// Write the captured xml file
- if (gSessionData->mLocalCapture) {
+ if (gSessionData.mLocalCapture) {
CapturedXML capturedXML;
- capturedXML.write(gSessionData->mAPCDir);
+ capturedXML.write(gSessionData.mAPCDir);
}
- logg->logMessage("Profiling ended.");
+ logg.logMessage("Profiling ended.");
delete userSpaceSource;
delete externalSource;
diff --git a/tools/gator/daemon/Command.cpp b/tools/gator/daemon/Command.cpp
index 22f8be703598..e9f230472a54 100644
--- a/tools/gator/daemon/Command.cpp
+++ b/tools/gator/daemon/Command.cpp
@@ -40,7 +40,7 @@ static int getUid(const char *const name, const char *const tmpDir, uid_t *const
const int pid = fork();
if (pid < 0) {
- logg->logError("fork failed");
+ logg.logError("fork failed");
handleException();
}
if (pid == 0) {
@@ -51,9 +51,10 @@ static int getUid(const char *const name, const char *const tmpDir, uid_t *const
struct stat st;
int result = -1;
- if (stat(gatorTemp, &st) == 0) {
- result = st.st_uid;
+ if (stat(gatorTemp, &st) != 0) {
+ return false;
}
+ result = st.st_uid;
unlink(gatorTemp);
*uid = result;
return true;
@@ -87,26 +88,26 @@ static bool getUid(const char *const name, uid_t *const uid, gid_t *const gid) {
void *commandThread(void *) {
prctl(PR_SET_NAME, (unsigned long)&"gatord-command", 0, 0, 0);
- const char *const name = gSessionData->mCaptureUser == NULL ? "nobody" : gSessionData->mCaptureUser;
+ const char *const name = gSessionData.mCaptureUser == NULL ? "nobody" : gSessionData.mCaptureUser;
uid_t uid;
gid_t gid;
if (!getUid(name, &uid, &gid)) {
- logg->logError("Unable to look up the user %s, please double check that the user exists", name);
+ logg.logError("Unable to look up the user %s, please double check that the user exists", name);
handleException();
}
sleep(3);
- char buf[128];
+ char buf[1<<8];
int pipefd[2];
if (pipe_cloexec(pipefd) != 0) {
- logg->logError("pipe failed");
+ logg.logError("pipe failed");
handleException();
}
const int pid = fork();
if (pid < 0) {
- logg->logError("fork failed");
+ logg.logError("fork failed");
handleException();
}
if (pid == 0) {
@@ -133,14 +134,14 @@ void *commandThread(void *) {
}
{
- const char *const path = gSessionData->mCaptureWorkingDir == NULL ? "/" : gSessionData->mCaptureWorkingDir;
+ const char *const path = gSessionData.mCaptureWorkingDir == NULL ? "/" : gSessionData.mCaptureWorkingDir;
if (chdir(path) != 0) {
- snprintf(buf, sizeof(buf), "Unable to cd to %s, please verify the directory exists and is accessable to %s", path, name);
+ snprintf(buf, sizeof(buf), "Unable to cd to %s, please verify the directory exists and is accessible to %s", path, name);
goto fail_exit;
}
}
- execlp("sh", "sh", "-c", gSessionData->mCaptureCommand, NULL);
+ execlp("sh", "sh", "-c", gSessionData.mCaptureCommand, NULL);
snprintf(buf, sizeof(buf), "execv failed");
fail_exit:
@@ -156,7 +157,7 @@ void *commandThread(void *) {
close(pipefd[1]);
const ssize_t bytes = read(pipefd[0], buf, sizeof(buf));
if (bytes > 0) {
- logg->logError("%s", buf);
+ logg.logError("%s", buf);
handleException();
}
close(pipefd[0]);
diff --git a/tools/gator/daemon/ConfigurationXML.cpp b/tools/gator/daemon/ConfigurationXML.cpp
index b433811fc482..8639374c8fb1 100644
--- a/tools/gator/daemon/ConfigurationXML.cpp
+++ b/tools/gator/daemon/ConfigurationXML.cpp
@@ -17,11 +17,11 @@
#include "OlyUtility.h"
#include "SessionData.h"
-static const char* ATTR_COUNTER = "counter";
-static const char* ATTR_REVISION = "revision";
-static const char* ATTR_EVENT = "event";
-static const char* ATTR_COUNT = "count";
-static const char* ATTR_CORES = "cores";
+static const char ATTR_COUNTER[] = "counter";
+static const char ATTR_REVISION[] = "revision";
+static const char ATTR_EVENT[] = "event";
+static const char ATTR_COUNT[] = "count";
+static const char ATTR_CORES[] = "cores";
ConfigurationXML::ConfigurationXML() {
const char * configuration_xml;
@@ -31,11 +31,11 @@ ConfigurationXML::ConfigurationXML() {
char path[PATH_MAX];
getPath(path);
- mConfigurationXML = util->readFromDisk(path);
+ mConfigurationXML = readFromDisk(path);
for (int retryCount = 0; retryCount < 2; ++retryCount) {
if (mConfigurationXML == NULL) {
- logg->logMessage("Unable to locate configuration.xml, using default in binary");
+ logg.logMessage("Unable to locate configuration.xml, using default in binary");
// null-terminate configuration_xml
mConfigurationXML = (char*)malloc(configuration_xml_len + 1);
memcpy(mConfigurationXML, (const void*)configuration_xml, configuration_xml_len);
@@ -68,16 +68,16 @@ int ConfigurationXML::parse(const char* configurationXML) {
mxml_node_t *tree, *node;
int ret;
- if (gSessionData->mCountersError != NULL) {
- free(gSessionData->mCountersError);
- gSessionData->mCountersError = NULL;
+ if (gSessionData.mCountersError != NULL) {
+ free(gSessionData.mCountersError);
+ gSessionData.mCountersError = NULL;
}
- gSessionData->mIsEBS = false;
+ gSessionData.mIsEBS = false;
mIndex = 0;
// disable all counters prior to parsing the configuration xml
for (int i = 0; i < MAX_PERFORMANCE_COUNTERS; i++) {
- gSessionData->mCounters[i].setEnabled(false);
+ gSessionData.mCounters[i].setEnabled(false);
}
tree = mxmlLoadString(NULL, configurationXML, MXML_NO_CALLBACK);
@@ -100,33 +100,33 @@ int ConfigurationXML::parse(const char* configurationXML) {
mxmlDelete(tree);
- if (gSessionData->mCountersError == NULL && mIndex > MAX_PERFORMANCE_COUNTERS) {
- if (asprintf(&gSessionData->mCountersError, "Only %i performance counters are permitted, %i are selected", MAX_PERFORMANCE_COUNTERS, mIndex) <= 0) {
- logg->logError("asprintf failed");
+ if (gSessionData.mCountersError == NULL && mIndex > MAX_PERFORMANCE_COUNTERS) {
+ if (asprintf(&gSessionData.mCountersError, "Only %i performance counters are permitted, %i are selected", MAX_PERFORMANCE_COUNTERS, mIndex) <= 0) {
+ logg.logError("asprintf failed");
handleException();
}
}
- gSessionData->mCcnDriver.validateCounters();
+ gSessionData.mCcnDriver.validateCounters();
return ret;
}
void ConfigurationXML::validate(void) {
for (int i = 0; i < MAX_PERFORMANCE_COUNTERS; i++) {
- const Counter & counter = gSessionData->mCounters[i];
+ const Counter & counter = gSessionData.mCounters[i];
if (counter.isEnabled()) {
if (strcmp(counter.getType(), "") == 0) {
- logg->logError("Invalid required attribute in configuration.xml:\n counter=\"%s\"\n event=%d\n", counter.getType(), counter.getEvent());
+ logg.logError("Invalid required attribute in configuration.xml:\n counter=\"%s\"\n event=%d", counter.getType(), counter.getEvent());
handleException();
}
// iterate through the remaining enabled performance counters
for (int j = i + 1; j < MAX_PERFORMANCE_COUNTERS; j++) {
- const Counter & counter2 = gSessionData->mCounters[j];
+ const Counter & counter2 = gSessionData.mCounters[j];
if (counter2.isEnabled()) {
// check if the types are the same
if (strcmp(counter.getType(), counter2.getType()) == 0) {
- logg->logError("Duplicate performance counter type in configuration.xml: %s", counter.getType());
+ logg.logError("Duplicate performance counter type in configuration.xml: %s", counter.getType());
handleException();
}
}
@@ -163,14 +163,14 @@ void ConfigurationXML::configurationTag(mxml_node_t *node) {
}
// read attributes
- Counter & counter = gSessionData->mCounters[mIndex];
+ Counter & counter = gSessionData.mCounters[mIndex];
counter.clear();
if (mxmlElementGetAttr(node, ATTR_COUNTER)) counter.setType(mxmlElementGetAttr(node, ATTR_COUNTER));
if (mxmlElementGetAttr(node, ATTR_EVENT)) counter.setEvent(strtol(mxmlElementGetAttr(node, ATTR_EVENT), NULL, 16));
if (mxmlElementGetAttr(node, ATTR_COUNT)) counter.setCount(strtol(mxmlElementGetAttr(node, ATTR_COUNT), NULL, 10));
if (mxmlElementGetAttr(node, ATTR_CORES)) counter.setCores(strtol(mxmlElementGetAttr(node, ATTR_CORES), NULL, 10));
if (counter.getCount() > 0) {
- gSessionData->mIsEBS = true;
+ gSessionData.mIsEBS = true;
}
counter.setEnabled(true);
@@ -178,7 +178,7 @@ void ConfigurationXML::configurationTag(mxml_node_t *node) {
for (Driver *driver = Driver::getHead(); driver != NULL; driver = driver->getNext()) {
if (driver->claimCounter(counter)) {
if (counter.getDriver() != NULL) {
- logg->logError("More than one driver has claimed %s:%i", counter.getType(), counter.getEvent());
+ logg.logError("More than one driver has claimed %s:%i", counter.getType(), counter.getEvent());
handleException();
}
counter.setDriver(driver);
@@ -187,7 +187,7 @@ void ConfigurationXML::configurationTag(mxml_node_t *node) {
// If no driver is associated with the counter, disable it
if (counter.getDriver() == NULL) {
- logg->logMessage("No driver has claimed %s:%i", counter.getType(), counter.getEvent());
+ logg.logMessage("No driver has claimed %s:%i", counter.getType(), counter.getEvent());
counter.setEnabled(false);
}
@@ -204,11 +204,11 @@ void ConfigurationXML::getDefaultConfigurationXml(const char * & xml, unsigned i
}
void ConfigurationXML::getPath(char* path) {
- if (gSessionData->mConfigurationXMLPath) {
- strncpy(path, gSessionData->mConfigurationXMLPath, PATH_MAX);
+ if (gSessionData.mConfigurationXMLPath) {
+ strncpy(path, gSessionData.mConfigurationXMLPath, PATH_MAX);
} else {
- if (util->getApplicationFullPath(path, PATH_MAX) != 0) {
- logg->logMessage("Unable to determine the full path of gatord, the cwd will be used");
+ if (getApplicationFullPath(path, PATH_MAX) != 0) {
+ logg.logMessage("Unable to determine the full path of gatord, the cwd will be used");
}
strncat(path, "configuration.xml", PATH_MAX - strlen(path) - 1);
}
@@ -219,8 +219,8 @@ void ConfigurationXML::remove() {
getPath(path);
if (::remove(path) != 0) {
- logg->logError("Invalid configuration.xml file detected and unable to delete it. To resolve, delete configuration.xml on disk");
+ logg.logError("Invalid configuration.xml file detected and unable to delete it. To resolve, delete configuration.xml on disk");
handleException();
}
- logg->logMessage("Invalid configuration.xml file detected and removed");
+ logg.logMessage("Invalid configuration.xml file detected and removed");
}
diff --git a/tools/gator/daemon/DiskIODriver.cpp b/tools/gator/daemon/DiskIODriver.cpp
index bd18bbd08de9..6e72bfc16f57 100644
--- a/tools/gator/daemon/DiskIODriver.cpp
+++ b/tools/gator/daemon/DiskIODriver.cpp
@@ -53,7 +53,7 @@ DiskIODriver::~DiskIODriver() {
void DiskIODriver::readEvents(mxml_node_t *const) {
// Only for use with perf
- if (!gSessionData->mPerf.isSetup()) {
+ if (!gSessionData.mPerf.isSetup()) {
return;
}
@@ -67,7 +67,7 @@ void DiskIODriver::doRead() {
}
if (!mBuf.read("/proc/diskstats")) {
- logg->logError("Unable to read /proc/diskstats");
+ logg.logError("Unable to read /proc/diskstats");
handleException();
}
@@ -89,7 +89,7 @@ void DiskIODriver::doRead() {
int64_t writeBytes = -1;
const int count = sscanf(line, "%*d %*d %n%*s%n %*u %*u %" SCNu64 " %*u %*u %*u %" SCNu64, &nameStart, &nameEnd, &readBytes, &writeBytes);
if (count != 2) {
- logg->logError("Unable to parse /proc/diskstats");
+ logg.logError("Unable to parse /proc/diskstats");
handleException();
}
diff --git a/tools/gator/daemon/DriverSource.cpp b/tools/gator/daemon/DriverSource.cpp
index caa956ff75b5..7473d2858297 100644
--- a/tools/gator/daemon/DriverSource.cpp
+++ b/tools/gator/daemon/DriverSource.cpp
@@ -33,17 +33,17 @@ DriverSource::DriverSource(sem_t *senderSem, sem_t *startProfile) : mBuffer(NULL
int enable = -1;
if (readIntDriver("/dev/gator/enable", &enable) != 0 || enable != 0) {
- logg->logError("Driver already enabled, possibly a session is already in progress.");
+ logg.logError("Driver already enabled, possibly a session is already in progress.");
handleException();
}
- readIntDriver("/dev/gator/cpu_cores", &gSessionData->mCores);
- if (gSessionData->mCores == 0) {
- gSessionData->mCores = 1;
+ readIntDriver("/dev/gator/cpu_cores", &gSessionData.mCores);
+ if (gSessionData.mCores == 0) {
+ gSessionData.mCores = 1;
}
if (readIntDriver("/dev/gator/buffer_size", &mBufferSize) || mBufferSize <= 0) {
- logg->logError("Unable to read the driver buffer size");
+ logg.logError("Unable to read the driver buffer size");
handleException();
}
}
@@ -64,7 +64,7 @@ void DriverSource::checkVersion() {
int driverVersion = 0;
if (readIntDriver("/dev/gator/version", &driverVersion) == -1) {
- logg->logError("Error reading gator driver version");
+ logg.logError("Error reading gator driver version");
handleException();
}
@@ -72,7 +72,7 @@ void DriverSource::checkVersion() {
if (driverVersion != PROTOCOL_VERSION) {
if ((driverVersion > PROTOCOL_DEV) || (PROTOCOL_VERSION > PROTOCOL_DEV)) {
// One of the mismatched versions is development version
- logg->logError(
+ logg.logError(
"DEVELOPMENT BUILD MISMATCH: gator driver version \"%d\" is not in sync with gator daemon version \"%d\".\n"
">> The following must be synchronized from engineering repository:\n"
">> * gator driver\n"
@@ -81,7 +81,7 @@ void DriverSource::checkVersion() {
handleException();
} else {
// Release version mismatch
- logg->logError(
+ logg.logError(
"gator driver version \"%d\" is different than gator daemon version \"%d\".\n"
">> Please upgrade the driver and daemon to the latest versions.", driverVersion, PROTOCOL_VERSION);
handleException();
@@ -91,8 +91,8 @@ void DriverSource::checkVersion() {
bool DriverSource::prepare() {
// Create user-space buffers, add 5 to the size to account for the 1-byte type and 4-byte length
- logg->logMessage("Created %d MB collector buffer with a %d-byte ragged end", gSessionData->mTotalBufferSize, mBufferSize);
- mFifo = new Fifo(mBufferSize + 5, gSessionData->mTotalBufferSize*1024*1024, mSenderSem);
+ logg.logMessage("Created %d MB collector buffer with a %d-byte ragged end", gSessionData.mTotalBufferSize, mBufferSize);
+ mFifo = new Fifo(mBufferSize + 5, gSessionData.mTotalBufferSize*1024*1024, mSenderSem);
return true;
}
@@ -104,10 +104,10 @@ void DriverSource::bootstrapThread() {
DynBuf b1;
DynBuf b2;
// MonotonicStarted may not be not assigned yet
- const uint64_t currTime = 0;//getTime() - gSessionData->mMonotonicStarted;
+ const uint64_t currTime = 0;//getTime() - gSessionData.mMonotonicStarted;
if (!readProcComms(currTime, mBuffer, &printb, &b1, &b2)) {
- logg->logError("readProcComms failed");
+ logg.logError("readProcComms failed");
handleException();
}
@@ -125,45 +125,45 @@ void DriverSource::run() {
char *collectBuffer = mFifo->start();
int bytesCollected = 0;
- logg->logMessage("********** Profiling started **********");
+ logg.logMessage("********** Profiling started **********");
// Set the maximum backtrace depth
- if (writeReadDriver("/dev/gator/backtrace_depth", &gSessionData->mBacktraceDepth)) {
- logg->logError("Unable to set the driver backtrace depth");
+ if (writeReadDriver("/dev/gator/backtrace_depth", &gSessionData.mBacktraceDepth)) {
+ logg.logError("Unable to set the driver backtrace depth");
handleException();
}
// open the buffer which calls userspace_buffer_open() in the driver
mBufferFD = open("/dev/gator/buffer", O_RDONLY | O_CLOEXEC);
if (mBufferFD < 0) {
- logg->logError("The gator driver did not set up properly. Please view the linux console or dmesg log for more information on the failure.");
+ logg.logError("The gator driver did not set up properly. Please view the linux console or dmesg log for more information on the failure.");
handleException();
}
// set the tick rate of the profiling timer
- if (writeReadDriver("/dev/gator/tick", &gSessionData->mSampleRate) != 0) {
- logg->logError("Unable to set the driver tick");
+ if (writeReadDriver("/dev/gator/tick", &gSessionData.mSampleRate) != 0) {
+ logg.logError("Unable to set the driver tick");
handleException();
}
// notify the kernel of the response type
- int response_type = gSessionData->mLocalCapture ? 0 : RESPONSE_APC_DATA;
+ int response_type = gSessionData.mLocalCapture ? 0 : RESPONSE_APC_DATA;
if (writeDriver("/dev/gator/response_type", response_type)) {
- logg->logError("Unable to write the response type");
+ logg.logError("Unable to write the response type");
handleException();
}
// Set the live rate
- if (writeReadDriver("/dev/gator/live_rate", &gSessionData->mLiveRate)) {
- logg->logError("Unable to set the driver live rate");
+ if (writeReadDriver("/dev/gator/live_rate", &gSessionData.mLiveRate)) {
+ logg.logError("Unable to set the driver live rate");
handleException();
}
- logg->logMessage("Start the driver");
+ logg.logMessage("Start the driver");
// This command makes the driver start profiling by calling gator_op_start() in the driver
if (writeDriver("/dev/gator/enable", "1") != 0) {
- logg->logError("The gator driver did not start properly. Please view the linux console or dmesg log for more information on the failure.");
+ logg.logError("The gator driver did not start properly. Please view the linux console or dmesg log for more information on the failure.");
handleException();
}
@@ -173,7 +173,7 @@ void DriverSource::run() {
pthread_t bootstrapThreadID;
if (pthread_create(&bootstrapThreadID, NULL, bootstrapThreadStatic, this) != 0) {
- logg->logError("Unable to start the gator_bootstrap thread");
+ logg.logError("Unable to start the gator_bootstrap thread");
handleException();
}
@@ -190,19 +190,19 @@ void DriverSource::run() {
}
// return the total bytes written
- logg->logMessage("Driver read of %d bytes", bytesCollected);
+ logg.logMessage("Driver read of %d bytes", bytesCollected);
// In one shot mode, stop collection once all the buffers are filled
- if (gSessionData->mOneShot && gSessionData->mSessionIsActive) {
+ if (gSessionData.mOneShot && gSessionData.mSessionIsActive) {
if (bytesCollected == -1 || mFifo->willFill(bytesCollected)) {
- logg->logMessage("One shot (gator.ko)");
+ logg.logMessage("One shot (gator.ko)");
child->endSession();
}
}
collectBuffer = mFifo->write(bytesCollected);
} while (bytesCollected > 0);
- logg->logMessage("Exit collect data loop");
+ logg.logMessage("Exit collect data loop");
pthread_join(bootstrapThreadID, NULL);
}
@@ -210,7 +210,7 @@ void DriverSource::run() {
void DriverSource::interrupt() {
// This command should cause the read() function in collect() to return and stop the driver from profiling
if (writeDriver("/dev/gator/enable", "0") != 0) {
- logg->logMessage("Stopping kernel failed");
+ logg.logMessage("Stopping kernel failed");
}
}
@@ -224,7 +224,7 @@ void DriverSource::write(Sender *sender) {
sender->writeData(data, mLength, RESPONSE_APC_DATA);
mFifo->release();
// Assume the summary packet is in the first block received from the driver
- gSessionData->mSentSummary = true;
+ gSessionData.mSentSummary = true;
}
if (mBuffer != NULL && !mBuffer->isDone()) {
mBuffer->write(sender);
@@ -254,7 +254,7 @@ int DriverSource::readIntDriver(const char *fullpath, int *value) {
errno = 0;
*value = strtol(data, &endptr, 10);
if (errno != 0 || *endptr != '\n') {
- logg->logMessage("Invalid value in file %s", fullpath);
+ logg.logMessage("Invalid value in file %s", fullpath);
return -1;
}
@@ -279,7 +279,7 @@ int DriverSource::readInt64Driver(const char *fullpath, int64_t *value) {
errno = 0;
*value = strtoll(data, &endptr, 10);
if (errno != 0 || (*endptr != '\n' && *endptr != '\0')) {
- logg->logMessage("Invalid value in file %s", fullpath);
+ logg.logMessage("Invalid value in file %s", fullpath);
return -1;
}
@@ -293,7 +293,7 @@ int DriverSource::writeDriver(const char *fullpath, const char *data) {
}
if (::write(fd, data, strlen(data)) < 0) {
close(fd);
- logg->logMessage("Opened but could not write to %s", fullpath);
+ logg.logMessage("Opened but could not write to %s", fullpath);
return -1;
}
close(fd);
diff --git a/tools/gator/daemon/DynBuf.cpp b/tools/gator/daemon/DynBuf.cpp
index 690cbcb94293..b997e7ce7e06 100644
--- a/tools/gator/daemon/DynBuf.cpp
+++ b/tools/gator/daemon/DynBuf.cpp
@@ -10,7 +10,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
@@ -42,7 +41,7 @@ bool DynBuf::read(const char *const path) {
const int fd = open(path, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
- logg->logMessage("open failed");
+ logg.logMessage("open failed");
return false;
}
@@ -52,14 +51,14 @@ bool DynBuf::read(const char *const path) {
const size_t minCapacity = length + MIN_BUFFER_FREE + 1;
if (capacity < minCapacity) {
if (resize(minCapacity) != 0) {
- logg->logMessage("DynBuf::resize failed");
+ logg.logMessage("DynBuf::resize failed");
goto fail;
}
}
const ssize_t bytes = ::read(fd, buf + length, capacity - length - 1);
if (bytes < 0) {
- logg->logMessage("read failed");
+ logg.logMessage("read failed");
goto fail;
} else if (bytes == 0) {
break;
@@ -102,35 +101,58 @@ int DynBuf::readlink(const char *const path) {
bool DynBuf::printf(const char *format, ...) {
va_list ap;
+ bool result;
+
+ length = 0;
+
+ va_start(ap, format);
+ result = append(format, ap);
+ va_end(ap);
+
+ return result;
+}
+
+bool DynBuf::append(const char *format, ...) {
+ va_list ap;
+ bool result;
+
+ va_start(ap, format);
+ result = append(format, ap);
+ va_end(ap);
+
+ return result;
+}
+
+bool DynBuf::append(const char *format, va_list ap) {
+ va_list dup;
if (capacity <= 0) {
if (resize(2 * MIN_BUFFER_FREE) != 0) {
- logg->logMessage("DynBuf::resize failed");
+ logg.logMessage("DynBuf::resize failed");
return false;
}
}
- va_start(ap, format);
- int bytes = vsnprintf(buf, capacity, format, ap);
- va_end(ap);
+ va_copy(dup, ap);
+ int bytes = vsnprintf(buf + length, capacity - length, format, dup);
if (bytes < 0) {
- logg->logMessage("fsnprintf failed");
+ logg.logMessage("fsnprintf failed");
return false;
}
+ bytes += length;
- if (static_cast<size_t>(bytes) > capacity) {
+ if (static_cast<size_t>(bytes) >= capacity) {
if (resize(bytes + 1) != 0) {
- logg->logMessage("DynBuf::resize failed");
+ logg.logMessage("DynBuf::resize failed");
return false;
}
- va_start(ap, format);
- bytes = vsnprintf(buf, capacity, format, ap);
- va_end(ap);
+ bytes = vsnprintf(buf + length, capacity - length, format, ap);
if (bytes < 0) {
- logg->logMessage("fsnprintf failed");
+ logg.logMessage("fsnprintf failed");
return false;
}
+ bytes += length;
}
length = bytes;
diff --git a/tools/gator/daemon/DynBuf.h b/tools/gator/daemon/DynBuf.h
index da83cd65ca3e..2a5e7b0ed53c 100644
--- a/tools/gator/daemon/DynBuf.h
+++ b/tools/gator/daemon/DynBuf.h
@@ -9,6 +9,7 @@
#ifndef DYNBUF_H
#define DYNBUF_H
+#include <stdarg.h>
#include <stdlib.h>
class DynBuf {
@@ -32,6 +33,9 @@ public:
int readlink(const char *const path);
__attribute__ ((format(printf, 2, 3)))
bool printf(const char *format, ...);
+ __attribute__ ((format(printf, 2, 3)))
+ bool append(const char *format, ...);
+ bool append(const char *format, va_list ap);
size_t getLength() const { return length; }
const char *getBuf() const { return buf; }
diff --git a/tools/gator/daemon/EventsXML.cpp b/tools/gator/daemon/EventsXML.cpp
index d8044d8b8abd..4f44e047ef95 100644
--- a/tools/gator/daemon/EventsXML.cpp
+++ b/tools/gator/daemon/EventsXML.cpp
@@ -48,32 +48,40 @@ mxml_node_t *EventsXML::getTree() {
(void)events_xml_len;
// Load the provided or default events xml
- if (gSessionData->mEventsXMLPath) {
- strncpy(path, gSessionData->mEventsXMLPath, PATH_MAX);
+ if (gSessionData.mEventsXMLPath) {
+ strncpy(path, gSessionData.mEventsXMLPath, PATH_MAX);
fl = fopen_cloexec(path, "r");
if (fl) {
xml = mxmlLoadFile(NULL, fl, MXML_NO_CALLBACK);
+ if (xml == NULL) {
+ logg.logError("Unable to parse %s", gSessionData.mEventsXMLPath);
+ handleException();
+ }
fclose(fl);
}
}
if (xml == NULL) {
- logg->logMessage("Unable to locate events.xml, using default");
+ logg.logMessage("Unable to locate events.xml, using default");
xml = mxmlLoadString(NULL, (const char *)events_xml, MXML_NO_CALLBACK);
}
// Append additional events XML
- if (gSessionData->mEventsXMLAppend) {
- fl = fopen_cloexec(gSessionData->mEventsXMLAppend, "r");
+ if (gSessionData.mEventsXMLAppend) {
+ fl = fopen_cloexec(gSessionData.mEventsXMLAppend, "r");
if (fl == NULL) {
- logg->logError("Unable to open additional events XML %s", gSessionData->mEventsXMLAppend);
+ logg.logError("Unable to open additional events XML %s", gSessionData.mEventsXMLAppend);
handleException();
}
mxml_node_t *append = mxmlLoadFile(NULL, fl, MXML_NO_CALLBACK);
+ if (append == NULL) {
+ logg.logError("Unable to parse %s", gSessionData.mEventsXMLAppend);
+ handleException();
+ }
fclose(fl);
mxml_node_t *events = mxmlFindElement(xml, xml, "events", NULL, NULL, MXML_DESCEND);
if (!events) {
- logg->logError("Unable to find <events> node in the events.xml, please ensure the first two lines of events XML starts with:\n"
+ logg.logError("Unable to find <events> node in the events.xml, please ensure the first two lines of events XML starts with:\n"
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<events>");
handleException();
@@ -81,6 +89,7 @@ mxml_node_t *EventsXML::getTree() {
XMLList *categoryList = NULL;
XMLList *eventList = NULL;
+ XMLList *counterSetList = NULL;
{
// Make list of all categories in xml
mxml_node_t *node = xml;
@@ -101,6 +110,16 @@ mxml_node_t *EventsXML::getTree() {
}
eventList = new XMLList(eventList, node);
}
+
+ // Make list of all counter_sets in xml
+ node = xml;
+ while (true) {
+ node = mxmlFindElement(node, xml, "counter_set", NULL, NULL, MXML_DESCEND);
+ if (node == NULL) {
+ break;
+ }
+ counterSetList = new XMLList(counterSetList, node);
+ }
}
// Handle events
@@ -112,7 +131,7 @@ mxml_node_t *EventsXML::getTree() {
const char *const title = mxmlElementGetAttr(node, "title");
const char *const name = mxmlElementGetAttr(node, "name");
if (category == NULL || title == NULL || name == NULL) {
- logg->logError("Not all event XML nodes have the required title and name and parent name attributes");
+ logg.logError("Not all event XML nodes have the required title and name and parent name attributes");
handleException();
}
@@ -122,12 +141,12 @@ mxml_node_t *EventsXML::getTree() {
const char *const title2 = mxmlElementGetAttr(event->getNode(), "title");
const char *const name2 = mxmlElementGetAttr(event->getNode(), "name");
if (category2 == NULL || title2 == NULL || name2 == NULL) {
- logg->logError("Not all event XML nodes have the required title and name and parent name attributes");
+ logg.logError("Not all event XML nodes have the required title and name and parent name attributes");
handleException();
}
if (strcmp(category, category2) == 0 && strcmp(title, title2) == 0 && strcmp(name, name2) == 0) {
- logg->logMessage("Replacing counter %s %s: %s", category, title, name);
+ logg.logMessage("Replacing counter %s %s: %s", category, title, name);
mxml_node_t *parent = mxmlGetParent(event->getNode());
mxmlDelete(event->getNode());
mxmlAdd(parent, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, node);
@@ -149,7 +168,7 @@ mxml_node_t *EventsXML::getTree() {
const char *const name = mxmlElementGetAttr(node, "name");
if (name == NULL) {
- logg->logError("Not all event XML categories have the required name attribute");
+ logg.logError("Not all event XML category nodes have the required name attribute");
handleException();
}
@@ -158,12 +177,12 @@ mxml_node_t *EventsXML::getTree() {
for (XMLList *category = categoryList; category != NULL; category = category->getPrev()) {
const char *const name2 = mxmlElementGetAttr(category->getNode(), "name");
if (name2 == NULL) {
- logg->logError("Not all event XML categories have the required name attribute");
+ logg.logError("Not all event XML category nodes have the required name attribute");
handleException();
}
if (strcmp(name, name2) == 0) {
- logg->logMessage("Merging category %s", name);
+ logg.logMessage("Merging category %s", name);
while (true) {
mxml_node_t *child = mxmlGetFirstChild(node);
if (child == NULL) {
@@ -181,12 +200,54 @@ mxml_node_t *EventsXML::getTree() {
}
// Add new categories
- logg->logMessage("Appending category %s", name);
+ logg.logMessage("Appending category %s", name);
+ mxmlAdd(events, MXML_ADD_AFTER, mxmlGetLastChild(events), node);
+ }
+
+ // Handle counter_sets
+ for (mxml_node_t *node = strcmp(mxmlGetElement(append), "counter_set") == 0 ? append : mxmlFindElement(append, append, "counter_set", NULL, NULL, MXML_DESCEND),
+ *next = mxmlFindElement(node, append, "counter_set", NULL, NULL, MXML_DESCEND);
+ node != NULL;
+ node = next, next = mxmlFindElement(node, append, "counter_set", NULL, NULL, MXML_DESCEND)) {
+
+ const char *const name = mxmlElementGetAttr(node, "name");
+ if (name == NULL) {
+ logg.logError("Not all event XML counter_sets have the required name attribute");
+ handleException();
+ }
+
+ // Replace any duplicate counter_sets
+ bool replaced = false;
+ for (XMLList *counterSet = counterSetList; counterSet != NULL; counterSet = counterSet->getPrev()) {
+ const char *const name2 = mxmlElementGetAttr(counterSet->getNode(), "name");
+ if (name2 == NULL) {
+ logg.logError("Not all event XML nodes have the required title and name and parent name attributes");
+ handleException();
+ }
+
+ if (strcmp(name, name2) == 0) {
+ logg.logMessage("Replacing counter %s", name);
+ mxml_node_t *parent = mxmlGetParent(counterSet->getNode());
+ mxmlDelete(counterSet->getNode());
+ mxmlAdd(parent, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, node);
+ counterSet->setNode(node);
+ replaced = true;
+ break;
+ }
+ }
+
+ if (replaced) {
+ continue;
+ }
+
+ // Add new counter_sets
+ logg.logMessage("Appending counter_set %s", name);
mxmlAdd(events, MXML_ADD_AFTER, mxmlGetLastChild(events), node);
}
XMLList::free(eventList);
XMLList::free(categoryList);
+ XMLList::free(counterSetList);
mxmlDelete(append);
}
@@ -200,7 +261,7 @@ char *EventsXML::getXML() {
// Add dynamic events from the drivers
mxml_node_t *events = mxmlFindElement(xml, xml, "events", NULL, NULL, MXML_DESCEND);
if (!events) {
- logg->logError("Unable to find <events> node in the events.xml, please ensure the first two lines of events XML are:\n"
+ logg.logError("Unable to find <events> node in the events.xml, please ensure the first two lines of events XML are:\n"
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<events>");
handleException();
@@ -222,8 +283,8 @@ void EventsXML::write(const char *path) {
snprintf(file, PATH_MAX, "%s/events.xml", path);
char *buf = getXML();
- if (util->writeToDisk(file, buf) < 0) {
- logg->logError("Error writing %s\nPlease verify the path.", file);
+ if (writeToDisk(file, buf) < 0) {
+ logg.logError("Error writing %s\nPlease verify the path.", file);
handleException();
}
diff --git a/tools/gator/daemon/ExternalDriver.cpp b/tools/gator/daemon/ExternalDriver.cpp
index c1b798352512..a7fbafff5718 100644
--- a/tools/gator/daemon/ExternalDriver.cpp
+++ b/tools/gator/daemon/ExternalDriver.cpp
@@ -89,7 +89,7 @@ bool ExternalDriver::connect() const {
if (mUds < 0) {
mUds = OlySocket::connect(MALI_UTGARD_SETUP, sizeof(MALI_UTGARD_SETUP));
if (mUds >= 0 && !writeAll(mUds, SETUP_VERSION, sizeof(SETUP_VERSION) - 1)) {
- logg->logError("Unable to send setup version");
+ logg.logError("Unable to send setup version");
handleException();
}
}
@@ -111,37 +111,37 @@ void ExternalDriver::query() const {
// Only try once even if it fails otherwise not all the possible counters may be shown
mQueried = true;
- char *const buf = gSessionData->mSharedData->mMaliUtgardCounters;
- const size_t bufSize = sizeof(gSessionData->mSharedData->mMaliUtgardCounters);
+ char *const buf = gSessionData.mSharedData->mMaliUtgardCounters;
+ const size_t bufSize = sizeof(gSessionData.mSharedData->mMaliUtgardCounters);
size_t size = 0;
if (!connect()) {
- size = gSessionData->mSharedData->mMaliUtgardCountersSize;
- logg->logMessage("Unable to connect, using cached version; size: %zi", size);
+ size = gSessionData.mSharedData->mMaliUtgardCountersSize;
+ logg.logMessage("Unable to connect, using cached version; size: %zi", size);
} else {
- gSessionData->mSharedData->mMaliUtgardCountersSize = 0;
+ gSessionData.mSharedData->mMaliUtgardCountersSize = 0;
buf[0] = HEADER_REQUEST_COUNTERS;
size_t pos = HEADER_SIZE;
Buffer::writeLEInt((unsigned char *)(buf + 1), pos);
if (!writeAll(mUds, buf, pos)) {
- logg->logError("Unable to send request counters message");
+ logg.logError("Unable to send request counters message");
handleException();
}
if (!readAll(mUds, buf, HEADER_SIZE) || buf[0] != (char)HEADER_COUNTERS) {
- logg->logError("Unable to read request counters response header");
+ logg.logError("Unable to read request counters response header");
handleException();
}
size = readLEInt(buf + 1);
if (size > bufSize || !readAll(mUds, buf, size - HEADER_SIZE)) {
- logg->logError("Unable to read request counters response");
+ logg.logError("Unable to read request counters response");
handleException();
}
size -= HEADER_SIZE;
- gSessionData->mSharedData->mMaliUtgardCountersSize = size;
- logg->logMessage("Requested counters; size: %zi", size);
+ gSessionData.mSharedData->mMaliUtgardCountersSize = size;
+ logg.logMessage("Requested counters; size: %zi", size);
}
size_t pos = 0;
@@ -166,7 +166,7 @@ void ExternalDriver::query() const {
}
if (pos != size) {
- logg->logError("Unable to parse request counters response");
+ logg.logError("Unable to parse request counters response");
handleException();
}
}
@@ -193,7 +193,7 @@ void ExternalDriver::start() {
}
size_t nameLen = strlen(counter->getName());
if (pos + nameLen + 1 + 2*Buffer::MAXSIZE_PACK32 > sizeof(buf)) {
- logg->logError("Unable to enable counters, message is too large");
+ logg.logError("Unable to enable counters, message is too large");
handleException();
}
memcpy(buf + pos, counter->getName(), nameLen + 1);
@@ -203,18 +203,18 @@ void ExternalDriver::start() {
}
Buffer::writeLEInt((unsigned char *)(buf + 1), pos);
if (!writeAll(mUds, buf, pos)) {
- logg->logError("Unable to send enable counters message");
+ logg.logError("Unable to send enable counters message");
handleException();
}
size_t size = 0;
if (!readAll(mUds, buf, HEADER_SIZE) || buf[0] != (char)HEADER_ACK) {
- logg->logError("Unable to read enable counters response header");
+ logg.logError("Unable to read enable counters response header");
handleException();
}
size = readLEInt(buf + 1);
if (size != HEADER_SIZE) {
- logg->logError("Unable to parse enable counters response");
+ logg.logError("Unable to parse enable counters response");
handleException();
}
@@ -222,22 +222,22 @@ void ExternalDriver::start() {
pos = HEADER_SIZE;
// ns/sec / samples/sec = ns/sample
// For sample rate of none, sample every 100ms
- Buffer::packInt(buf, sizeof(buf), pos, NS_PER_S / (gSessionData->mSampleRate == 0 ? 10 : gSessionData->mSampleRate));
- Buffer::packInt(buf, sizeof(buf), pos, gSessionData->mLiveRate);
+ Buffer::packInt(buf, sizeof(buf), pos, NS_PER_S / (gSessionData.mSampleRate == 0 ? 10 : gSessionData.mSampleRate));
+ Buffer::packInt(buf, sizeof(buf), pos, gSessionData.mLiveRate);
Buffer::writeLEInt((unsigned char *)(buf + 1), pos);
if (!writeAll(mUds, buf, pos)) {
- logg->logError("Unable to send start message");
+ logg.logError("Unable to send start message");
handleException();
}
size = 0;
if (!readAll(mUds, buf, HEADER_SIZE) || buf[0] != (char)HEADER_ACK) {
- logg->logError("Unable to read start response header");
+ logg.logError("Unable to read start response header");
handleException();
}
size = readLEInt(buf + 1);
if (size != HEADER_SIZE) {
- logg->logError("Unable to parse start response");
+ logg.logError("Unable to parse start response");
handleException();
}
}
diff --git a/tools/gator/daemon/ExternalSource.cpp b/tools/gator/daemon/ExternalSource.cpp
index e87fb9ef02ba..a390e08a69ca 100644
--- a/tools/gator/daemon/ExternalSource.cpp
+++ b/tools/gator/daemon/ExternalSource.cpp
@@ -24,13 +24,12 @@ static const char STREAMLINE_ANNOTATE[] = "\0streamline-annotate";
static const char MALI_VIDEO[] = "\0mali-video";
static const char MALI_VIDEO_STARTUP[] = "\0mali-video-startup";
static const char MALI_VIDEO_V1[] = "MALI_VIDEO 1\n";
-static const char MALI_GRAPHICS[] = "\0mali_thirdparty_server";
static const char MALI_GRAPHICS_STARTUP[] = "\0mali_thirdparty_client";
static const char MALI_GRAPHICS_V1[] = "MALI_GRAPHICS 1\n";
static const char MALI_UTGARD_STARTUP[] = "\0mali-utgard-startup";
static const char FTRACE_V1[] = "FTRACE 1\n";
-ExternalSource::ExternalSource(sem_t *senderSem) : mBuffer(0, FRAME_EXTERNAL, 128*1024, senderSem), mMonitor(), mMveStartupUds(MALI_VIDEO_STARTUP, sizeof(MALI_VIDEO_STARTUP)), mMaliStartupUds(MALI_GRAPHICS_STARTUP, sizeof(MALI_GRAPHICS_STARTUP)), mUtgardStartupUds(MALI_UTGARD_STARTUP, sizeof(MALI_UTGARD_STARTUP)), mAnnotate(8083), mAnnotateUds(STREAMLINE_ANNOTATE, sizeof(STREAMLINE_ANNOTATE), true), mInterruptFd(-1), mMaliUds(-1), mMveUds(-1), mFtraceFd(-1) {
+ExternalSource::ExternalSource(sem_t *senderSem) : mBuffer(0, FRAME_EXTERNAL, 128*1024, senderSem), mMonitor(), mMveStartupUds(MALI_VIDEO_STARTUP, sizeof(MALI_VIDEO_STARTUP)), mMidgardStartupUds(MALI_GRAPHICS_STARTUP, sizeof(MALI_GRAPHICS_STARTUP)), mUtgardStartupUds(MALI_UTGARD_STARTUP, sizeof(MALI_UTGARD_STARTUP)), mAnnotate(8083), mAnnotateUds(STREAMLINE_ANNOTATE, sizeof(STREAMLINE_ANNOTATE), true), mInterruptFd(-1), mMidgardUds(-1), mMveUds(-1), mFtraceFd(-1) {
sem_init(&mBufferSem, 0, 0);
}
@@ -39,8 +38,8 @@ ExternalSource::~ExternalSource() {
void ExternalSource::waitFor(const int bytes) {
while (mBuffer.bytesAvailable() <= bytes) {
- if (gSessionData->mOneShot && gSessionData->mSessionIsActive) {
- logg->logMessage("One shot (external)");
+ if (gSessionData.mOneShot && gSessionData.mSessionIsActive) {
+ logg.logMessage("One shot (external)");
child->endSession();
}
sem_wait(&mBufferSem);
@@ -49,12 +48,12 @@ void ExternalSource::waitFor(const int bytes) {
void ExternalSource::configureConnection(const int fd, const char *const handshake, size_t size) {
if (!setNonblock(fd)) {
- logg->logError("Unable to set nonblock on fh");
+ logg.logError("Unable to set nonblock on fh");
handleException();
}
if (!mMonitor.add(fd)) {
- logg->logError("Unable to add fh to monitor");
+ logg.logError("Unable to add fh to monitor");
handleException();
}
@@ -65,19 +64,23 @@ void ExternalSource::configureConnection(const int fd, const char *const handsha
mBuffer.commit(1, true);
}
-bool ExternalSource::connectMali() {
- mMaliUds = OlySocket::connect(MALI_GRAPHICS, sizeof(MALI_GRAPHICS));
- if (mMaliUds < 0) {
+bool ExternalSource::connectMidgard() {
+ mMidgardUds = OlySocket::connect(MALI_GRAPHICS, MALI_GRAPHICS_SIZE);
+ if (mMidgardUds < 0) {
return false;
}
- configureConnection(mMaliUds, MALI_GRAPHICS_V1, sizeof(MALI_GRAPHICS_V1));
+ if (!gSessionData.mMidgard.start(mMidgardUds)) {
+ return false;
+ }
+
+ configureConnection(mMidgardUds, MALI_GRAPHICS_V1, sizeof(MALI_GRAPHICS_V1));
return true;
}
bool ExternalSource::connectMve() {
- if (!gSessionData->mMaliVideo.countersEnabled()) {
+ if (!gSessionData.mMaliVideo.countersEnabled()) {
return true;
}
@@ -86,7 +89,7 @@ bool ExternalSource::connectMve() {
return false;
}
- if (!gSessionData->mMaliVideo.start(mMveUds)) {
+ if (!gSessionData.mMaliVideo.start(mMveUds)) {
return false;
}
@@ -96,15 +99,15 @@ bool ExternalSource::connectMve() {
}
void ExternalSource::connectFtrace() {
- if (!gSessionData->mFtraceDriver.isSupported()) {
+ if (!gSessionData.mFtraceDriver.isSupported()) {
return;
}
- gSessionData->mFtraceDriver.prepare();
+ gSessionData.mFtraceDriver.prepare();
mFtraceFd = open(TRACING_PATH "/trace_pipe", O_RDONLY | O_CLOEXEC);
if (mFtraceFd < 0) {
- logg->logError("Unable to open trace_pipe");
+ logg.logError("Unable to open trace_pipe");
handleException();
}
@@ -114,7 +117,7 @@ void ExternalSource::connectFtrace() {
bool ExternalSource::prepare() {
if (!mMonitor.init() ||
!setNonblock(mMveStartupUds.getFd()) || !mMonitor.add(mMveStartupUds.getFd()) ||
- !setNonblock(mMaliStartupUds.getFd()) || !mMonitor.add(mMaliStartupUds.getFd()) ||
+ !setNonblock(mMidgardStartupUds.getFd()) || !mMonitor.add(mMidgardStartupUds.getFd()) ||
!setNonblock(mUtgardStartupUds.getFd()) || !mMonitor.add(mUtgardStartupUds.getFd()) ||
!setNonblock(mAnnotate.getFd()) || !mMonitor.add(mAnnotate.getFd()) ||
!setNonblock(mAnnotateUds.getFd()) || !mMonitor.add(mAnnotateUds.getFd()) ||
@@ -122,10 +125,10 @@ bool ExternalSource::prepare() {
return false;
}
- connectMali();
+ connectMidgard();
connectMve();
connectFtrace();
- gSessionData->mExternalDriver.start();
+ gSessionData.mExternalDriver.start();
return true;
}
@@ -136,57 +139,57 @@ void ExternalSource::run() {
prctl(PR_SET_NAME, (unsigned long)&"gatord-external", 0, 0, 0);
if (pipe_cloexec(pipefd) != 0) {
- logg->logError("pipe failed");
+ logg.logError("pipe failed");
handleException();
}
mInterruptFd = pipefd[1];
if (!mMonitor.add(pipefd[0])) {
- logg->logError("Monitor::add failed");
+ logg.logError("Monitor::add failed");
handleException();
}
// Notify annotate clients to retry connecting to gatord
uint64_t val = 1;
- if (::write(gSessionData->mAnnotateStart, &val, sizeof(val)) != sizeof(val)) {
- logg->logMessage("Writing to annotate pipe failed");
+ if (::write(gSessionData.mAnnotateStart, &val, sizeof(val)) != sizeof(val)) {
+ logg.logMessage("Writing to annotate pipe failed");
}
if (mFtraceFd >= 0) {
- gSessionData->mAtraceDriver.start();
+ gSessionData.mAtraceDriver.start();
if (DriverSource::writeDriver(TRACING_PATH "/tracing_on", "1") != 0) {
- logg->logError("Unable to turn ftrace on");
+ logg.logError("Unable to turn ftrace on");
handleException();
}
}
// Wait until monotonicStarted is set before sending data
int64_t monotonicStarted = 0;
- while (monotonicStarted <= 0 && gSessionData->mSessionIsActive) {
+ while (monotonicStarted <= 0 && gSessionData.mSessionIsActive) {
usleep(10);
- if (gSessionData->mPerf.isSetup()) {
- monotonicStarted = gSessionData->mMonotonicStarted;
+ if (gSessionData.mPerf.isSetup()) {
+ monotonicStarted = gSessionData.mMonotonicStarted;
} else {
if (DriverSource::readInt64Driver("/dev/gator/started", &monotonicStarted) == -1) {
- logg->logError("Error reading gator driver start time");
+ logg.logError("Error reading gator driver start time");
handleException();
}
}
}
- while (gSessionData->mSessionIsActive) {
+ while (gSessionData.mSessionIsActive) {
struct epoll_event events[16];
// Clear any pending sem posts
while (sem_trywait(&mBufferSem) == 0);
int ready = mMonitor.wait(events, ARRAY_LENGTH(events), -1);
if (ready < 0) {
- logg->logError("Monitor::wait failed");
+ logg.logError("Monitor::wait failed");
handleException();
}
- const uint64_t currTime = getTime() - gSessionData->mMonotonicStarted;
+ const uint64_t currTime = getTime() - gSessionData.mMonotonicStarted;
for (int i = 0; i < ready; ++i) {
const int fd = events[i].data.fd;
@@ -196,16 +199,16 @@ void ExternalSource::run() {
// Don't read from this connection, establish a new connection to Mali-V500
close(client);
if (!connectMve()) {
- logg->logError("Unable to configure incoming Mali video connection");
+ logg.logError("Unable to configure incoming Mali video connection");
handleException();
}
- } else if (fd == mMaliStartupUds.getFd()) {
- // Mali Graphics says it's alive
- int client = mMaliStartupUds.acceptConnection();
- // Don't read from this connection, establish a new connection to Mali Graphics
+ } else if (fd == mMidgardStartupUds.getFd()) {
+ // Midgard says it's alive
+ int client = mMidgardStartupUds.acceptConnection();
+ // Don't read from this connection, establish a new connection to Midgard
close(client);
- if (!connectMali()) {
- logg->logError("Unable to configure incoming Mali graphics connection");
+ if (!connectMidgard()) {
+ logg.logError("Unable to configure incoming Midgard graphics connection");
handleException();
}
} else if (fd == mUtgardStartupUds.getFd()) {
@@ -213,18 +216,18 @@ void ExternalSource::run() {
int client = mUtgardStartupUds.acceptConnection();
// Don't read from this connection, configure utgard and expect them to reconnect with annotations
close(client);
- gSessionData->mExternalDriver.disconnect();
- gSessionData->mExternalDriver.start();
+ gSessionData.mExternalDriver.disconnect();
+ gSessionData.mExternalDriver.start();
} else if (fd == mAnnotate.getFd()) {
int client = mAnnotate.acceptConnection();
if (!setNonblock(client) || !mMonitor.add(client)) {
- logg->logError("Unable to set socket options on incoming annotation connection");
+ logg.logError("Unable to set socket options on incoming annotation connection");
handleException();
}
} else if (fd == mAnnotateUds.getFd()) {
int client = mAnnotateUds.acceptConnection();
if (!setNonblock(client) || !mMonitor.add(client)) {
- logg->logError("Unable to set socket options on incoming annotation connection");
+ logg.logError("Unable to set socket options on incoming annotation connection");
handleException();
}
} else if (fd == pipefd[0]) {
@@ -235,7 +238,7 @@ void ExternalSource::run() {
* recommended that threads annotate that much as it can also
* starve out the gator data.
*/
- while (gSessionData->mSessionIsActive) {
+ while (gSessionData.mSessionIsActive) {
// Wait until there is enough room for the fd, two headers and two ints
waitFor(7*Buffer::MAXSIZE_PACK32 + 2*sizeof(uint32_t));
mBuffer.packInt(fd);
@@ -280,13 +283,13 @@ void ExternalSource::run() {
mBuffer.setDone();
if (mFtraceFd >= 0) {
- gSessionData->mFtraceDriver.stop();
- gSessionData->mAtraceDriver.stop();
+ gSessionData.mFtraceDriver.stop();
+ gSessionData.mAtraceDriver.stop();
close(mFtraceFd);
}
if (mMveUds >= 0) {
- gSessionData->mMaliVideo.stop(mMveUds);
+ gSessionData.mMaliVideo.stop(mMveUds);
}
mInterruptFd = -1;
@@ -299,7 +302,7 @@ void ExternalSource::interrupt() {
int8_t c = 0;
// Write to the pipe to wake the monitor which will cause mSessionIsActive to be reread
if (::write(mInterruptFd, &c, sizeof(c)) != sizeof(c)) {
- logg->logError("write failed");
+ logg.logError("write failed");
handleException();
}
}
@@ -311,7 +314,7 @@ bool ExternalSource::isDone() {
void ExternalSource::write(Sender *sender) {
// Don't send external data until the summary packet is sent so that monotonic delta is available
- if (!gSessionData->mSentSummary) {
+ if (!gSessionData.mSentSummary) {
return;
}
if (!mBuffer.isDone()) {
diff --git a/tools/gator/daemon/ExternalSource.h b/tools/gator/daemon/ExternalSource.h
index 69d16afeb76c..2831ec83f10a 100644
--- a/tools/gator/daemon/ExternalSource.h
+++ b/tools/gator/daemon/ExternalSource.h
@@ -32,7 +32,7 @@ public:
private:
void waitFor(const int bytes);
void configureConnection(const int fd, const char *const handshake, size_t size);
- bool connectMali();
+ bool connectMidgard();
bool connectMve();
void connectFtrace();
@@ -40,12 +40,12 @@ private:
Buffer mBuffer;
Monitor mMonitor;
OlyServerSocket mMveStartupUds;
- OlyServerSocket mMaliStartupUds;
+ OlyServerSocket mMidgardStartupUds;
OlyServerSocket mUtgardStartupUds;
OlyServerSocket mAnnotate;
OlyServerSocket mAnnotateUds;
int mInterruptFd;
- int mMaliUds;
+ int mMidgardUds;
int mMveUds;
int mFtraceFd;
diff --git a/tools/gator/daemon/FSDriver.cpp b/tools/gator/daemon/FSDriver.cpp
index afac9dfb6761..bd4ef4792d60 100644
--- a/tools/gator/daemon/FSDriver.cpp
+++ b/tools/gator/daemon/FSDriver.cpp
@@ -42,7 +42,7 @@ FSCounter::FSCounter(DriverCounter *next, char *name, char *path, const char *re
if (result != 0) {
char buf[128];
regerror(result, &mReg, buf, sizeof(buf));
- logg->logError("Invalid regex '%s': %s", regex, buf);
+ logg.logError("Invalid regex '%s': %s", regex, buf);
handleException();
}
}
@@ -89,7 +89,7 @@ int64_t FSCounter::read() {
errno = 0;
value = strtoll(buf + match[1].rm_so, NULL, 0);
if (errno != 0) {
- logg->logError("Parsing %s failed: %s", mPath, strerror(errno));
+ logg.logError("Parsing %s failed: %s", mPath, strerror(errno));
handleException();
}
}
@@ -101,7 +101,7 @@ int64_t FSCounter::read() {
return value;
fail:
- logg->logError("Unable to read %s", mPath);
+ logg.logError("Unable to read %s", mPath);
handleException();
}
@@ -124,7 +124,7 @@ void FSDriver::readEvents(mxml_node_t *const xml) {
}
if (counter[0] == '/') {
- logg->logError("Old style filesystem counter (%s) detected, please create a new unique counter value and move the filename into the path attribute, see events-Filesystem.xml for examples", counter);
+ logg.logError("Old style filesystem counter (%s) detected, please create a new unique counter value and move the filename into the path attribute, see events-Filesystem.xml for examples", counter);
handleException();
}
@@ -134,7 +134,7 @@ void FSDriver::readEvents(mxml_node_t *const xml) {
const char *path = mxmlElementGetAttr(node, "path");
if (path == NULL) {
- logg->logError("The filesystem counter %s is missing the required path attribute", counter);
+ logg.logError("The filesystem counter %s is missing the required path attribute", counter);
handleException();
}
const char *regex = mxmlElementGetAttr(node, "regex");
diff --git a/tools/gator/daemon/Fifo.cpp b/tools/gator/daemon/Fifo.cpp
index 8d3b9ff8d385..560ace41d1ae 100644
--- a/tools/gator/daemon/Fifo.cpp
+++ b/tools/gator/daemon/Fifo.cpp
@@ -24,12 +24,12 @@ Fifo::Fifo(int singleBufferSize, int bufferSize, sem_t* readerSem) {
mEnd = false;
if (mBuffer == NULL) {
- logg->logError("failed to allocate %d bytes", bufferSize + singleBufferSize);
+ logg.logError("failed to allocate %d bytes", bufferSize + singleBufferSize);
handleException();
}
if (sem_init(&mWaitForSpaceSem, 0, 0)) {
- logg->logError("sem_init() failed");
+ logg.logError("sem_init() failed");
handleException();
}
}
diff --git a/tools/gator/daemon/FtraceDriver.cpp b/tools/gator/daemon/FtraceDriver.cpp
index 7c57cfcbb1e1..b2d0ba1688b6 100644
--- a/tools/gator/daemon/FtraceDriver.cpp
+++ b/tools/gator/daemon/FtraceDriver.cpp
@@ -55,7 +55,7 @@ void FtraceCounter::prepare() {
snprintf(buf, sizeof(buf), EVENTS_PATH "/%s/enable", mEnable);
if ((DriverSource::readIntDriver(buf, &mWasEnabled) != 0) ||
(DriverSource::writeDriver(buf, 1) != 0)) {
- logg->logError("Unable to read or write to %s", buf);
+ logg.logError("Unable to read or write to %s", buf);
handleException();
}
}
@@ -70,7 +70,7 @@ void FtraceCounter::stop() {
DriverSource::writeDriver(buf, mWasEnabled);
}
-FtraceDriver::FtraceDriver() : mValues(NULL), mSupported(false), mTracingOn(0) {
+FtraceDriver::FtraceDriver() : mValues(NULL), mSupported(false), mMonotonicRawSupport(false), mTracingOn(0) {
}
FtraceDriver::~FtraceDriver() {
@@ -81,21 +81,23 @@ void FtraceDriver::readEvents(mxml_node_t *const xml) {
// Check the kernel version
int release[3];
if (!getLinuxVersion(release)) {
- logg->logError("getLinuxVersion failed");
+ logg.logError("getLinuxVersion failed");
handleException();
}
// The perf clock was added in 3.10
- if (KERNEL_VERSION(release[0], release[1], release[2]) < KERNEL_VERSION(3, 10, 0)) {
+ const int kernelVersion = KERNEL_VERSION(release[0], release[1], release[2]);
+ if (kernelVersion < KERNEL_VERSION(3, 10, 0)) {
mSupported = false;
- logg->logMessage("Unsupported kernel version, to use ftrace please upgrade to Linux 3.10 or later");
+ logg.logSetup("Ftrace Disabled\nFor full ftrace functionality please upgrade to Linux 3.10 or later. With user space gator and Linux prior to 3.10, ftrace counters with the tracepoint and arg attributes will be available.");
return;
}
+ mMonotonicRawSupport = kernelVersion >= KERNEL_VERSION(4, 2, 0);
// Is debugfs or tracefs available?
if (access(TRACING_PATH, R_OK) != 0) {
mSupported = false;
- logg->logMessage("Unable to locate the tracing directory, disabling ftrace");
+ logg.logSetup("Ftrace Disabled\nUnable to locate the tracing directory");
return;
}
@@ -119,7 +121,7 @@ void FtraceDriver::readEvents(mxml_node_t *const xml) {
const char *regex = mxmlElementGetAttr(node, "regex");
if (regex == NULL) {
- logg->logError("The regex counter %s is missing the required regex attribute", counter);
+ logg.logError("The regex counter %s is missing the required regex attribute", counter);
handleException();
}
@@ -128,20 +130,20 @@ void FtraceDriver::readEvents(mxml_node_t *const xml) {
if (enable == NULL) {
enable = tracepoint;
}
- if (gSessionData->mPerf.isSetup() && tracepoint != NULL) {
- logg->logMessage("Not using ftrace for counter %s", counter);
+ if (gSessionData.mPerf.isSetup() && tracepoint != NULL) {
+ logg.logMessage("Not using ftrace for counter %s", counter);
continue;
}
if (enable != NULL) {
char buf[1<<10];
snprintf(buf, sizeof(buf), EVENTS_PATH "/%s/enable", enable);
if (access(buf, W_OK) != 0) {
- logg->logMessage("Disabling counter %s, %s not found", counter, buf);
+ logg.logSetup("%s Disabled\n%s was not found", counter, buf);
continue;
}
}
- logg->logMessage("Using ftrace for %s", counter);
+ logg.logMessage("Using ftrace for %s", counter);
setCounters(new FtraceCounter(getCounters(), strdup(counter), enable));
++count;
}
@@ -158,12 +160,12 @@ void FtraceDriver::prepare() {
}
if (DriverSource::readIntDriver(TRACING_PATH "/tracing_on", &mTracingOn)) {
- logg->logError("Unable to read if ftrace is enabled");
+ logg.logError("Unable to read if ftrace is enabled");
handleException();
}
if (DriverSource::writeDriver(TRACING_PATH "/tracing_on", "0") != 0) {
- logg->logError("Unable to turn ftrace off before truncating the buffer");
+ logg.logError("Unable to turn ftrace off before truncating the buffer");
handleException();
}
@@ -171,14 +173,15 @@ void FtraceDriver::prepare() {
int fd;
fd = open(TRACING_PATH "/trace", O_WRONLY | O_TRUNC | O_CLOEXEC, 0666);
if (fd < 0) {
- logg->logError("Unable truncate ftrace buffer: %s", strerror(errno));
+ logg.logError("Unable truncate ftrace buffer: %s", strerror(errno));
handleException();
}
close(fd);
}
- if (DriverSource::writeDriver(TRACING_PATH "/trace_clock", "perf") != 0) {
- logg->logError("Unable to switch ftrace to the perf clock, please ensure you are running Linux 3.10 or later");
+ const char *const clock = mMonotonicRawSupport ? "mono_raw" : "perf";
+ if (DriverSource::writeDriver(TRACING_PATH "/trace_clock", clock) != 0) {
+ logg.logError("Unable to switch ftrace to the %s clock, please ensure you are running Linux %s or later", clock, mMonotonicRawSupport ? "4.2" : "3.10");
handleException();
}
}
diff --git a/tools/gator/daemon/FtraceDriver.h b/tools/gator/daemon/FtraceDriver.h
index 6e592d786617..12b2d5d4afe2 100644
--- a/tools/gator/daemon/FtraceDriver.h
+++ b/tools/gator/daemon/FtraceDriver.h
@@ -25,7 +25,9 @@ public:
private:
int64_t *mValues;
- bool mSupported;
+ int mSupported : 1,
+ mMonotonicRawSupport : 1,
+ mUnused0 : 30;
int mTracingOn;
// Intentionally unimplemented
diff --git a/tools/gator/daemon/HwmonDriver.cpp b/tools/gator/daemon/HwmonDriver.cpp
index d8353b006e63..de2a25116456 100644
--- a/tools/gator/daemon/HwmonDriver.cpp
+++ b/tools/gator/daemon/HwmonDriver.cpp
@@ -23,7 +23,7 @@ static sensors_subfeature_type getInput(const sensors_feature_type type) {
case SENSORS_FEATURE_CURR: return SENSORS_SUBFEATURE_CURR_INPUT;
case SENSORS_FEATURE_HUMIDITY: return SENSORS_SUBFEATURE_HUMIDITY_INPUT;
default:
- logg->logError("Unsupported hwmon feature %i", type);
+ logg.logError("Unsupported hwmon feature %i", type);
handleException();
}
};
@@ -124,7 +124,7 @@ HwmonCounter::HwmonCounter(DriverCounter *next, char *const name, const sensors_
mMonotonic = false;
break;
default:
- logg->logError("Unsupported hwmon feature %i", mFeature->type);
+ logg.logError("Unsupported hwmon feature %i", mFeature->type);
handleException();
}
@@ -149,12 +149,12 @@ int64_t HwmonCounter::read() {
// Keep in sync with the read check in HwmonDriver::readEvents
subfeature = sensors_get_subfeature(mChip, mFeature, getInput(mFeature->type));
if (!subfeature) {
- logg->logError("No input value for hwmon sensor %s", mLabel);
+ logg.logError("No input value for hwmon sensor %s", mLabel);
handleException();
}
if (sensors_get_value(mChip, subfeature->number, &value) != 0) {
- logg->logError("Can't get input value for hwmon sensor %s", mLabel);
+ logg.logError("Can't get input value for hwmon sensor %s", mLabel);
handleException();
}
@@ -174,7 +174,7 @@ HwmonDriver::~HwmonDriver() {
void HwmonDriver::readEvents(mxml_node_t *const) {
int err = sensors_init(NULL);
if (err) {
- logg->logMessage("Failed to initialize libsensors! (%d)", err);
+ logg.logSetup("Libsensors Disabled\nInitialize failed (%d)", err);
return;
}
sensors_sysfs_no_scaling = 1;
@@ -230,6 +230,8 @@ void HwmonDriver::writeEvents(mxml_node_t *root) const {
if (strcmp(counter->getDisplay(), "average") == 0 || strcmp(counter->getDisplay(), "maximum") == 0) {
mxmlElementSetAttr(node, "average_selection", "yes");
}
+ mxmlElementSetAttr(node, "series_composition", "overlay");
+ mxmlElementSetAttr(node, "rendering_type", "line");
snprintf(buf, sizeof(buf), "libsensors %s sensor %s (%s)", counter->getTitle(), counter->getLabel(), counter->getName());
mxmlElementSetAttr(node, "description", buf);
}
diff --git a/tools/gator/daemon/KMod.cpp b/tools/gator/daemon/KMod.cpp
index e33b499d831b..307d6feca1e9 100644
--- a/tools/gator/daemon/KMod.cpp
+++ b/tools/gator/daemon/KMod.cpp
@@ -83,13 +83,13 @@ void KMod::setupCounter(Counter &counter) {
if (access(text, F_OK) == 0) {
int count = counter.getCount();
if (DriverSource::writeReadDriver(text, &count) && counter.getCount() > 0) {
- logg->logError("Cannot enable EBS for %s:%i with a count of %d\n", counter.getType(), counter.getEvent(), counter.getCount());
+ logg.logError("Cannot enable EBS for %s:%i with a count of %d", counter.getType(), counter.getEvent(), counter.getCount());
handleException();
}
counter.setCount(count);
} else if (counter.getCount() > 0) {
ConfigurationXML::remove();
- logg->logError("Event Based Sampling is only supported with kernel versions 3.0.0 and higher with CONFIG_PERF_EVENTS=y, and CONFIG_HW_PERF_EVENTS=y. The invalid configuration.xml has been removed.\n");
+ logg.logError("Event Based Sampling is only supported with kernel versions 3.0.0 and higher with CONFIG_PERF_EVENTS=y, and CONFIG_HW_PERF_EVENTS=y. The invalid configuration.xml has been removed.");
handleException();
}
}
diff --git a/tools/gator/daemon/LocalCapture.cpp b/tools/gator/daemon/LocalCapture.cpp
index 56899871c03a..b529aa19ee94 100644
--- a/tools/gator/daemon/LocalCapture.cpp
+++ b/tools/gator/daemon/LocalCapture.cpp
@@ -25,9 +25,9 @@ LocalCapture::LocalCapture() {}
LocalCapture::~LocalCapture() {}
void LocalCapture::createAPCDirectory(char* target_path) {
- gSessionData->mAPCDir = createUniqueDirectory(target_path, ".apc");
- if ((removeDirAndAllContents(gSessionData->mAPCDir) != 0 || mkdir(gSessionData->mAPCDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)) {
- logg->logError("Unable to create directory %s", gSessionData->mAPCDir);
+ gSessionData.mAPCDir = createUniqueDirectory(target_path, ".apc");
+ if ((removeDirAndAllContents(gSessionData.mAPCDir) != 0 || mkdir(gSessionData.mAPCDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)) {
+ logg.logError("Unable to create directory %s", gSessionData.mAPCDir);
handleException();
}
}
@@ -36,17 +36,17 @@ void LocalCapture::write(char* string) {
char file[PATH_MAX];
// Set full path
- snprintf(file, PATH_MAX, "%s/session.xml", gSessionData->mAPCDir);
+ snprintf(file, PATH_MAX, "%s/session.xml", gSessionData.mAPCDir);
// Write the file
- if (util->writeToDisk(file, string) < 0) {
- logg->logError("Error writing %s\nPlease verify the path.", file);
+ if (writeToDisk(file, string) < 0) {
+ logg.logError("Error writing %s\nPlease verify the path.", file);
handleException();
}
// Write events XML
EventsXML eventsXML;
- eventsXML.write(gSessionData->mAPCDir);
+ eventsXML.write(gSessionData.mAPCDir);
}
char* LocalCapture::createUniqueDirectory(const char* initialPath, const char* ending) {
@@ -55,11 +55,11 @@ char* LocalCapture::createUniqueDirectory(const char* initialPath, const char* e
// Ensure the path is an absolute path, i.e. starts with a slash
if (initialPath == 0 || strlen(initialPath) == 0) {
- logg->logError("Missing -o command line option required for a local capture.");
+ logg.logError("Missing -o command line option required for a local capture.");
handleException();
} else if (initialPath[0] != '/') {
if (getcwd(path, PATH_MAX) == 0) {
- logg->logMessage("Unable to retrieve the current working directory");
+ logg.logMessage("Unable to retrieve the current working directory");
}
strncat(path, "/", PATH_MAX - strlen(path) - 1);
strncat(path, initialPath, PATH_MAX - strlen(path) - 1);
@@ -114,16 +114,16 @@ void LocalCapture::copyImages(ImageLinkList* ptr) {
char dstfilename[PATH_MAX];
while (ptr) {
- strncpy(dstfilename, gSessionData->mAPCDir, PATH_MAX);
+ strncpy(dstfilename, gSessionData.mAPCDir, PATH_MAX);
dstfilename[PATH_MAX - 1] = 0; // strncpy does not guarantee a null-terminated string
- if (gSessionData->mAPCDir[strlen(gSessionData->mAPCDir) - 1] != '/') {
+ if (gSessionData.mAPCDir[strlen(gSessionData.mAPCDir) - 1] != '/') {
strncat(dstfilename, "/", PATH_MAX - strlen(dstfilename) - 1);
}
- strncat(dstfilename, util->getFilePart(ptr->path), PATH_MAX - strlen(dstfilename) - 1);
- if (util->copyFile(ptr->path, dstfilename)) {
- logg->logMessage("copied file %s to %s", ptr->path, dstfilename);
+ strncat(dstfilename, getFilePart(ptr->path), PATH_MAX - strlen(dstfilename) - 1);
+ if (copyFile(ptr->path, dstfilename)) {
+ logg.logMessage("copied file %s to %s", ptr->path, dstfilename);
} else {
- logg->logMessage("copy of file %s to %s failed", ptr->path, dstfilename);
+ logg.logMessage("copy of file %s to %s failed", ptr->path, dstfilename);
}
ptr = ptr->next;
diff --git a/tools/gator/daemon/Logging.cpp b/tools/gator/daemon/Logging.cpp
index 8846622d950f..a800c4be2320 100644
--- a/tools/gator/daemon/Logging.cpp
+++ b/tools/gator/daemon/Logging.cpp
@@ -8,71 +8,74 @@
#include "Logging.h"
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
#include <string.h>
-#ifdef WIN32
-#define MUTEX_INIT() mLoggingMutex = CreateMutex(NULL, false, NULL);
-#define MUTEX_LOCK() WaitForSingleObject(mLoggingMutex, 0xFFFFFFFF);
-#define MUTEX_UNLOCK() ReleaseMutex(mLoggingMutex);
-#define snprintf _snprintf
-#else
-#include <pthread.h>
-#define MUTEX_INIT() pthread_mutex_init(&mLoggingMutex, NULL)
-#define MUTEX_LOCK() pthread_mutex_lock(&mLoggingMutex)
-#define MUTEX_UNLOCK() pthread_mutex_unlock(&mLoggingMutex)
-#endif
-
// Global thread-safe logging
-Logging* logg = NULL;
+Logging logg;
-Logging::Logging(bool debug) {
- mDebug = debug;
- MUTEX_INIT();
+Logging::Logging() : mDebug(true) {
+ pthread_mutex_init(&mLoggingMutex, NULL);
strcpy(mErrBuf, "Unknown Error");
- strcpy(mLogBuf, "Unknown Message");
}
Logging::~Logging() {
}
-void Logging::_logError(const char *function, const char *file, int line, const char *fmt, ...) {
- va_list args;
+static void format(char *const buf, const size_t bufSize, const bool verbose, const char *const level, const char *const function, const char *const file, const int line, const char *const fmt, va_list args) {
+ int len;
- MUTEX_LOCK();
- if (mDebug) {
- snprintf(mErrBuf, sizeof(mErrBuf), "ERROR: %s(%s:%i): ", function, file, line);
+ if (verbose) {
+ len = snprintf(buf, bufSize, "%s: %s(%s:%i): ", level, function, file, line);
} else {
- mErrBuf[0] = 0;
+ buf[0] = 0;
+ len = 0;
}
+ vsnprintf(buf + len, bufSize - 1 - len, fmt, args); // subtract 1 for \0
+}
+
+void Logging::_logError(const char *function, const char *file, int line, const char *fmt, ...) {
+ va_list args;
+
+ pthread_mutex_lock(&mLoggingMutex);
va_start(args, fmt);
- vsnprintf(mErrBuf + strlen(mErrBuf), sizeof(mErrBuf) - 2 - strlen(mErrBuf), fmt, args); // subtract 2 for \n and \0
+ format(mErrBuf, sizeof(mErrBuf), mDebug, "ERROR", function, file, line, fmt, args);
va_end(args);
+ pthread_mutex_unlock(&mLoggingMutex);
- if (strlen(mErrBuf) > 0) {
- strcat(mErrBuf, "\n");
+ fprintf(stderr, "%s\n", mErrBuf);
+}
+
+void Logging::_logSetup(const char *function, const char *file, int line, const char *fmt, ...) {
+ char logBuf[4096]; // Arbitrarily large buffer to hold a string
+ va_list args;
+
+ va_start(args, fmt);
+ format(logBuf, sizeof(logBuf), mDebug, "SETUP", function, file, line, fmt, args);
+ va_end(args);
+
+ pthread_mutex_lock(&mLoggingMutex);
+ mSetup.append("%s|", logBuf);
+ pthread_mutex_unlock(&mLoggingMutex);
+
+ if (mDebug) {
+ fprintf(stderr, "%s\n", logBuf);
}
- MUTEX_UNLOCK();
}
void Logging::_logMessage(const char *function, const char *file, int line, const char *fmt, ...) {
if (mDebug) {
+ char logBuf[4096]; // Arbitrarily large buffer to hold a string
va_list args;
- MUTEX_LOCK();
- snprintf(mLogBuf, sizeof(mLogBuf), "INFO: %s(%s:%i): ", function, file, line);
-
va_start(args, fmt);
- vsnprintf(mLogBuf + strlen(mLogBuf), sizeof(mLogBuf) - 2 - strlen(mLogBuf), fmt, args); // subtract 2 for \n and \0
+ format(logBuf, sizeof(logBuf), mDebug, "INFO", function, file, line, fmt, args);
va_end(args);
- strcat(mLogBuf, "\n");
- fprintf(stdout, "%s", mLogBuf);
- fflush(stdout);
- MUTEX_UNLOCK();
+ fprintf(stderr, "%s\n", logBuf);
}
}
diff --git a/tools/gator/daemon/Logging.h b/tools/gator/daemon/Logging.h
index a7b45239f5d8..37d3a6f32799 100644
--- a/tools/gator/daemon/Logging.h
+++ b/tools/gator/daemon/Logging.h
@@ -11,29 +11,39 @@
#include <pthread.h>
+#include "DynBuf.h"
+
#define DRIVER_ERROR "\n Driver issue:\n >> gator.ko must be built against the current kernel version & configuration\n >> gator.ko should be co-located with gatord in the same directory\n >> OR insmod gator.ko prior to launching gatord"
class Logging {
public:
- Logging(bool debug);
+ Logging();
~Logging();
+
+ void setDebug(bool debug) { mDebug = debug; }
+
#define logError(...) _logError(__func__, __FILE__, __LINE__, __VA_ARGS__)
__attribute__ ((format (printf, 5, 6)))
void _logError(const char *function, const char *file, int line, const char *fmt, ...);
+ const char *getLastError() {return mErrBuf;}
+
+#define logSetup(...) _logSetup(__func__, __FILE__, __LINE__, __VA_ARGS__)
+ __attribute__ ((format (printf, 5, 6)))
+ void _logSetup(const char *function, const char *file, int line, const char *fmt, ...);
+ const char *getSetup() {return mSetup.getBuf() == NULL ? "" : mSetup.getBuf();}
+
#define logMessage(...) _logMessage(__func__, __FILE__, __LINE__, __VA_ARGS__)
__attribute__ ((format (printf, 5, 6)))
void _logMessage(const char *function, const char *file, int line, const char *fmt, ...);
- char *getLastError() {return mErrBuf;}
- char *getLastMessage() {return mLogBuf;}
private:
- char mErrBuf[4096]; // Arbitrarily large buffer to hold a string
- char mLogBuf[4096]; // Arbitrarily large buffer to hold a string
- bool mDebug;
+ DynBuf mSetup;
pthread_mutex_t mLoggingMutex;
+ bool mDebug;
+ char mErrBuf[4096]; // Arbitrarily large buffer to hold a string
};
-extern Logging *logg;
+extern Logging logg;
extern void handleException() __attribute__ ((noreturn));
diff --git a/tools/gator/daemon/Makefile b/tools/gator/daemon/Makefile
index 27531b438b63..49b2ac3cdd19 100644
--- a/tools/gator/daemon/Makefile
+++ b/tools/gator/daemon/Makefile
@@ -6,7 +6,7 @@
# CROSS_COMPILE=/path/to/cross-compiler/arm-linux-gnueabihf-
# NOTE: This toolchain uses the hardfloat abi by default. For non-hardfloat
# targets run 'make SOFTFLOAT=1 SYSROOT=/path/to/sysroot', see
-# README_Streamline.txt for more details
+# streamline/gator/README.md for more details
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
diff --git a/tools/gator/daemon/MaliVideoDriver.cpp b/tools/gator/daemon/MaliVideoDriver.cpp
index 209a2d3006db..f72acfdf2a86 100644
--- a/tools/gator/daemon/MaliVideoDriver.cpp
+++ b/tools/gator/daemon/MaliVideoDriver.cpp
@@ -143,9 +143,9 @@ bool MaliVideoDriver::start(const int mveUds) {
// data_protocol_version
Buffer::packInt(buf, sizeof(buf), pos, 1);
// sample_rate - convert samples/second to ms/sample
- Buffer::packInt(buf, sizeof(buf), pos, gSessionData->mSampleRate/1000);
+ Buffer::packInt(buf, sizeof(buf), pos, gSessionData.mSampleRate/1000);
// live_rate - convert ns/flush to ms/flush
- Buffer::packInt(buf, sizeof(buf), pos, gSessionData->mLiveRate/1000000);
+ Buffer::packInt(buf, sizeof(buf), pos, gSessionData.mLiveRate/1000000);
// code - MVE_INSTR_ENABLE_COUNTERS
buf[pos++] = 'C';
diff --git a/tools/gator/daemon/MemInfoDriver.cpp b/tools/gator/daemon/MemInfoDriver.cpp
index 4c0b05131945..bc02107a47a6 100644
--- a/tools/gator/daemon/MemInfoDriver.cpp
+++ b/tools/gator/daemon/MemInfoDriver.cpp
@@ -44,7 +44,7 @@ MemInfoDriver::~MemInfoDriver() {
void MemInfoDriver::readEvents(mxml_node_t *const) {
// Only for use with perf
- if (!gSessionData->mPerf.isSetup()) {
+ if (!gSessionData.mPerf.isSetup()) {
return;
}
@@ -59,7 +59,7 @@ void MemInfoDriver::read(Buffer *const buffer) {
}
if (!mBuf.read("/proc/meminfo")) {
- logg->logError("Failed to read /proc/meminfo");
+ logg.logError("Failed to read /proc/meminfo");
handleException();
}
diff --git a/tools/gator/daemon/MidgardDriver.cpp b/tools/gator/daemon/MidgardDriver.cpp
new file mode 100644
index 000000000000..58ea868698d1
--- /dev/null
+++ b/tools/gator/daemon/MidgardDriver.cpp
@@ -0,0 +1,325 @@
+/**
+ * Copyright (C) ARM Limited 2010-2015. 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 "MidgardDriver.h"
+
+#include <unistd.h>
+
+#include "Buffer.h"
+#include "Logging.h"
+#include "OlySocket.h"
+#include "SessionData.h"
+
+static const uint32_t PACKET_SHARED_PARAMETER = 0x0000;
+static const uint32_t PACKET_HARDWARE_COUNTER_DIRECTORY = 0x0002;
+
+struct PacketHeader {
+ uint32_t mImplSpec : 8,
+ mReserved0 : 8,
+ mPacketIdentifier : 16; //mPacketId : 10, mPacketFamily : 6;
+ uint32_t mDataLength : 23,
+ mSequenceNumbered : 1,
+ mReserved1 : 8;
+} __attribute__((packed));
+
+struct SharedParameterPacket {
+ uint32_t mMaliMagic;
+ uint32_t mMaxDataLen : 24,
+ mReserved2 : 8;
+ uint32_t mPid;
+ uint32_t mOffsets[4];
+} __attribute__((packed));
+
+struct HardwareCounter {
+ uint16_t mCounterIndex;
+ uint32_t mCounterNameLen;
+ char mCounterName[];
+} __attribute__((packed));
+
+struct GPUPerfPeriod {
+ uint32_t mDeclId;
+ int32_t mMicroseconds;
+ uint32_t mStartIndex;
+ uint64_t mEnableMap;
+} __attribute__((packed));
+
+struct GLESWindump {
+ uint32_t mDeclId;
+ int32_t mSkipframes;
+ uint32_t mMinWidth;
+ uint32_t mMinHeight;
+} __attribute__((packed));
+
+struct CounterData {
+ enum {
+ PERF,
+ WINDUMP,
+ ACTIVITY,
+ } mType;
+ union {
+ struct {
+ // PERF
+ int mIndex;
+ };
+ struct {
+ // WINDUMP
+ };
+ struct {
+ // ACTIVITY
+ int mCores;
+ };
+ };
+};
+
+class MidgardCounter : public DriverCounter {
+public:
+ MidgardCounter(DriverCounter *next, const char *name, CounterData *const counterData) : DriverCounter(next, name), mCounterData(*counterData), mEvent(-1) {}
+
+ ~MidgardCounter() {
+ }
+
+ int getType() const { return mCounterData.mType; }
+
+ // PERF
+ int getIndex() const { return mCounterData.mIndex; }
+
+ // ACTIVITY
+ int getCores() const { return mCounterData.mCores; }
+
+ void setEvent(const int event) { mEvent = event; }
+ int getEvent() const { return mEvent; }
+
+private:
+ const CounterData mCounterData;
+ int mEvent;
+
+ // Intentionally undefined
+ MidgardCounter(const MidgardCounter &);
+ MidgardCounter &operator=(const MidgardCounter &);
+};
+
+MidgardDriver::MidgardDriver() : mQueried(false) {
+}
+
+MidgardDriver::~MidgardDriver() {
+}
+
+void MidgardDriver::query() const {
+ if (mQueried) {
+ return;
+ }
+ // Only try once even if it fails otherwise not all the possible counters may be shown
+ mQueried = true;
+
+ char *const buf = gSessionData.mSharedData->mMaliMidgardCounters;
+ // Prefer not to requery once obtained as it could throw capture off, assume it doesn't change
+ if (gSessionData.mSharedData->mMaliMidgardCountersSize > 0) {
+ logg.logMessage("Using cached Midgard counters\n");
+ } else {
+ int uds = OlySocket::connect(MALI_GRAPHICS, MALI_GRAPHICS_SIZE);
+ if (uds < 0) {
+ logg.logMessage("Unable to connect to Midgard");
+ } else {
+ logg.logMessage("Connected to midgard");
+ gSessionData.mSharedData->mMaliMidgardCountersSize = 0;
+
+ PacketHeader header;
+ const size_t bufSize = sizeof(gSessionData.mSharedData->mMaliMidgardCounters);
+ bool first = true;
+ // [DR] Do something with this
+ //uint32_t compatibilityTiebreak = 0;
+
+ while (true) {
+ // [DR] Store-and-forward data at capture start?
+ if (!readAll(uds, &header, sizeof(PacketHeader))) {
+ logg.logError("Unable to read Midgard header");
+ handleException();
+ }
+ if (first && ((uint8_t *)&header)[0] != 0) {
+ logg.logMessage("Midgard data is not in encapsulated format");
+ break;
+ }
+ first = false;
+ if (header.mDataLength > bufSize || !readAll(uds, buf, header.mDataLength)) {
+ logg.logError("Unable to read Midgard body");
+ handleException();
+ }
+
+ if (header.mSequenceNumbered) {
+ logg.logError("sequence_numbered is true and is unsupported");
+ handleException();
+ }
+
+ if (header.mReserved0 != 0 || header.mReserved1 != 0) {
+ continue;
+ }
+
+ switch (header.mPacketIdentifier) {
+ case PACKET_SHARED_PARAMETER: {
+ const SharedParameterPacket *const packet = (SharedParameterPacket *)buf;
+ if (header.mDataLength >= sizeof(SharedParameterPacket) && header.mImplSpec == 0 && packet->mReserved2 == 0) {
+ if (packet->mMaliMagic != 0x6D616C69) {
+ logg.logError("mali_magic does not match expected value");
+ handleException();
+ }
+ /*
+ for (int i = 0; reinterpret_cast<const char *>(packet->mOffsets + i + 1) <= buf + header.mDataLength && packet->mOffsets[i] != 0; ++i) {
+ if (i == 3) {
+ compatibilityTiebreak = *reinterpret_cast<uint32_t *>(buf + packet->mOffsets[i]);
+ printf("compatibility tiebreak: %i\n", compatibilityTiebreak);
+ }
+ }
+ */
+ }
+ break;
+ }
+
+ case PACKET_HARDWARE_COUNTER_DIRECTORY: {
+ if (header.mImplSpec == 0) {
+ gSessionData.mSharedData->mMaliMidgardCountersSize = header.mDataLength;
+ goto allDone;
+ }
+ }
+
+ case 0x0400:
+ case 0x0402:
+ case 0x0408:
+ // Ignore
+ break;
+
+ default:
+ // Unrecognized packet, give up
+ goto allDone;
+ }
+ }
+ allDone:
+
+ close(uds);
+ }
+ }
+
+ const size_t size = gSessionData.mSharedData->mMaliMidgardCountersSize;
+ CounterData cd;
+ cd.mType = CounterData::PERF;
+ for (int i = 0; i + sizeof(MidgardCounter) < size;) {
+ const HardwareCounter *counter = (HardwareCounter *)(buf + i);
+ char *name;
+ if (asprintf(&name, "ARM_Mali-%s", counter->mCounterName) <= 0) {
+ logg.logError("asprintf failed");
+ handleException();
+ }
+ cd.mIndex = counter->mCounterIndex;
+ ((MidgardDriver *)(this))->setCounters(new MidgardCounter(getCounters(), name, &cd));
+ i += sizeof(*counter) + counter->mCounterNameLen;
+ }
+
+ // Should a more sophisticated check be used?
+ if (size > 0) {
+ cd.mType = CounterData::WINDUMP;
+ ((MidgardDriver *)(this))->setCounters(new MidgardCounter(getCounters(), strdup("ARM_Mali-Midgard_Filmstrip2_cnt0"), &cd));
+
+ cd.mType = CounterData::ACTIVITY;
+ cd.mCores = 1;
+ ((MidgardDriver *)(this))->setCounters(new MidgardCounter(getCounters(), strdup("ARM_Mali-Midgard_fragment"), &cd));
+ ((MidgardDriver *)(this))->setCounters(new MidgardCounter(getCounters(), strdup("ARM_Mali-Midgard_vertex"), &cd));
+ ((MidgardDriver *)(this))->setCounters(new MidgardCounter(getCounters(), strdup("ARM_Mali-Midgard_opencl"), &cd));
+ }
+}
+
+bool MidgardDriver::start(const int uds) {
+ uint64_t enabled[8] = { 0 };
+ size_t bufPos = 0;
+ char buf[ARRAY_LENGTH(enabled)*sizeof(GPUPerfPeriod) + sizeof(GLESWindump)];
+
+ for (MidgardCounter *counter = static_cast<MidgardCounter *>(getCounters()); counter != NULL; counter = static_cast<MidgardCounter *>(counter->getNext())) {
+ if (!counter->isEnabled() || counter->getType() != CounterData::PERF) {
+ continue;
+ }
+
+ int i = counter->getIndex()/64;
+ if (i >= ARRAY_LENGTH(enabled)) {
+ logg.logError("enabled is too small");
+ handleException();
+ }
+ enabled[i] |= 1 << (counter->getIndex() & 63);
+ }
+
+ for (int i = 0; i < ARRAY_LENGTH(enabled); ++i) {
+ if (enabled[i] == 0) {
+ continue;
+ }
+
+ GPUPerfPeriod m;
+ // MALI_GPUPERF_PERIOD
+ m.mDeclId = 0;
+ m.mMicroseconds = gSessionData.mSampleRate > 0 ? 1000000/gSessionData.mSampleRate : 100000;
+ m.mStartIndex = 64*i;
+ m.mEnableMap = enabled[i];
+ memcpy(buf + bufPos, &m, sizeof(m));
+ bufPos += sizeof(m);
+ }
+
+ bool foundWindumpCounter = false;
+ for (MidgardCounter *counter = static_cast<MidgardCounter *>(getCounters()); counter != NULL; counter = static_cast<MidgardCounter *>(counter->getNext())) {
+ if (!counter->isEnabled() || counter->getType() != CounterData::WINDUMP) {
+ continue;
+ }
+
+ if (foundWindumpCounter) {
+ logg.logError("Only one Mali Midgard filmstrip counter can be enabled at a time");
+ handleException();
+ }
+ foundWindumpCounter = true;
+
+ // MALI_GLES_WINDUMP
+ GLESWindump m;
+ m.mDeclId = 1;
+ m.mSkipframes = counter->getEvent() & 0xff;
+ m.mMinWidth = (counter->getEvent() & 0xfff00000) >> 20;
+ m.mMinHeight = (counter->getEvent() & 0xfff00) >> 8;
+ memcpy(buf + bufPos, &m, sizeof(m));
+ bufPos += sizeof(m);
+ }
+
+ if (bufPos > sizeof(buf)) {
+ logg.logError("Buffer overflow");
+ handleException();
+ }
+ if (!writeAll(uds, buf, bufPos)) {
+ logg.logError("Unable enable Midgard counters");
+ handleException();
+ }
+
+ return true;
+}
+
+bool MidgardDriver::claimCounter(const Counter &counter) const {
+ query();
+ return super::claimCounter(counter);
+}
+
+void MidgardDriver::resetCounters() {
+ query();
+ super::resetCounters();
+}
+
+void MidgardDriver::setupCounter(Counter &counter) {
+ MidgardCounter *const midgardCounter = static_cast<MidgardCounter *>(findCounter(counter));
+ if (midgardCounter == NULL) {
+ counter.setEnabled(false);
+ return;
+ }
+ midgardCounter->setEnabled(true);
+ counter.setKey(midgardCounter->getKey());
+ if (counter.getEvent() != -1) {
+ midgardCounter->setEvent(counter.getEvent());
+ }
+ if (midgardCounter->getType() == CounterData::ACTIVITY && midgardCounter->getCores() > 0) {
+ counter.setCores(midgardCounter->getCores());
+ }
+}
diff --git a/tools/gator/daemon/MidgardDriver.h b/tools/gator/daemon/MidgardDriver.h
new file mode 100644
index 000000000000..503898595372
--- /dev/null
+++ b/tools/gator/daemon/MidgardDriver.h
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) ARM Limited 2010-2015. 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.
+ */
+
+#ifndef MIDGARDDRIVER_H
+#define MIDGARDDRIVER_H
+
+#include "Driver.h"
+
+class MidgardDriver : public SimpleDriver {
+ typedef SimpleDriver super;
+
+public:
+ MidgardDriver();
+ ~MidgardDriver();
+
+ bool claimCounter(const Counter &counter) const;
+ void resetCounters();
+ void setupCounter(Counter &counter);
+
+ bool start(const int midgardUds);
+
+private:
+ void query() const;
+
+ mutable bool mQueried;
+
+ // Intentionally unimplemented
+ MidgardDriver(const MidgardDriver &);
+ MidgardDriver &operator=(const MidgardDriver &);
+};
+
+#endif // MIDGARDDRIVER_H
diff --git a/tools/gator/daemon/Monitor.cpp b/tools/gator/daemon/Monitor.cpp
index 04288872f515..c71870badcf8 100644
--- a/tools/gator/daemon/Monitor.cpp
+++ b/tools/gator/daemon/Monitor.cpp
@@ -38,14 +38,14 @@ bool Monitor::init() {
mFd = epoll_create(16);
#endif
if (mFd < 0) {
- logg->logMessage("epoll_create1 failed");
+ logg.logMessage("epoll_create1 failed");
return false;
}
#ifndef EPOLL_CLOEXEC
int fdf = fcntl(mFd, F_GETFD);
if ((fdf == -1) || (fcntl(mFd, F_SETFD, fdf | FD_CLOEXEC) != 0)) {
- logg->logMessage("fcntl failed");
+ logg.logMessage("fcntl failed");
::close(mFd);
return -1;
}
@@ -60,7 +60,7 @@ bool Monitor::add(const int fd) {
event.data.fd = fd;
event.events = EPOLLIN;
if (epoll_ctl(mFd, EPOLL_CTL_ADD, fd, &event) != 0) {
- logg->logMessage("epoll_ctl failed");
+ logg.logMessage("epoll_ctl failed");
return false;
}
@@ -74,7 +74,7 @@ int Monitor::wait(struct epoll_event *const events, int maxevents, int timeout)
if (errno == EINTR) {
result = 0;
} else {
- logg->logMessage("epoll_wait failed");
+ logg.logMessage("epoll_wait failed");
}
}
diff --git a/tools/gator/daemon/NetDriver.cpp b/tools/gator/daemon/NetDriver.cpp
index ab362115f29d..50a187da5799 100644
--- a/tools/gator/daemon/NetDriver.cpp
+++ b/tools/gator/daemon/NetDriver.cpp
@@ -52,7 +52,7 @@ NetDriver::~NetDriver() {
void NetDriver::readEvents(mxml_node_t *const) {
// Only for use with perf
- if (!gSessionData->mPerf.isSetup()) {
+ if (!gSessionData.mPerf.isSetup()) {
return;
}
@@ -108,7 +108,7 @@ bool NetDriver::doRead() {
void NetDriver::start() {
if (!doRead()) {
- logg->logError("Unable to read network stats");
+ logg.logError("Unable to read network stats");
handleException();
}
// Initialize previous values
@@ -122,7 +122,7 @@ void NetDriver::start() {
void NetDriver::read(Buffer *const buffer) {
if (!doRead()) {
- logg->logError("Unable to read network stats");
+ logg.logError("Unable to read network stats");
handleException();
}
super::read(buffer);
diff --git a/tools/gator/daemon/OlySocket.cpp b/tools/gator/daemon/OlySocket.cpp
index 078d20209226..2cd5a599f450 100644
--- a/tools/gator/daemon/OlySocket.cpp
+++ b/tools/gator/daemon/OlySocket.cpp
@@ -11,7 +11,7 @@
#include <stdio.h>
#include <string.h>
#ifdef WIN32
-#include <Winsock2.h>
+#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <netinet/in.h>
@@ -79,7 +79,7 @@ OlyServerSocket::OlyServerSocket(int port) {
#ifdef WIN32
WSADATA wsaData;
if (WSAStartup(0x0202, &wsaData) != 0) {
- logg->logError("Windows socket initialization failed");
+ logg.logError("Windows socket initialization failed");
handleException();
}
#endif
@@ -102,7 +102,7 @@ OlyServerSocket::OlyServerSocket(const char* path, const size_t pathSize, const
// Create socket
mFDServer = socket_cloexec(PF_UNIX, SOCK_STREAM, 0);
if (mFDServer < 0) {
- logg->logError("Error creating server socket");
+ logg.logError("Error creating server socket");
handleException();
}
@@ -115,13 +115,13 @@ OlyServerSocket::OlyServerSocket(const char* path, const size_t pathSize, const
// Bind the socket to an address
if (bind(mFDServer, (const struct sockaddr*)&sockaddr, calculateAddrlen ? offsetof(struct sockaddr_un, sun_path) + pathSize - 1 : sizeof(sockaddr)) < 0) {
- logg->logError("Binding of server socket failed.");
+ logg.logError("Binding of server socket failed.");
handleException();
}
// Listen for connections on this socket
if (listen(mFDServer, 1) < 0) {
- logg->logError("Listening of server socket failed");
+ logg.logError("Listening of server socket failed");
handleException();
}
}
@@ -176,7 +176,7 @@ void OlySocket::closeSocket() {
void OlyServerSocket::closeServerSocket() {
if (mFDServer > 0 && CLOSE_SOCKET(mFDServer) != 0) {
- logg->logError("Failed to close server socket.");
+ logg.logError("Failed to close server socket.");
handleException();
}
mFDServer = -1;
@@ -191,7 +191,7 @@ void OlyServerSocket::createServerSocket(int port) {
family = AF_INET;
mFDServer = socket_cloexec(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (mFDServer < 0) {
- logg->logError("Error creating server socket");
+ logg.logError("Error creating server socket");
handleException();
}
}
@@ -199,14 +199,14 @@ void OlyServerSocket::createServerSocket(int port) {
// Enable address reuse, another solution would be to create the server socket once and only close it when the object exits
int on = 1;
if (setsockopt(mFDServer, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) != 0) {
- logg->logError("Setting server socket reuse option failed");
+ logg.logError("Setting server socket reuse option failed");
handleException();
}
// Listen on both IPv4 and IPv6
on = 0;
if (setsockopt(mFDServer, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&on, sizeof(on)) != 0) {
- logg->logMessage("setsockopt IPV6_V6ONLY failed");
+ logg.logMessage("setsockopt IPV6_V6ONLY failed");
}
// Create sockaddr_in structure, ensuring non-populated fields are zero
@@ -218,13 +218,13 @@ void OlyServerSocket::createServerSocket(int port) {
// Bind the socket to an address
if (bind(mFDServer, (const struct sockaddr*)&sockaddr, sizeof(sockaddr)) < 0) {
- logg->logError("Binding of server socket on port %i failed.\nIs an instance already running or is another application using that port?", port);
+ logg.logError("Binding of server socket on port %i failed.\nIs an instance already running or is another application using that port?", port);
handleException();
}
// Listen for connections on this socket
if (listen(mFDServer, 1) < 0) {
- logg->logError("Listening of server socket failed");
+ logg.logError("Listening of server socket failed");
handleException();
}
}
@@ -234,14 +234,14 @@ void OlyServerSocket::createServerSocket(int port) {
int OlyServerSocket::acceptConnection() {
int socketID;
if (mFDServer <= 0) {
- logg->logError("Attempting multiple connections on a single connection server socket or attempting to accept on a client socket");
+ logg.logError("Attempting multiple connections on a single connection server socket or attempting to accept on a client socket");
handleException();
}
// Accept a connection, note that this call blocks until a client connects
socketID = accept_cloexec(mFDServer, NULL, NULL);
if (socketID < 0) {
- logg->logError("Socket acceptance failed");
+ logg.logError("Socket acceptance failed");
handleException();
}
return socketID;
@@ -255,7 +255,7 @@ void OlySocket::send(const char* buffer, int size) {
while (size > 0) {
int n = ::send(mSocketID, buffer, size, 0);
if (n < 0) {
- logg->logError("Socket send error");
+ logg.logError("Socket send error");
handleException();
}
size -= n;
@@ -271,10 +271,10 @@ int OlySocket::receive(char* buffer, int size) {
int bytes = recv(mSocketID, buffer, size, 0);
if (bytes < 0) {
- logg->logError("Socket receive error");
+ logg.logError("Socket receive error");
handleException();
} else if (bytes == 0) {
- logg->logMessage("Socket disconnected");
+ logg.logMessage("Socket disconnected");
return -1;
}
return bytes;
@@ -286,10 +286,10 @@ int OlySocket::receiveNBytes(char* buffer, int size) {
while (size > 0 && buffer != NULL) {
bytes = recv(mSocketID, buffer, size, 0);
if (bytes < 0) {
- logg->logError("Socket receive error");
+ logg.logError("Socket receive error");
handleException();
} else if (bytes == 0) {
- logg->logMessage("Socket disconnected");
+ logg.logMessage("Socket disconnected");
return -1;
}
buffer += bytes;
@@ -311,10 +311,10 @@ int OlySocket::receiveString(char* buffer, int size) {
// Receive a single character
int bytes = recv(mSocketID, &buffer[bytes_received], 1, 0);
if (bytes < 0) {
- logg->logError("Socket receive error");
+ logg.logError("Socket receive error");
handleException();
} else if (bytes == 0) {
- logg->logMessage("Socket disconnected");
+ logg.logMessage("Socket disconnected");
return -1;
}
diff --git a/tools/gator/daemon/OlySocket.h b/tools/gator/daemon/OlySocket.h
index 757a2522f926..dcd557dad3db 100644
--- a/tools/gator/daemon/OlySocket.h
+++ b/tools/gator/daemon/OlySocket.h
@@ -17,6 +17,8 @@ typedef int socklen_t;
#include <sys/socket.h>
#endif
+#include "Config.h"
+
class OlySocket {
public:
#ifndef WIN32
diff --git a/tools/gator/daemon/OlyUtility.cpp b/tools/gator/daemon/OlyUtility.cpp
index 6f40168c1ee0..30655f0538dd 100644
--- a/tools/gator/daemon/OlyUtility.cpp
+++ b/tools/gator/daemon/OlyUtility.cpp
@@ -21,9 +21,7 @@
#include <mach-o/dyld.h>
#endif
-OlyUtility* util = NULL;
-
-bool OlyUtility::stringToBool(const char* string, bool defValue) {
+bool stringToBool(const char* string, bool defValue) {
char value[32];
if (string == NULL) {
@@ -52,7 +50,7 @@ bool OlyUtility::stringToBool(const char* string, bool defValue) {
}
}
-void OlyUtility::stringToLower(char* string) {
+void stringToLower(char* string) {
if (string == NULL) {
return;
}
@@ -64,7 +62,7 @@ void OlyUtility::stringToLower(char* string) {
}
// Modifies fullpath with the path part including the trailing path separator
-int OlyUtility::getApplicationFullPath(char* fullpath, int sizeOfPath) {
+int getApplicationFullPath(char* fullpath, int sizeOfPath) {
memset(fullpath, 0, sizeOfPath);
#if defined(WIN32)
int length = GetModuleFileName(NULL, fullpath, sizeOfPath);
@@ -88,7 +86,7 @@ int OlyUtility::getApplicationFullPath(char* fullpath, int sizeOfPath) {
return 0;
}
-char* OlyUtility::readFromDisk(const char* file, unsigned int *size, bool appendNull) {
+char* readFromDisk(const char* file, unsigned int *size, bool appendNull) {
// Open the file
FILE* pFile = fopen(file, "rb");
if (pFile==NULL) {
@@ -128,7 +126,7 @@ char* OlyUtility::readFromDisk(const char* file, unsigned int *size, bool append
return buffer;
}
-int OlyUtility::writeToDisk(const char* path, const char* data) {
+int writeToDisk(const char* path, const char* data) {
// Open the file
FILE* pFile = fopen(path, "wb");
if (pFile == NULL) {
@@ -146,7 +144,7 @@ int OlyUtility::writeToDisk(const char* path, const char* data) {
return 0;
}
-int OlyUtility::appendToDisk(const char* path, const char* data) {
+int appendToDisk(const char* path, const char* data) {
// Open the file
FILE* pFile = fopen(path, "a");
if (pFile == NULL) {
@@ -170,7 +168,7 @@ int OlyUtility::appendToDisk(const char* path, const char* data) {
* 0 is returned on an error; otherwise 1.
*/
#define TRANSFER_SIZE 1024
-int OlyUtility::copyFile(const char* srcFile, const char* dstFile) {
+int copyFile(const char* srcFile, const char* dstFile) {
char buffer[TRANSFER_SIZE];
FILE * f_src = fopen(srcFile,"rb");
if (!f_src) {
@@ -200,7 +198,7 @@ int OlyUtility::copyFile(const char* srcFile, const char* dstFile) {
return 1;
}
-const char* OlyUtility::getFilePart(const char* path) {
+const char* getFilePart(const char* path) {
const char* last_sep = strrchr(path, PATH_SEPARATOR);
// in case path is not a full path
@@ -213,7 +211,7 @@ const char* OlyUtility::getFilePart(const char* path) {
// getPathPart may modify the contents of path
// returns the path including the trailing path separator
-char* OlyUtility::getPathPart(char* path) {
+char* getPathPart(char* path) {
char* last_sep = strrchr(path, PATH_SEPARATOR);
// in case path is not a full path
diff --git a/tools/gator/daemon/OlyUtility.h b/tools/gator/daemon/OlyUtility.h
index 1525081a97a3..fc10e3516419 100644
--- a/tools/gator/daemon/OlyUtility.h
+++ b/tools/gator/daemon/OlyUtility.h
@@ -21,22 +21,14 @@
#define CAIMAN_PATH_MAX PATH_MAX
#endif
-class OlyUtility {
-public:
- OlyUtility() {};
- ~OlyUtility() {};
- bool stringToBool(const char* string, bool defValue);
- void stringToLower(char* string);
- int getApplicationFullPath(char* path, int sizeOfPath);
- char* readFromDisk(const char* file, unsigned int *size = NULL, bool appendNull = true);
- int writeToDisk(const char* path, const char* file);
- int appendToDisk(const char* path, const char* file);
- int copyFile(const char* srcFile, const char* dstFile);
- const char* getFilePart(const char* path);
- char* getPathPart(char* path);
-private:
-};
-
-extern OlyUtility* util;
+bool stringToBool(const char* string, bool defValue);
+void stringToLower(char* string);
+int getApplicationFullPath(char* path, int sizeOfPath);
+char* readFromDisk(const char* file, unsigned int *size = NULL, bool appendNull = true);
+int writeToDisk(const char* path, const char* file);
+int appendToDisk(const char* path, const char* file);
+int copyFile(const char* srcFile, const char* dstFile);
+const char* getFilePart(const char* path);
+char* getPathPart(char* path);
#endif // OLY_UTILITY_H
diff --git a/tools/gator/daemon/PerfBuffer.cpp b/tools/gator/daemon/PerfBuffer.cpp
index 3b9da1dc6592..a369688c0619 100644
--- a/tools/gator/daemon/PerfBuffer.cpp
+++ b/tools/gator/daemon/PerfBuffer.cpp
@@ -27,7 +27,7 @@ PerfBuffer::PerfBuffer() {
PerfBuffer::~PerfBuffer() {
for (int cpu = ARRAY_LENGTH(mBuf) - 1; cpu >= 0; --cpu) {
if (mBuf[cpu] != MAP_FAILED) {
- munmap(mBuf[cpu], gSessionData->mPageSize + BUF_SIZE);
+ munmap(mBuf[cpu], gSessionData.mPageSize + BUF_SIZE);
}
}
}
@@ -35,14 +35,14 @@ PerfBuffer::~PerfBuffer() {
bool PerfBuffer::useFd(const int cpu, const int fd) {
if (mFds[cpu] < 0) {
if (mBuf[cpu] != MAP_FAILED) {
- logg->logMessage("cpu %i already online or not correctly cleaned up", cpu);
+ logg.logMessage("cpu %i already online or not correctly cleaned up", cpu);
return false;
}
// The buffer isn't mapped yet
- mBuf[cpu] = mmap(NULL, gSessionData->mPageSize + BUF_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ mBuf[cpu] = mmap(NULL, gSessionData.mPageSize + BUF_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (mBuf[cpu] == MAP_FAILED) {
- logg->logMessage("mmap failed");
+ logg.logMessage("mmap failed");
return false;
}
mFds[cpu] = fd;
@@ -50,17 +50,17 @@ bool PerfBuffer::useFd(const int cpu, const int fd) {
// Check the version
struct perf_event_mmap_page *pemp = static_cast<struct perf_event_mmap_page *>(mBuf[cpu]);
if (pemp->compat_version != 0) {
- logg->logMessage("Incompatible perf_event_mmap_page compat_version");
+ logg.logMessage("Incompatible perf_event_mmap_page compat_version");
return false;
}
} else {
if (mBuf[cpu] == MAP_FAILED) {
- logg->logMessage("cpu already online or not correctly cleaned up");
+ logg.logMessage("cpu already online or not correctly cleaned up");
return false;
}
if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, mFds[cpu]) < 0) {
- logg->logMessage("ioctl failed");
+ logg.logMessage("ioctl failed");
return false;
}
}
@@ -75,7 +75,7 @@ void PerfBuffer::discard(const int cpu) {
}
bool PerfBuffer::isEmpty() {
- for (int cpu = 0; cpu < gSessionData->mCores; ++cpu) {
+ for (int cpu = 0; cpu < gSessionData.mCores; ++cpu) {
if (mBuf[cpu] != MAP_FAILED) {
// Take a snapshot of the positions
struct perf_event_mmap_page *pemp = static_cast<struct perf_event_mmap_page *>(mBuf[cpu]);
@@ -92,7 +92,7 @@ bool PerfBuffer::isEmpty() {
}
bool PerfBuffer::isFull() {
- for (int cpu = 0; cpu < gSessionData->mCores; ++cpu) {
+ for (int cpu = 0; cpu < gSessionData.mCores; ++cpu) {
if (mBuf[cpu] != MAP_FAILED) {
// Take a snapshot of the positions
struct perf_event_mmap_page *pemp = static_cast<struct perf_event_mmap_page *>(mBuf[cpu]);
@@ -141,7 +141,7 @@ public:
private:
void writeFrameSize() {
writeCpuSize();
- const int typeLength = gSessionData->mLocalCapture ? 0 : 1;
+ const int typeLength = gSessionData.mLocalCapture ? 0 : 1;
Buffer::writeLEInt(reinterpret_cast<unsigned char *>(mBuf + typeLength), mWritePos - typeLength - sizeof(uint32_t));
}
@@ -149,7 +149,7 @@ private:
if (mWritePos < 0) {
mWritePos = 0;
mCpuSizePos = -1;
- if (!gSessionData->mLocalCapture) {
+ if (!gSessionData.mLocalCapture) {
mBuf[mWritePos++] = RESPONSE_APC_DATA;
}
// Reserve space for frame size
@@ -190,7 +190,7 @@ private:
bool PerfBuffer::send(Sender *const sender) {
PerfFrame frame(sender);
- for (int cpu = 0; cpu < gSessionData->mCores; ++cpu) {
+ for (int cpu = 0; cpu < gSessionData.mCores; ++cpu) {
if (mBuf[cpu] == MAP_FAILED) {
continue;
}
@@ -201,7 +201,7 @@ bool PerfBuffer::send(Sender *const sender) {
const __u64 tail = ACCESS_ONCE(pemp->data_tail);
if (head > tail) {
- const uint8_t *const b = static_cast<uint8_t *>(mBuf[cpu]) + gSessionData->mPageSize;
+ const uint8_t *const b = static_cast<uint8_t *>(mBuf[cpu]) + gSessionData.mPageSize;
frame.add(cpu, head, tail, b);
// Update tail with the data read
@@ -209,11 +209,11 @@ bool PerfBuffer::send(Sender *const sender) {
}
if (mDiscard[cpu]) {
- munmap(mBuf[cpu], gSessionData->mPageSize + BUF_SIZE);
+ munmap(mBuf[cpu], gSessionData.mPageSize + BUF_SIZE);
mBuf[cpu] = MAP_FAILED;
mDiscard[cpu] = false;
mFds[cpu] = -1;
- logg->logMessage("Unmaped cpu %i", cpu);
+ logg.logMessage("Unmaped cpu %i", cpu);
}
}
diff --git a/tools/gator/daemon/PerfBuffer.h b/tools/gator/daemon/PerfBuffer.h
index a2d0e9b44725..32cc0625456d 100644
--- a/tools/gator/daemon/PerfBuffer.h
+++ b/tools/gator/daemon/PerfBuffer.h
@@ -11,7 +11,7 @@
#include "Config.h"
-#define BUF_SIZE (gSessionData->mTotalBufferSize * 1024 * 1024)
+#define BUF_SIZE (gSessionData.mTotalBufferSize * 1024 * 1024)
#define BUF_MASK (BUF_SIZE - 1)
class Sender;
diff --git a/tools/gator/daemon/PerfDriver.cpp b/tools/gator/daemon/PerfDriver.cpp
index e5f8aaa86c5a..4c7da11b86dd 100644
--- a/tools/gator/daemon/PerfDriver.cpp
+++ b/tools/gator/daemon/PerfDriver.cpp
@@ -28,58 +28,6 @@
#define TYPE_DERIVED ~0U
-// From gator.h
-struct gator_cpu {
- const int cpuid;
- // Human readable name
- const char *const core_name;
- // gatorfs event and Perf PMU name
- const char *const pmnc_name;
- const int pmnc_counters;
-};
-
-// From gator_main.c
-static const struct gator_cpu gator_cpus[] = {
- { 0x41b36, "ARM1136", "ARM_ARM11", 3 },
- { 0x41b56, "ARM1156", "ARM_ARM11", 3 },
- { 0x41b76, "ARM1176", "ARM_ARM11", 3 },
- { 0x41b02, "ARM11MPCore", "ARM_ARM11MPCore", 3 },
- { 0x41c05, "Cortex-A5", "ARMv7_Cortex_A5", 2 },
- { 0x41c07, "Cortex-A7", "ARMv7_Cortex_A7", 4 },
- { 0x41c08, "Cortex-A8", "ARMv7_Cortex_A8", 4 },
- { 0x41c09, "Cortex-A9", "ARMv7_Cortex_A9", 6 },
- { 0x41c0f, "Cortex-A15", "ARMv7_Cortex_A15", 6 },
- { 0x41c0d, "Cortex-A17", "ARMv7_Cortex_A17", 6 },
- { 0x41c0e, "Cortex-A17", "ARMv7_Cortex_A17", 6 },
- { 0x5100f, "Scorpion", "Scorpion", 4 },
- { 0x5102d, "ScorpionMP", "ScorpionMP", 4 },
- { 0x51049, "KraitSIM", "Krait", 4 },
- { 0x5104d, "Krait", "Krait", 4 },
- { 0x5106f, "Krait S4 Pro", "Krait", 4 },
- { 0x41d03, "Cortex-A53", "ARMv8_Cortex_A53", 6 },
- { 0x41d07, "Cortex-A57", "ARMv8_Cortex_A57", 6 },
- { 0x41d08, "Cortex-A72", "ARMv8_Cortex_A72", 6 },
-};
-
-static const char OLD_PMU_PREFIX[] = "ARMv7 Cortex-";
-static const char NEW_PMU_PREFIX[] = "ARMv7_Cortex_";
-
-struct uncore_counter {
- // Perf PMU name
- const char *const perfName;
- // gatorfs event name
- const char *const gatorName;
- const int count;
- const bool hasCyclesCounter;
-};
-
-static const struct uncore_counter uncore_counters[] = {
- { "CCI_400", "CCI_400", 4, true },
- { "CCI_400_r1", "CCI_400_r1", 4, true },
- { "CCI_500", "CCI_500", 8, false },
- { "ccn", "ARM_CCN_5XX", 8, true },
-};
-
class PerfCounter : public DriverCounter {
public:
PerfCounter(DriverCounter *next, const char *name, uint32_t type, uint64_t config, uint64_t sampleType, uint64_t flags, const int count) : DriverCounter(next, name), mType(type), mConfig(config), mSampleType(sampleType), mFlags(flags), mCount(count) {}
@@ -111,7 +59,7 @@ private:
class CPUFreqDriver : public PerfCounter {
public:
- CPUFreqDriver(DriverCounter *next, uint64_t id) : PerfCounter(next, "Linux_power_cpu_freq", PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_RAW, PERF_GROUP_LEADER | PERF_GROUP_PER_CPU, 1) {}
+ CPUFreqDriver(DriverCounter *next, uint64_t id) : PerfCounter(next, strdup("Linux_power_cpu_freq"), PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_RAW, PERF_GROUP_LEADER | PERF_GROUP_PER_CPU, 1) {}
void read(Buffer *const buffer, const int cpu) {
char buf[64];
@@ -187,6 +135,14 @@ void PerfDriver::addUncoreCounters(const char *const counterName, const int type
}
}
+long long PerfDriver::getTracepointId(const char *const counter, const char *const name, DynBuf *const printb) {
+ long long result = PerfDriver::getTracepointId(name, printb);
+ if (result <= 0) {
+ logg.logSetup("%s Disabled\n%s was not found", counter, printb->getBuf());
+ }
+ return result;
+}
+
void PerfDriver::readEvents(mxml_node_t *const xml) {
mxml_node_t *node = xml;
DynBuf printb;
@@ -214,19 +170,19 @@ void PerfDriver::readEvents(mxml_node_t *const xml) {
if (tracepoint == NULL) {
const char *regex = mxmlElementGetAttr(node, "regex");
if (regex == NULL) {
- logg->logError("The tracepoint counter %s is missing the required tracepoint attribute", counter);
+ logg.logError("The tracepoint counter %s is missing the required tracepoint attribute", counter);
handleException();
} else {
- logg->logMessage("Not using perf for counter %s", counter);
+ logg.logMessage("Not using perf for counter %s", counter);
continue;
}
}
const char *arg = mxmlElementGetAttr(node, "arg");
- long long id = getTracepointId(tracepoint, &printb);
+ long long id = getTracepointId(counter, tracepoint, &printb);
if (id >= 0) {
- logg->logMessage("Using perf for %s", counter);
+ logg.logMessage("Using perf for %s", counter);
setCounters(new PerfCounter(getCounters(), strdup(counter), PERF_TYPE_TRACEPOINT, id, arg == NULL ? 0 : PERF_SAMPLE_RAW, PERF_GROUP_LEADER | PERF_GROUP_PER_CPU, 1));
mTracepoints = new PerfTracepoint(mTracepoints, getCounters(), strdup(tracepoint));
}
@@ -237,18 +193,20 @@ bool PerfDriver::setup() {
// Check the kernel version
int release[3];
if (!getLinuxVersion(release)) {
- logg->logMessage("getLinuxVersion failed");
+ logg.logMessage("getLinuxVersion failed");
return false;
}
- if (KERNEL_VERSION(release[0], release[1], release[2]) < KERNEL_VERSION(3, 4, 0)) {
- logg->logMessage("Unsupported kernel version");
+ const int kernelVersion = KERNEL_VERSION(release[0], release[1], release[2]);
+ if (kernelVersion < KERNEL_VERSION(3, 4, 0)) {
+ logg.logSetup("Unsupported kernel version\nPlease upgrade to 3.4 or later");
return false;
}
- mLegacySupport = KERNEL_VERSION(release[0], release[1], release[2]) < KERNEL_VERSION(3, 12, 0);
+ mLegacySupport = kernelVersion < KERNEL_VERSION(3, 12, 0);
+ mClockidSupport = kernelVersion >= KERNEL_VERSION(4, 2, 0);
if (access(EVENTS_PATH, R_OK) != 0) {
- logg->logMessage(EVENTS_PATH " does not exist, is CONFIG_TRACING and CONFIG_CONTEXT_SWITCH_TRACER enabled?");
+ logg.logSetup(EVENTS_PATH " does not exist\nIs CONFIG_TRACING and CONFIG_CONTEXT_SWITCH_TRACER enabled?");
return false;
}
@@ -256,99 +214,85 @@ bool PerfDriver::setup() {
bool foundCpu = false;
DIR *dir = opendir(PERF_DEVICES);
if (dir == NULL) {
- logg->logMessage("opendir failed");
+ logg.logMessage("opendir failed");
return false;
}
struct dirent *dirent;
while ((dirent = readdir(dir)) != NULL) {
- logg->logMessage("perf pmu: %s", dirent->d_name);
- for (int i = 0; i < ARRAY_LENGTH(gator_cpus); ++i) {
- const struct gator_cpu *const gator_cpu = &gator_cpus[i];
-
- // Do the names match exactly?
- if (strcasecmp(gator_cpu->pmnc_name, dirent->d_name) != 0 &&
- // Do these names match but have the old vs new prefix?
- ((strncasecmp(dirent->d_name, OLD_PMU_PREFIX, sizeof(OLD_PMU_PREFIX) - 1) != 0 ||
- strncasecmp(gator_cpu->pmnc_name, NEW_PMU_PREFIX, sizeof(NEW_PMU_PREFIX) - 1) != 0 ||
- strcasecmp(dirent->d_name + sizeof(OLD_PMU_PREFIX) - 1, gator_cpu->pmnc_name + sizeof(NEW_PMU_PREFIX) - 1) != 0))) {
- continue;
- }
-
+ logg.logMessage("perf pmu: %s", dirent->d_name);
+ GatorCpu *gatorCpu = GatorCpu::find(dirent->d_name);
+ if (gatorCpu != NULL) {
int type;
char buf[256];
snprintf(buf, sizeof(buf), PERF_DEVICES "/%s/type", dirent->d_name);
- if (DriverSource::readIntDriver(buf, &type) != 0) {
+ if (DriverSource::readIntDriver(buf, &type) == 0) {
+ foundCpu = true;
+ logg.logMessage("Adding cpu counters for %s with type %i", gatorCpu->getCoreName(), type);
+ addCpuCounters(gatorCpu->getPmncName(), type, gatorCpu->getPmncCounters());
continue;
}
-
- foundCpu = true;
- logg->logMessage("Adding cpu counters for %s with type %i", gator_cpu->pmnc_name, type);
- addCpuCounters(gator_cpu->pmnc_name, type, gator_cpu->pmnc_counters);
}
- for (int i = 0; i < ARRAY_LENGTH(uncore_counters); ++i) {
- if (strcmp(dirent->d_name, uncore_counters[i].perfName) != 0) {
- continue;
- }
-
+ UncorePmu *uncorePmu = UncorePmu::find(dirent->d_name);
+ if (uncorePmu != NULL) {
int type;
char buf[256];
snprintf(buf, sizeof(buf), PERF_DEVICES "/%s/type", dirent->d_name);
- if (DriverSource::readIntDriver(buf, &type) != 0) {
+ if (DriverSource::readIntDriver(buf, &type) == 0) {
+ logg.logMessage("Adding uncore counters for %s with type %i", uncorePmu->getCoreName(), type);
+ addUncoreCounters(uncorePmu->getCoreName(), type, uncorePmu->getPmncCounters(), uncorePmu->getHasCyclesCounter());
continue;
}
-
- logg->logMessage("Adding uncore counters for %s with type %i", uncore_counters[i].gatorName, type);
- addUncoreCounters(uncore_counters[i].gatorName, type, uncore_counters[i].count, uncore_counters[i].hasCyclesCounter);
}
}
closedir(dir);
if (!foundCpu) {
- // If no cpu was found based on pmu names, try by cpuid
- for (int i = 0; i < ARRAY_LENGTH(gator_cpus); ++i) {
- if (gSessionData->mMaxCpuId != gator_cpus[i].cpuid) {
- continue;
- }
-
+ GatorCpu *gatorCpu = GatorCpu::find(gSessionData.mMaxCpuId);
+ if (gatorCpu != NULL) {
foundCpu = true;
- logg->logMessage("Adding cpu counters (based on cpuid) for %s", gator_cpus[i].pmnc_name);
- addCpuCounters(gator_cpus[i].pmnc_name, PERF_TYPE_RAW, gator_cpus[i].pmnc_counters);
+ logg.logMessage("Adding cpu counters (based on cpuid) for %s", gatorCpu->getCoreName());
+ addCpuCounters(gatorCpu->getPmncName(), PERF_TYPE_RAW, gatorCpu->getPmncCounters());
}
}
+#if defined(__arm__) || defined(__aarch64__)
if (!foundCpu) {
- // If all else fails, use the ARM architected counters
- logg->logMessage("Using Other cpu");
+ logg.logSetup("CPU is not recognized\nUsing the ARM architected counters");
addCpuCounters("Other", PERF_TYPE_RAW, 6);
}
+#else
+ logg.logSetup("CPU is not recognized\nOmitting CPU counters");
+#endif
// Add supported software counters
long long id;
DynBuf printb;
- id = getTracepointId("irq/softirq_exit", &printb);
+ id = getTracepointId("Linux_irq_softirq", "irq/softirq_exit", &printb);
if (id >= 0) {
- setCounters(new PerfCounter(getCounters(), "Linux_irq_softirq", PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU, 0));
+ setCounters(new PerfCounter(getCounters(), strdup("Linux_irq_softirq"), PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU, 0));
}
- id = getTracepointId("irq/irq_handler_exit", &printb);
+ id = getTracepointId("Linux_irq_irq", "irq/irq_handler_exit", &printb);
if (id >= 0) {
- setCounters(new PerfCounter(getCounters(), "Linux_irq_irq", PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU, 0));
+ setCounters(new PerfCounter(getCounters(), strdup("Linux_irq_irq"), PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU, 0));
}
- id = getTracepointId(SCHED_SWITCH, &printb);
+ id = getTracepointId("Linux_sched_switch", SCHED_SWITCH, &printb);
if (id >= 0) {
- setCounters(new PerfCounter(getCounters(), "Linux_sched_switch", PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU, 0));
+ setCounters(new PerfCounter(getCounters(), strdup("Linux_sched_switch"), PERF_TYPE_TRACEPOINT, id, PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU, 0));
}
- id = getTracepointId(CPU_FREQUENCY, &printb);
+ id = getTracepointId("Linux_power_cpu_freq", CPU_FREQUENCY, &printb);
if (id >= 0 && access("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq", R_OK) == 0) {
setCounters(new CPUFreqDriver(getCounters(), id));
}
- setCounters(new PerfCounter(getCounters(), "Linux_cpu_wait_contention", TYPE_DERIVED, -1, 0, 0, 0));
+ setCounters(new PerfCounter(getCounters(), strdup("Linux_cpu_wait_contention"), TYPE_DERIVED, -1, 0, 0, 0));
+ setCounters(new PerfCounter(getCounters(), strdup("Linux_cpu_system"), TYPE_DERIVED, -1, 0, 0, 0));
+ setCounters(new PerfCounter(getCounters(), strdup("Linux_cpu_user"), TYPE_DERIVED, -1, 0, 0, 0));
//Linux_cpu_wait_io
@@ -359,7 +303,7 @@ bool PerfDriver::setup() {
bool PerfDriver::summary(Buffer *const buffer) {
struct utsname utsname;
if (uname(&utsname) != 0) {
- logg->logMessage("uname failed");
+ logg.logMessage("uname failed");
return false;
}
@@ -368,24 +312,24 @@ bool PerfDriver::summary(Buffer *const buffer) {
long pageSize = sysconf(_SC_PAGESIZE);
if (pageSize < 0) {
- logg->logMessage("sysconf _SC_PAGESIZE failed");
+ logg.logMessage("sysconf _SC_PAGESIZE failed");
return false;
}
struct timespec ts;
if (clock_gettime(CLOCK_REALTIME, &ts) != 0) {
- logg->logMessage("clock_gettime failed");
+ logg.logMessage("clock_gettime failed");
return false;
}
const int64_t timestamp = (int64_t)ts.tv_sec * NS_PER_S + ts.tv_nsec;
const uint64_t monotonicStarted = getTime();
- gSessionData->mMonotonicStarted = monotonicStarted;
- const uint64_t currTime = 0;//getTime() - gSessionData->mMonotonicStarted;
+ gSessionData.mMonotonicStarted = monotonicStarted;
+ const uint64_t currTime = 0;//getTime() - gSessionData.mMonotonicStarted;
- buffer->summary(currTime, timestamp, monotonicStarted, monotonicStarted, buf, pageSize);
+ buffer->summary(currTime, timestamp, monotonicStarted, monotonicStarted, buf, pageSize, getClockidSupport());
- for (int i = 0; i < gSessionData->mCores; ++i) {
+ for (int i = 0; i < gSessionData.mCores; ++i) {
coreName(currTime, buffer, i);
}
buffer->commit(currTime);
@@ -394,20 +338,15 @@ bool PerfDriver::summary(Buffer *const buffer) {
}
void PerfDriver::coreName(const uint64_t currTime, Buffer *const buffer, const int cpu) {
- const SharedData *const sharedData = gSessionData->mSharedData;
+ const SharedData *const sharedData = gSessionData.mSharedData;
// Don't send information on a cpu we know nothing about
if (sharedData->mCpuIds[cpu] == -1) {
return;
}
- int j;
- for (j = 0; j < ARRAY_LENGTH(gator_cpus); ++j) {
- if (gator_cpus[j].cpuid == sharedData->mCpuIds[cpu]) {
- break;
- }
- }
- if (j < ARRAY_LENGTH(gator_cpus) && gator_cpus[j].cpuid == sharedData->mCpuIds[cpu]) {
- buffer->coreName(currTime, cpu, sharedData->mCpuIds[cpu], gator_cpus[j].core_name);
+ GatorCpu *gatorCpu = GatorCpu::find(sharedData->mCpuIds[cpu]);
+ if (gatorCpu != NULL && gatorCpu->getCpuid() == sharedData->mCpuIds[cpu]) {
+ buffer->coreName(currTime, cpu, sharedData->mCpuIds[cpu], gatorCpu->getCoreName());
} else {
char buf[32];
if (sharedData->mCpuIds[cpu] == -1) {
@@ -444,7 +383,7 @@ bool PerfDriver::enable(const uint64_t currTime, PerfGroup *const group, Buffer
for (PerfCounter *counter = static_cast<PerfCounter *>(getCounters()); counter != NULL; counter = static_cast<PerfCounter *>(counter->getNext())) {
if (counter->isEnabled() && (counter->getType() != TYPE_DERIVED) &&
!group->add(currTime, buffer, counter->getKey(), counter->getType(), counter->getConfig(), counter->getCount(), counter->getSampleType(), counter->getFlags())) {
- logg->logMessage("PerfGroup::add failed");
+ logg.logMessage("PerfGroup::add failed");
return false;
}
}
@@ -463,11 +402,11 @@ void PerfDriver::read(Buffer *const buffer, const int cpu) {
static bool sendTracepointFormat(const uint64_t currTime, Buffer *const buffer, const char *const name, DynBuf *const printb, DynBuf *const b) {
if (!printb->printf(EVENTS_PATH "/%s/format", name)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
return false;
}
if (!b->read(printb->getBuf())) {
- logg->logMessage("DynBuf::read failed");
+ logg.logMessage("DynBuf::read failed");
return false;
}
buffer->marshalFormat(currTime, b->getLength(), b->getBuf());
@@ -495,13 +434,13 @@ bool PerfDriver::sendTracepointFormats(const uint64_t currTime, Buffer *const bu
long long PerfDriver::getTracepointId(const char *const name, DynBuf *const printb) {
if (!printb->printf(EVENTS_PATH "/%s/id", name)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
return -1;
}
int64_t result;
if (DriverSource::readInt64Driver(printb->getBuf(), &result) != 0) {
- logg->logMessage("Unable to read tracepoint id for %s", printb->getBuf());
+ logg.logMessage("Unable to read tracepoint id for %s", printb->getBuf());
return -1;
}
diff --git a/tools/gator/daemon/PerfDriver.h b/tools/gator/daemon/PerfDriver.h
index a38fcde06e89..c6d81263e8ec 100644
--- a/tools/gator/daemon/PerfDriver.h
+++ b/tools/gator/daemon/PerfDriver.h
@@ -28,6 +28,7 @@ public:
~PerfDriver();
bool getLegacySupport() const { return mLegacySupport; }
+ bool getClockidSupport() const { return mClockidSupport; }
void readEvents(mxml_node_t *const xml);
bool setup();
@@ -42,13 +43,16 @@ public:
bool sendTracepointFormats(const uint64_t currTime, Buffer *const buffer, DynBuf *const printb, DynBuf *const b);
static long long getTracepointId(const char *const name, DynBuf *const printb);
+ static long long getTracepointId(const char *const counter, const char *const name, DynBuf *const printb);
private:
void addCpuCounters(const char *const counterName, const int type, const int numCounters);
void addUncoreCounters(const char *const counterName, const int type, const int numCounters, const bool hasCyclesCounter);
- bool mIsSetup;
- bool mLegacySupport;
+ int mIsSetup : 1,
+ mLegacySupport : 1,
+ mClockidSupport : 1,
+ mUnused0 : 29;
PerfTracepoint *mTracepoints;
// Intentionally undefined
diff --git a/tools/gator/daemon/PerfGroup.cpp b/tools/gator/daemon/PerfGroup.cpp
index 9b71531d2b1c..25999e55b662 100644
--- a/tools/gator/daemon/PerfGroup.cpp
+++ b/tools/gator/daemon/PerfGroup.cpp
@@ -28,7 +28,7 @@ static const int schedSwitchKey = getEventKey();
#define DEFAULT_PEA_ARGS(pea, additionalSampleType) \
pea.size = sizeof(pea); \
/* Emit time, read_format below, group leader id, and raw tracepoint info */ \
- pea.sample_type = (gSessionData->mPerf.getLegacySupport() \
+ pea.sample_type = (gSessionData.mPerf.getLegacySupport() \
? PERF_SAMPLE_TID | PERF_SAMPLE_IP | PERF_SAMPLE_ID \
: PERF_SAMPLE_IDENTIFIER ) | PERF_SAMPLE_TIME | additionalSampleType; \
/* Emit emit value in group format */ \
@@ -38,7 +38,10 @@ static const int schedSwitchKey = getEventKey();
/* have a sampling interrupt happen when we cross the wakeup_watermark boundary */ \
pea.watermark = 1; \
/* Be conservative in flush size as only one buffer set is monitored */ \
- pea.wakeup_watermark = BUF_SIZE / 2
+ pea.wakeup_watermark = BUF_SIZE / 2; \
+ /* Use the monotonic raw clock if possible */ \
+ pea.use_clockid = gSessionData.mPerf.getClockidSupport() ? 1 : 0; \
+ pea.clockid = gSessionData.mPerf.getClockidSupport() ? CLOCK_MONOTONIC_RAW : 0
static int sys_perf_event_open(struct perf_event_attr *const attr, const pid_t pid, const int cpu, const int group_fd, const unsigned long flags) {
int fd = syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);
@@ -78,7 +81,7 @@ int PerfGroup::doAdd(const uint64_t currTime, Buffer *const buffer, const int ke
}
if (i >= ARRAY_LENGTH(mKeys)) {
- logg->logMessage("Too many counters");
+ logg.logMessage("Too many counters");
return -1;
}
@@ -111,7 +114,7 @@ int PerfGroup::doAdd(const uint64_t currTime, Buffer *const buffer, const int ke
int PerfGroup::getEffectiveType(const int type, const int flags) {
const int effectiveType = flags & PERF_GROUP_CPU ? (int)PERF_TYPE_HARDWARE : type;
if (effectiveType >= ARRAY_LENGTH(mLeaders)) {
- logg->logError("perf type is too large, please increase the size of PerfGroup::mLeaders");
+ logg.logError("perf type is too large, please increase the size of PerfGroup::mLeaders");
handleException();
}
return effectiveType;
@@ -122,7 +125,7 @@ bool PerfGroup::createCpuGroup(const uint64_t currTime, Buffer *const buffer) {
DynBuf b;
mSchedSwitchId = PerfDriver::getTracepointId(SCHED_SWITCH, &b);
if (mSchedSwitchId < 0) {
- logg->logMessage("Unable to read sched_switch id");
+ logg.logMessage("Unable to read sched_switch id");
return false;
}
}
@@ -132,7 +135,7 @@ bool PerfGroup::createCpuGroup(const uint64_t currTime, Buffer *const buffer) {
return false;
}
- if (gSessionData->mSampleRate > 0 && !gSessionData->mIsEBS && doAdd(currTime, buffer, INT_MAX-PERF_TYPE_HARDWARE, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK, 1000000000UL / gSessionData->mSampleRate, PERF_SAMPLE_TID | PERF_SAMPLE_IP | PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU) < 0) {
+ if (gSessionData.mSampleRate > 0 && !gSessionData.mIsEBS && doAdd(currTime, buffer, INT_MAX-PERF_TYPE_HARDWARE, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK, 1000000000UL / gSessionData.mSampleRate, PERF_SAMPLE_TID | PERF_SAMPLE_IP | PERF_SAMPLE_READ, PERF_GROUP_PER_CPU | PERF_GROUP_CPU) < 0) {
return false;
}
@@ -151,7 +154,7 @@ bool PerfGroup::add(const uint64_t currTime, Buffer *const buffer, const int key
}
} else {
// Non-CPU PMUs are sampled every 100ms for Sample Rate: None and EBS, otherwise they would never be sampled
- const uint64_t timeout = gSessionData->mSampleRate > 0 && !gSessionData->mIsEBS ? 1000000000UL / gSessionData->mSampleRate : 100000000UL;
+ const uint64_t timeout = gSessionData.mSampleRate > 0 && !gSessionData.mIsEBS ? 1000000000UL / gSessionData.mSampleRate : 100000000UL;
mLeaders[effectiveType] = doAdd(currTime, buffer, INT_MAX-effectiveType, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK, timeout, PERF_SAMPLE_READ, PERF_GROUP_LEADER);
if (mLeaders[effectiveType] < 0) {
return false;
@@ -160,7 +163,7 @@ bool PerfGroup::add(const uint64_t currTime, Buffer *const buffer, const int key
}
if (!(flags & PERF_GROUP_LEADER) && effectiveType != PERF_TYPE_HARDWARE && (flags & PERF_GROUP_PER_CPU)) {
- logg->logError("'uncore' counters are not permitted to be per-cpu");
+ logg.logError("'uncore' counters are not permitted to be per-cpu");
handleException();
}
@@ -168,7 +171,7 @@ bool PerfGroup::add(const uint64_t currTime, Buffer *const buffer, const int key
}
int PerfGroup::prepareCPU(const int cpu, Monitor *const monitor) {
- logg->logMessage("Onlining cpu %i", cpu);
+ logg.logMessage("Onlining cpu %i", cpu);
for (int i = 0; i < ARRAY_LENGTH(mKeys); ++i) {
if (mKeys[i] < 0) {
@@ -179,16 +182,16 @@ int PerfGroup::prepareCPU(const int cpu, Monitor *const monitor) {
continue;
}
- const int offset = i * gSessionData->mCores + cpu;
+ const int offset = i * gSessionData.mCores + cpu;
if (mFds[offset] >= 0) {
- logg->logMessage("cpu already online or not correctly cleaned up");
+ logg.logMessage("cpu already online or not correctly cleaned up");
return PG_FAILURE;
}
- logg->logMessage("perf_event_open cpu: %i type: %i config: %lli sample: %lli sample_type: 0x%llx pinned: %lli mmap: %lli comm: %lli freq: %lli task: %lli sample_id_all: %lli", cpu, mAttrs[i].type, mAttrs[i].config, mAttrs[i].sample_period, mAttrs[i].sample_type, mAttrs[i].pinned, mAttrs[i].mmap, mAttrs[i].comm, mAttrs[i].freq, mAttrs[i].task, mAttrs[i].sample_id_all);
- mFds[offset] = sys_perf_event_open(&mAttrs[i], -1, cpu, mAttrs[i].pinned ? -1 : mFds[mLeaders[getEffectiveType(mAttrs[i].type, mFlags[i])] * gSessionData->mCores + cpu], mAttrs[i].pinned ? 0 : PERF_FLAG_FD_OUTPUT);
+ logg.logMessage("perf_event_open cpu: %i type: %i config: %lli sample: %lli sample_type: 0x%llx pinned: %lli mmap: %lli comm: %lli freq: %lli task: %lli sample_id_all: %lli", cpu, mAttrs[i].type, mAttrs[i].config, mAttrs[i].sample_period, mAttrs[i].sample_type, mAttrs[i].pinned, mAttrs[i].mmap, mAttrs[i].comm, mAttrs[i].freq, mAttrs[i].task, mAttrs[i].sample_id_all);
+ mFds[offset] = sys_perf_event_open(&mAttrs[i], -1, cpu, mAttrs[i].pinned ? -1 : mFds[mLeaders[getEffectiveType(mAttrs[i].type, mFlags[i])] * gSessionData.mCores + cpu], mAttrs[i].pinned ? 0 : PERF_FLAG_FD_OUTPUT);
if (mFds[offset] < 0) {
- logg->logMessage("failed %s", strerror(errno));
+ logg.logMessage("failed %s", strerror(errno));
if (errno == ENODEV) {
// The core is offline
return PG_CPU_OFFLINE;
@@ -197,18 +200,18 @@ int PerfGroup::prepareCPU(const int cpu, Monitor *const monitor) {
// This event doesn't apply to this CPU but should apply to a different one, ex bL
continue;
}
- logg->logMessage("perf_event_open failed");
+ logg.logMessage("perf_event_open failed");
return PG_FAILURE;
}
if (!mPb->useFd(cpu, mFds[offset])) {
- logg->logMessage("PerfBuffer::useFd failed");
+ logg.logMessage("PerfBuffer::useFd failed");
return PG_FAILURE;
}
if (!monitor->add(mFds[offset])) {
- logg->logMessage("Monitor::add failed");
+ logg.logMessage("Monitor::add failed");
return PG_FAILURE;
}
}
@@ -220,7 +223,7 @@ static bool readAndSend(const uint64_t currTime, Buffer *const buffer, const int
char buf[1024];
ssize_t bytes = read(fd, buf, sizeof(buf));
if (bytes < 0) {
- logg->logMessage("read failed");
+ logg.logMessage("read failed");
return false;
}
buffer->marshalKeysOld(currTime, keyCount, keys, bytes, buf);
@@ -231,13 +234,13 @@ static bool readAndSend(const uint64_t currTime, Buffer *const buffer, const int
int PerfGroup::onlineCPU(const uint64_t currTime, const int cpu, const bool enable, Buffer *const buffer) {
bool addedEvents = false;
- if (!gSessionData->mPerf.getLegacySupport()) {
+ if (!gSessionData.mPerf.getLegacySupport()) {
int idCount = 0;
int coreKeys[ARRAY_LENGTH(mKeys)];
__u64 ids[ARRAY_LENGTH(mKeys)];
for (int i = 0; i < ARRAY_LENGTH(mKeys); ++i) {
- const int fd = mFds[cpu + i * gSessionData->mCores];
+ const int fd = mFds[cpu + i * gSessionData.mCores];
if (fd < 0) {
continue;
}
@@ -246,7 +249,7 @@ int PerfGroup::onlineCPU(const uint64_t currTime, const int cpu, const bool enab
if (ioctl(fd, PERF_EVENT_IOC_ID, &ids[idCount]) != 0 &&
// Workaround for running 32-bit gatord on 64-bit systems, kernel patch in the works
ioctl(fd, (PERF_EVENT_IOC_ID & ~IOCSIZE_MASK) | (8 << _IOC_SIZESHIFT), &ids[idCount]) != 0) {
- logg->logMessage("ioctl failed");
+ logg.logMessage("ioctl failed");
return 0;
}
++idCount;
@@ -258,7 +261,7 @@ int PerfGroup::onlineCPU(const uint64_t currTime, const int cpu, const bool enab
int idCounts[ARRAY_LENGTH(mLeaders)] = { 0 };
int coreKeys[ARRAY_LENGTH(mLeaders)][ARRAY_LENGTH(mKeys)];
for (int i = 0; i < ARRAY_LENGTH(mKeys); ++i) {
- const int fd = mFds[cpu + i * gSessionData->mCores];
+ const int fd = mFds[cpu + i * gSessionData.mCores];
if (fd < 0) {
continue;
}
@@ -276,7 +279,7 @@ int PerfGroup::onlineCPU(const uint64_t currTime, const int cpu, const bool enab
}
for (int i = 0; i < ARRAY_LENGTH(mLeaders); ++i) {
- if (idCounts[i] > 0 && !readAndSend(currTime, buffer, mFds[mLeaders[i] * gSessionData->mCores + cpu], idCounts[i], coreKeys[i])) {
+ if (idCounts[i] > 0 && !readAndSend(currTime, buffer, mFds[mLeaders[i] * gSessionData.mCores + cpu], idCounts[i], coreKeys[i])) {
return 0;
}
}
@@ -284,28 +287,28 @@ int PerfGroup::onlineCPU(const uint64_t currTime, const int cpu, const bool enab
if (enable) {
for (int i = 0; i < ARRAY_LENGTH(mKeys); ++i) {
- int offset = i * gSessionData->mCores + cpu;
- if (mFds[offset] >= 0 && ioctl(mFds[offset], PERF_EVENT_IOC_ENABLE, 0) < 0) {
- logg->logMessage("ioctl failed");
+ int offset = i * gSessionData.mCores + cpu;
+ if (mFds[offset] >= 0 && ioctl(mFds[offset], PERF_EVENT_IOC_ENABLE, 0) != 0) {
+ logg.logMessage("ioctl failed");
return 0;
}
}
}
if (!addedEvents) {
- logg->logMessage("no events came online");
+ logg.logMessage("no events came online");
}
return 1;
}
bool PerfGroup::offlineCPU(const int cpu) {
- logg->logMessage("Offlining cpu %i", cpu);
+ logg.logMessage("Offlining cpu %i", cpu);
for (int i = ARRAY_LENGTH(mKeys) - 1; i >= 0; --i) {
- int offset = i * gSessionData->mCores + cpu;
- if (mFds[offset] >= 0 && ioctl(mFds[offset], PERF_EVENT_IOC_DISABLE, 0) < 0) {
- logg->logMessage("ioctl failed");
+ int offset = i * gSessionData.mCores + cpu;
+ if (mFds[offset] >= 0 && ioctl(mFds[offset], PERF_EVENT_IOC_DISABLE, 0) != 0) {
+ logg.logMessage("ioctl failed");
return false;
}
}
@@ -318,7 +321,7 @@ bool PerfGroup::offlineCPU(const int cpu) {
continue;
}
- int offset = i * gSessionData->mCores + cpu;
+ int offset = i * gSessionData.mCores + cpu;
if (mFds[offset] >= 0) {
close(mFds[offset]);
mFds[offset] = -1;
@@ -328,20 +331,28 @@ bool PerfGroup::offlineCPU(const int cpu) {
return true;
}
-bool PerfGroup::start() {
+void PerfGroup::start() {
+ char buf[1<<10];
+
for (int pos = 0; pos < ARRAY_LENGTH(mFds); ++pos) {
- if (mFds[pos] >= 0 && ioctl(mFds[pos], PERF_EVENT_IOC_ENABLE, 0) < 0) {
- logg->logMessage("ioctl failed");
- goto fail;
+ if (mFds[pos] >= 0 && ioctl(mFds[pos], PERF_EVENT_IOC_ENABLE, 0) != 0) {
+ logg.logError("Unable to enable a perf event");
+ handleException();
}
}
- return true;
-
- fail:
- stop();
-
- return false;
+ // Try reading from all the group leaders to ensure that the event isn't disabled
+ for (int pos = 0; pos < ARRAY_LENGTH(mAttrs); ++pos) {
+ if (mAttrs[pos].pinned) {
+ for (int cpu = 0; cpu < gSessionData.mCores; ++cpu) {
+ int fd = mFds[pos * gSessionData.mCores + cpu];
+ if (fd >= 0 && read(fd, buf, sizeof(buf)) <= 0) {
+ logg.logError("Unable to read all perf groups, perhaps too many events were enabled");
+ handleException();
+ }
+ }
+ }
+ }
}
void PerfGroup::stop() {
diff --git a/tools/gator/daemon/PerfGroup.h b/tools/gator/daemon/PerfGroup.h
index f30d3a6a9c68..13a18c348603 100644
--- a/tools/gator/daemon/PerfGroup.h
+++ b/tools/gator/daemon/PerfGroup.h
@@ -49,7 +49,7 @@ public:
// Not safe to call concurrently. Returns the number of events enabled
int onlineCPU(const uint64_t currTime, const int cpu, const bool enable, Buffer *const buffer);
bool offlineCPU(int cpu);
- bool start();
+ void start();
void stop();
private:
diff --git a/tools/gator/daemon/PerfSource.cpp b/tools/gator/daemon/PerfSource.cpp
index 9f34bbd1e54f..3c89a9ef05d4 100644
--- a/tools/gator/daemon/PerfSource.cpp
+++ b/tools/gator/daemon/PerfSource.cpp
@@ -36,7 +36,7 @@ static const int cpuIdleKey = getEventKey();
static void *syncFunc(void *arg)
{
struct timespec ts;
- int64_t nextTime = gSessionData->mMonotonicStarted;
+ int64_t nextTime = gSessionData.mMonotonicStarted;
int err;
(void)arg;
@@ -46,18 +46,18 @@ static void *syncFunc(void *arg)
{
sigset_t set;
if (sigfillset(&set) != 0) {
- logg->logError("sigfillset failed");
+ logg.logError("sigfillset failed");
handleException();
}
if ((err = pthread_sigmask(SIG_SETMASK, &set, NULL)) != 0) {
- logg->logError("pthread_sigmask failed");
+ logg.logError("pthread_sigmask failed");
handleException();
}
}
for (;;) {
if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) != 0) {
- logg->logError("clock_gettime failed");
+ logg.logError("clock_gettime failed");
handleException();
}
const int64_t currTime = ts.tv_sec * NS_PER_S + ts.tv_nsec;
@@ -83,7 +83,7 @@ static void *syncFunc(void *arg)
static long getMaxCoreNum() {
DIR *dir = opendir("/sys/devices/system/cpu");
if (dir == NULL) {
- logg->logError("Unable to determine the number of cores on the target, opendir failed");
+ logg.logError("Unable to determine the number of cores on the target, opendir failed");
handleException();
}
@@ -102,12 +102,12 @@ static long getMaxCoreNum() {
closedir(dir);
if (maxCoreNum < 1) {
- logg->logError("Unable to determine the number of cores on the target, no cpu# directories found");
+ logg.logError("Unable to determine the number of cores on the target, no cpu# directories found");
handleException();
}
if (maxCoreNum >= NR_CPUS) {
- logg->logError("Too many cores on the target, please increase NR_CPUS in Config.h");
+ logg.logError("Too many cores on the target, please increase NR_CPUS in Config.h");
handleException();
}
@@ -117,11 +117,11 @@ static long getMaxCoreNum() {
PerfSource::PerfSource(sem_t *senderSem, sem_t *startProfile) : mSummary(0, FRAME_SUMMARY, 1024, senderSem), mBuffer(NULL), mCountersBuf(), mCountersGroup(&mCountersBuf), mMonitor(), mUEvent(), mSenderSem(senderSem), mStartProfile(startProfile), mInterruptFd(-1), mIsDone(false) {
long l = sysconf(_SC_PAGE_SIZE);
if (l < 0) {
- logg->logError("Unable to obtain the page size");
+ logg.logError("Unable to obtain the page size");
handleException();
}
- gSessionData->mPageSize = static_cast<int>(l);
- gSessionData->mCores = static_cast<int>(getMaxCoreNum());
+ gSessionData.mPageSize = static_cast<int>(l);
+ gSessionData.mCores = static_cast<int>(getMaxCoreNum());
}
PerfSource::~PerfSource() {
@@ -134,12 +134,12 @@ bool PerfSource::prepare() {
long long cpuIdleId;
// MonotonicStarted has not yet been assigned!
- const uint64_t currTime = 0;//getTime() - gSessionData->mMonotonicStarted;
+ const uint64_t currTime = 0;//getTime() - gSessionData.mMonotonicStarted;
- mBuffer = new Buffer(0, FRAME_PERF_ATTRS, gSessionData->mTotalBufferSize*1024*1024, mSenderSem);
+ mBuffer = new Buffer(0, FRAME_PERF_ATTRS, gSessionData.mTotalBufferSize*1024*1024, mSenderSem);
// Reread cpuinfo since cores may have changed since startup
- gSessionData->readCpuInfo();
+ gSessionData.readCpuInfo();
if (0
|| !mMonitor.init()
@@ -148,51 +148,57 @@ bool PerfSource::prepare() {
|| (cpuIdleId = PerfDriver::getTracepointId(CPU_IDLE, &printb)) < 0
- || !gSessionData->mPerf.sendTracepointFormats(currTime, mBuffer, &printb, &b1)
+ || !gSessionData.mPerf.sendTracepointFormats(currTime, mBuffer, &printb, &b1)
|| !mCountersGroup.createCpuGroup(currTime, mBuffer)
|| !mCountersGroup.add(currTime, mBuffer, cpuIdleKey, PERF_TYPE_TRACEPOINT, cpuIdleId, 1, PERF_SAMPLE_RAW, PERF_GROUP_LEADER | PERF_GROUP_PER_CPU)
- || !gSessionData->mPerf.enable(currTime, &mCountersGroup, mBuffer)
+ || !gSessionData.mPerf.enable(currTime, &mCountersGroup, mBuffer)
|| 0) {
- logg->logMessage("perf setup failed, are you running Linux 3.4 or later?");
+ logg.logMessage("perf setup failed, are you running Linux 3.4 or later?");
return false;
}
- for (int cpu = 0; cpu < gSessionData->mCores; ++cpu) {
+ for (int cpu = 0; cpu < gSessionData.mCores; ++cpu) {
const int result = mCountersGroup.prepareCPU(cpu, &mMonitor);
if ((result != PG_SUCCESS) && (result != PG_CPU_OFFLINE)) {
- logg->logError("PerfGroup::prepareCPU on mCountersGroup failed");
+ logg.logError("PerfGroup::prepareCPU on mCountersGroup failed");
handleException();
}
}
int numEvents = 0;
- for (int cpu = 0; cpu < gSessionData->mCores; ++cpu) {
+ for (int cpu = 0; cpu < gSessionData.mCores; ++cpu) {
numEvents += mCountersGroup.onlineCPU(currTime, cpu, false, mBuffer);
}
if (numEvents <= 0) {
- logg->logMessage("PerfGroup::onlineCPU failed on all cores");
+ logg.logMessage("PerfGroup::onlineCPU failed on all cores");
return false;
}
// Send the summary right before the start so that the monotonic delta is close to the start time
- if (!gSessionData->mPerf.summary(&mSummary)) {
- logg->logError("PerfDriver::summary failed");
+ if (!gSessionData.mPerf.summary(&mSummary)) {
+ logg.logError("PerfDriver::summary failed");
handleException();
}
- // Start the timer thread to used to sync perf and monotonic raw times
- pthread_t syncThread;
- if (pthread_create(&syncThread, NULL, syncFunc, NULL)) {
- logg->logError("pthread_create failed");
- handleException();
- }
- struct sched_param param;
- param.sched_priority = sched_get_priority_max(SCHED_FIFO);
- if (pthread_setschedparam(syncThread, SCHED_FIFO | SCHED_RESET_ON_FORK, &param) != 0) {
- logg->logError("pthread_setschedparam failed");
- handleException();
+ if (!gSessionData.mPerf.getClockidSupport()) {
+ // Start the timer thread to used to sync perf and monotonic raw times
+ pthread_t syncThread;
+ if (pthread_create(&syncThread, NULL, syncFunc, NULL)) {
+ logg.logError("pthread_create failed");
+ handleException();
+ }
+ struct sched_param param;
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ if (pthread_setschedparam(syncThread, SCHED_FIFO | SCHED_RESET_ON_FORK, &param) != 0) {
+ logg.logMessage("Unable to schedule sync thread as FIFO, trying OTHER");
+ param.sched_priority = sched_get_priority_max(SCHED_OTHER);
+ if (pthread_setschedparam(syncThread, SCHED_OTHER | SCHED_RESET_ON_FORK, &param) != 0) {
+ logg.logError("pthread_setschedparam failed");
+ handleException();
+ }
+ }
}
mBuffer->commit(currTime);
@@ -215,17 +221,17 @@ void *procFunc(void *arg) {
// Gator runs at a high priority, reset the priority to the default
if (setpriority(PRIO_PROCESS, syscall(__NR_gettid), 0) == -1) {
- logg->logError("setpriority failed");
+ logg.logError("setpriority failed");
handleException();
}
if (!readProcMaps(args->mCurrTime, args->mBuffer, &printb, &b)) {
- logg->logError("readProcMaps failed");
+ logg.logError("readProcMaps failed");
handleException();
}
if (!readKallsyms(args->mCurrTime, args->mBuffer, &args->mIsDone)) {
- logg->logError("readKallsyms failed");
+ logg.logError("readKallsyms failed");
handleException();
}
args->mBuffer->commit(args->mCurrTime);
@@ -241,13 +247,13 @@ void PerfSource::run() {
ProcThreadArgs procThreadArgs;
if (pipe_cloexec(pipefd) != 0) {
- logg->logError("pipe failed");
+ logg.logError("pipe failed");
handleException();
}
mInterruptFd = pipefd[1];
if (!mMonitor.add(pipefd[0])) {
- logg->logError("Monitor::add failed");
+ logg.logError("Monitor::add failed");
handleException();
}
@@ -256,22 +262,19 @@ void PerfSource::run() {
DynBuf b1;
DynBuf b2;
- const uint64_t currTime = getTime() - gSessionData->mMonotonicStarted;
+ const uint64_t currTime = getTime() - gSessionData.mMonotonicStarted;
// Start events before reading proc to avoid race conditions
- if (!mCountersGroup.start()) {
- logg->logError("PerfGroup::start failed");
- handleException();
- }
+ mCountersGroup.start();
mBuffer->perfCounterHeader(currTime);
- for (int cpu = 0; cpu < gSessionData->mCores; ++cpu) {
- gSessionData->mPerf.read(mBuffer, cpu);
+ for (int cpu = 0; cpu < gSessionData.mCores; ++cpu) {
+ gSessionData.mPerf.read(mBuffer, cpu);
}
mBuffer->perfCounterFooter(currTime);
if (!readProcComms(currTime, mBuffer, &printb, &b1, &b2)) {
- logg->logError("readProcComms failed");
+ logg.logError("readProcComms failed");
handleException();
}
mBuffer->commit(currTime);
@@ -281,7 +284,7 @@ void PerfSource::run() {
procThreadArgs.mCurrTime = currTime;
procThreadArgs.mIsDone = false;
if (pthread_create(&procThread, NULL, procFunc, &procThreadArgs)) {
- logg->logError("pthread_create failed");
+ logg.logError("pthread_create failed");
handleException();
}
}
@@ -289,23 +292,23 @@ void PerfSource::run() {
sem_post(mStartProfile);
const uint64_t NO_RATE = ~0ULL;
- const uint64_t rate = gSessionData->mLiveRate > 0 && gSessionData->mSampleRate > 0 ? gSessionData->mLiveRate : NO_RATE;
+ const uint64_t rate = gSessionData.mLiveRate > 0 && gSessionData.mSampleRate > 0 ? gSessionData.mLiveRate : NO_RATE;
uint64_t nextTime = 0;
int timeout = rate != NO_RATE ? 0 : -1;
- while (gSessionData->mSessionIsActive) {
+ while (gSessionData.mSessionIsActive) {
// +1 for uevents, +1 for pipe
struct epoll_event events[NR_CPUS + 2];
int ready = mMonitor.wait(events, ARRAY_LENGTH(events), timeout);
if (ready < 0) {
- logg->logError("Monitor::wait failed");
+ logg.logError("Monitor::wait failed");
handleException();
}
- const uint64_t currTime = getTime() - gSessionData->mMonotonicStarted;
+ const uint64_t currTime = getTime() - gSessionData.mMonotonicStarted;
for (int i = 0; i < ready; ++i) {
if (events[i].data.fd == mUEvent.getFd()) {
if (!handleUEvent(currTime)) {
- logg->logError("PerfSource::handleUEvent failed");
+ logg.logError("PerfSource::handleUEvent failed");
handleException();
}
break;
@@ -316,8 +319,8 @@ void PerfSource::run() {
sem_post(mSenderSem);
// In one shot mode, stop collection once all the buffers are filled
- if (gSessionData->mOneShot && gSessionData->mSessionIsActive && ((mSummary.bytesAvailable() <= 0) || (mBuffer->bytesAvailable() <= 0) || mCountersBuf.isFull())) {
- logg->logMessage("One shot (perf)");
+ if (gSessionData.mOneShot && gSessionData.mSessionIsActive && ((mSummary.bytesAvailable() <= 0) || (mBuffer->bytesAvailable() <= 0) || mCountersBuf.isFull())) {
+ logg.logMessage("One shot (perf)");
child->endSession();
}
@@ -326,7 +329,7 @@ void PerfSource::run() {
nextTime += rate;
}
// + NS_PER_MS - 1 to ensure always rounding up
- timeout = max(0, (int)((nextTime + NS_PER_MS - 1 - getTime() + gSessionData->mMonotonicStarted)/NS_PER_MS));
+ timeout = max(0, (int)((nextTime + NS_PER_MS - 1 - getTime() + gSessionData.mMonotonicStarted)/NS_PER_MS));
}
}
@@ -347,25 +350,25 @@ void PerfSource::run() {
bool PerfSource::handleUEvent(const uint64_t currTime) {
UEventResult result;
if (!mUEvent.read(&result)) {
- logg->logMessage("UEvent::Read failed");
+ logg.logMessage("UEvent::Read failed");
return false;
}
if (strcmp(result.mSubsystem, "cpu") == 0) {
if (strncmp(result.mDevPath, CPU_DEVPATH, sizeof(CPU_DEVPATH) - 1) != 0) {
- logg->logMessage("Unexpected cpu DEVPATH format");
+ logg.logMessage("Unexpected cpu DEVPATH format");
return false;
}
char *endptr;
errno = 0;
int cpu = strtol(result.mDevPath + sizeof(CPU_DEVPATH) - 1, &endptr, 10);
if (errno != 0 || *endptr != '\0') {
- logg->logMessage("strtol failed");
+ logg.logMessage("strtol failed");
return false;
}
- if (cpu >= gSessionData->mCores) {
- logg->logError("Only %i cores are expected but core %i reports %s", gSessionData->mCores, cpu, result.mAction);
+ if (cpu >= gSessionData.mCores) {
+ logg.logError("Only %i cores are expected but core %i reports %s", gSessionData.mCores, cpu, result.mAction);
handleException();
}
@@ -379,15 +382,15 @@ bool PerfSource::handleUEvent(const uint64_t currTime) {
} else if (err == PG_SUCCESS) {
if (mCountersGroup.onlineCPU(currTime, cpu, true, mBuffer) > 0) {
mBuffer->perfCounterHeader(currTime);
- gSessionData->mPerf.read(mBuffer, cpu);
+ gSessionData.mPerf.read(mBuffer, cpu);
mBuffer->perfCounterFooter(currTime);
ret = true;
}
}
mBuffer->commit(currTime);
- gSessionData->readCpuInfo();
- gSessionData->mPerf.coreName(currTime, &mSummary, cpu);
+ gSessionData.readCpuInfo();
+ gSessionData.mPerf.coreName(currTime, &mSummary, cpu);
mSummary.commit(currTime);
return ret;
} else if (strcmp(result.mAction, "offline") == 0) {
@@ -405,7 +408,7 @@ void PerfSource::interrupt() {
int8_t c = 0;
// Write to the pipe to wake the monitor which will cause mSessionIsActive to be reread
if (::write(mInterruptFd, &c, sizeof(c)) != sizeof(c)) {
- logg->logError("write failed");
+ logg.logError("write failed");
handleException();
}
}
@@ -418,13 +421,13 @@ bool PerfSource::isDone () {
void PerfSource::write (Sender *sender) {
if (!mSummary.isDone()) {
mSummary.write(sender);
- gSessionData->mSentSummary = true;
+ gSessionData.mSentSummary = true;
}
if (!mBuffer->isDone()) {
mBuffer->write(sender);
}
if (!mCountersBuf.send(sender)) {
- logg->logError("PerfBuffer::send failed");
+ logg.logError("PerfBuffer::send failed");
handleException();
}
}
diff --git a/tools/gator/daemon/PmuXML.cpp b/tools/gator/daemon/PmuXML.cpp
new file mode 100644
index 000000000000..68599920afad
--- /dev/null
+++ b/tools/gator/daemon/PmuXML.cpp
@@ -0,0 +1,138 @@
+/**
+ * Copyright (C) ARM Limited 2010-2015. 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 "PmuXML.h"
+
+#include <unistd.h>
+
+#include "mxml/mxml.h"
+
+#include "DriverSource.h"
+#include "Logging.h"
+#include "OlyUtility.h"
+#include "SessionData.h"
+
+static const char TAG_PMUS[] = "pmus";
+static const char TAG_PMU[] = "pmu";
+static const char TAG_UNCORE_PMU[] = "uncore_pmu";
+
+static const char ATTR_PMNC_NAME[] = "pmnc_name";
+static const char ATTR_CPUID[] = "cpuid";
+static const char ATTR_CORE_NAME[] = "core_name";
+static const char ATTR_DT_NAME[] = "dt_name";
+static const char ATTR_PMNC_COUNTERS[] = "pmnc_counters";
+static const char ATTR_HAS_CYCLES_COUNTER[] = "has_cycles_counter";
+
+PmuXML::PmuXML() {
+}
+
+PmuXML::~PmuXML() {
+}
+
+void PmuXML::read(const char *const path) {
+ {
+ const char *xml;
+ unsigned int len;
+ getDefaultXml(&xml, &len);
+ parse(xml);
+ }
+
+ if (path != NULL) {
+ // Parse user defined items second as they will show up first in the linked list
+ char *xml = readFromDisk(path);
+ if (xml == NULL) {
+ logg.logError("Unable to open additional pmus XML %s", path);
+ handleException();
+ }
+ parse(xml);
+ free(xml);
+ }
+}
+
+void PmuXML::parse(const char *const xml) {
+ mxml_node_t *root = mxmlLoadString(NULL, xml, MXML_NO_CALLBACK);
+
+ for (mxml_node_t *node = mxmlFindElement(root, root, TAG_PMU, NULL, NULL, MXML_DESCEND);
+ node != NULL;
+ node = mxmlFindElement(node, root, TAG_PMU, NULL, NULL, MXML_DESCEND)) {
+ const char *const pmncName = mxmlElementGetAttr(node, ATTR_PMNC_NAME);
+ const char *const cpuidStr = mxmlElementGetAttr(node, ATTR_CPUID);
+ const int cpuid = strtol(cpuidStr, NULL, 0);
+ const char *const coreName = mxmlElementGetAttr(node, ATTR_CORE_NAME);
+ const char *const dtName = mxmlElementGetAttr(node, ATTR_DT_NAME);
+ const char *const pmncCountersStr = mxmlElementGetAttr(node, ATTR_PMNC_COUNTERS);
+ const int pmncCounters = strtol(pmncCountersStr, NULL, 0);
+ if (pmncName == NULL || cpuid == 0 || coreName == NULL || pmncCounters == 0) {
+ logg.logError("A pmu from the pmu XML is missing one or more of the required attributes (%s, %s, %s and %s)", ATTR_PMNC_NAME, ATTR_CPUID, ATTR_CORE_NAME, ATTR_PMNC_COUNTERS);
+ handleException();
+ }
+ new GatorCpu(strdup(coreName), strdup(pmncName), dtName == NULL ? NULL : strdup(dtName), cpuid, pmncCounters);
+ }
+
+ for (mxml_node_t *node = mxmlFindElement(root, root, TAG_UNCORE_PMU, NULL, NULL, MXML_DESCEND);
+ node != NULL;
+ node = mxmlFindElement(node, root, TAG_UNCORE_PMU, NULL, NULL, MXML_DESCEND)) {
+ const char *const pmncName = mxmlElementGetAttr(node, ATTR_PMNC_NAME);
+ const char *const coreName = mxmlElementGetAttr(node, ATTR_CORE_NAME);
+ const char *const pmncCountersStr = mxmlElementGetAttr(node, ATTR_PMNC_COUNTERS);
+ const int pmncCounters = strtol(pmncCountersStr, NULL, 0);
+ const char *const hasCyclesCounterStr = mxmlElementGetAttr(node, ATTR_HAS_CYCLES_COUNTER);
+ const bool hasCyclesCounter = stringToBool(hasCyclesCounterStr, true);
+ if (pmncName == NULL || coreName == NULL || pmncCounters == 0) {
+ logg.logError("An uncore_pmu from the pmu XML is missing one or more of the required attributes (%s, %s and %s)", ATTR_PMNC_NAME, ATTR_CORE_NAME, ATTR_PMNC_COUNTERS);
+ handleException();
+ }
+ new UncorePmu(strdup(coreName), strdup(pmncName), pmncCounters, hasCyclesCounter);
+ }
+
+ mxmlDelete(root);
+}
+
+void PmuXML::getDefaultXml(const char **const xml, unsigned int *const len) {
+#include "pmus_xml.h" // defines and initializes char defaults_xml[] and int defaults_xml_len
+ *xml = (const char *)pmus_xml;
+ *len = pmus_xml_len;
+}
+
+void PmuXML::writeToKernel() {
+ char buf[512];
+
+ for (GatorCpu *gatorCpu = GatorCpu::getHead(); gatorCpu != NULL; gatorCpu = gatorCpu->getNext()) {
+ snprintf(buf, sizeof(buf), "/dev/gator/pmu/%s", gatorCpu->getPmncName());
+ if (access(buf, X_OK) == 0) {
+ continue;
+ }
+ DriverSource::writeDriver("/dev/gator/pmu/export", gatorCpu->getPmncName());
+ snprintf(buf, sizeof(buf), "/dev/gator/pmu/%s/cpuid", gatorCpu->getPmncName());
+ DriverSource::writeDriver(buf, gatorCpu->getCpuid());
+ snprintf(buf, sizeof(buf), "/dev/gator/pmu/%s/core_name", gatorCpu->getPmncName());
+ DriverSource::writeDriver(buf, gatorCpu->getCoreName());
+ if (gatorCpu->getDtName() != NULL) {
+ snprintf(buf, sizeof(buf), "/dev/gator/pmu/%s/dt_name", gatorCpu->getPmncName());
+ DriverSource::writeDriver(buf, gatorCpu->getDtName());
+ }
+ snprintf(buf, sizeof(buf), "/dev/gator/pmu/%s/pmnc_counters", gatorCpu->getPmncName());
+ DriverSource::writeDriver(buf, gatorCpu->getPmncCounters());
+ }
+
+ for (UncorePmu *uncorePmu = UncorePmu::getHead(); uncorePmu != NULL; uncorePmu = uncorePmu->getNext()) {
+ snprintf(buf, sizeof(buf), "/dev/gator/uncore_pmu/%s", uncorePmu->getPmncName());
+ if (access(buf, X_OK) == 0) {
+ continue;
+ }
+ DriverSource::writeDriver("/dev/gator/uncore_pmu/export", uncorePmu->getPmncName());
+ snprintf(buf, sizeof(buf), "/dev/gator/uncore_pmu/%s/core_name", uncorePmu->getPmncName());
+ DriverSource::writeDriver(buf, uncorePmu->getCoreName());
+ snprintf(buf, sizeof(buf), "/dev/gator/uncore_pmu/%s/pmnc_counters", uncorePmu->getPmncName());
+ DriverSource::writeDriver(buf, uncorePmu->getPmncCounters());
+ snprintf(buf, sizeof(buf), "/dev/gator/uncore_pmu/%s/has_cycles_counter", uncorePmu->getPmncName());
+ DriverSource::writeDriver(buf, uncorePmu->getHasCyclesCounter());
+ }
+
+ DriverSource::writeDriver("/dev/gator/pmu_init", "1");
+}
diff --git a/tools/gator/daemon/PmuXML.h b/tools/gator/daemon/PmuXML.h
new file mode 100644
index 000000000000..a2d6222e7651
--- /dev/null
+++ b/tools/gator/daemon/PmuXML.h
@@ -0,0 +1,29 @@
+/**
+ * Copyright (C) ARM Limited 2010-2015. 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.
+ */
+
+#ifndef PMUXML_H
+#define PMUXML_H
+
+class PmuXML {
+public:
+ PmuXML();
+ ~PmuXML();
+
+ static void read(const char *const path);
+ static void writeToKernel();
+
+private:
+ static void parse(const char *const xml);
+ static void getDefaultXml(const char **const xml, unsigned int *const len);
+
+ // Intentionally unimplemented
+ PmuXML(const PmuXML &);
+ PmuXML &operator=(const PmuXML &);
+};
+
+#endif // PMUXML_H
diff --git a/tools/gator/daemon/Proc.cpp b/tools/gator/daemon/Proc.cpp
index ffe1a786b98b..6bea90c67e84 100644
--- a/tools/gator/daemon/Proc.cpp
+++ b/tools/gator/daemon/Proc.cpp
@@ -31,20 +31,20 @@ struct ProcStat {
static bool readProcStat(ProcStat *const ps, const char *const pathname, DynBuf *const b) {
if (!b->read(pathname)) {
- logg->logMessage("DynBuf::read failed, likely because the thread exited");
+ logg.logMessage("DynBuf::read failed, likely because the thread exited");
// This is not a fatal error - the thread just doesn't exist any more
return true;
}
char *comm = strchr(b->getBuf(), '(');
if (comm == NULL) {
- logg->logMessage("parsing stat failed");
+ logg.logMessage("parsing stat failed");
return false;
}
++comm;
char *const str = strrchr(comm, ')');
if (str == NULL) {
- logg->logMessage("parsing stat failed");
+ logg.logMessage("parsing stat failed");
return false;
}
*str = '\0';
@@ -53,7 +53,7 @@ static bool readProcStat(ProcStat *const ps, const char *const pathname, DynBuf
const int count = sscanf(str + 2, " %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %ld", &ps->numThreads);
if (count != 1) {
- logg->logMessage("sscanf failed");
+ logg.logMessage("sscanf failed");
return false;
}
@@ -65,7 +65,7 @@ static const char APP_PROCESS[] = "app_process";
static const char *readProcExe(DynBuf *const printb, const int pid, const int tid, DynBuf *const b) {
if (tid == -1 ? !printb->printf("/proc/%i/exe", pid)
: !printb->printf("/proc/%i/task/%i/exe", pid, tid)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
return NULL;
}
@@ -77,7 +77,7 @@ static const char *readProcExe(DynBuf *const printb, const int pid, const int ti
// readlink /proc/[pid]/exe returns ENOENT for kernel threads
image = "\0";
} else {
- logg->logMessage("DynBuf::readlink failed");
+ logg.logMessage("DynBuf::readlink failed");
return NULL;
}
@@ -89,12 +89,12 @@ static const char *readProcExe(DynBuf *const printb, const int pid, const int ti
if (tid == -1 ? !printb->printf("/proc/%i/cmdline", pid)
: !printb->printf("/proc/%i/task/%i/cmdline", pid, tid)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
return NULL;
}
if (!b->read(printb->getBuf())) {
- logg->logMessage("DynBuf::read failed, likely because the thread exited");
+ logg.logMessage("DynBuf::read failed, likely because the thread exited");
return NULL;
}
@@ -105,12 +105,12 @@ static bool readProcTask(const uint64_t currTime, Buffer *const buffer, const in
bool result = false;
if (!b1->printf("/proc/%i/task", pid)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
return result;
}
DIR *task = opendir(b1->getBuf());
if (task == NULL) {
- logg->logMessage("opendir failed");
+ logg.logMessage("opendir failed");
// This is not a fatal error - the thread just doesn't exist any more
return true;
}
@@ -125,18 +125,18 @@ static bool readProcTask(const uint64_t currTime, Buffer *const buffer, const in
}
if (!printb->printf("/proc/%i/task/%i/stat", pid, tid)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
goto fail;
}
ProcStat ps;
if (!readProcStat(&ps, printb->getBuf(), b1)) {
- logg->logMessage("readProcStat failed");
+ logg.logMessage("readProcStat failed");
goto fail;
}
const char *const image = readProcExe(printb, pid, tid, b2);
if (image == NULL) {
- logg->logMessage("readImage failed");
+ logg.logMessage("readImage failed");
goto fail;
}
@@ -156,7 +156,7 @@ bool readProcComms(const uint64_t currTime, Buffer *const buffer, DynBuf *const
DIR *proc = opendir("/proc");
if (proc == NULL) {
- logg->logMessage("opendir failed");
+ logg.logMessage("opendir failed");
return result;
}
@@ -170,26 +170,26 @@ bool readProcComms(const uint64_t currTime, Buffer *const buffer, DynBuf *const
}
if (!printb->printf("/proc/%i/stat", pid)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
goto fail;
}
ProcStat ps;
if (!readProcStat(&ps, printb->getBuf(), b1)) {
- logg->logMessage("readProcStat failed");
+ logg.logMessage("readProcStat failed");
goto fail;
}
if (ps.numThreads <= 1) {
const char *const image = readProcExe(printb, pid, -1, b1);
if (image == NULL) {
- logg->logMessage("readImage failed");
+ logg.logMessage("readImage failed");
goto fail;
}
buffer->marshalComm(currTime, pid, pid, image, ps.comm);
} else {
if (!readProcTask(currTime, buffer, pid, printb, b1, b2)) {
- logg->logMessage("readProcTask failed");
+ logg.logMessage("readProcTask failed");
goto fail;
}
}
@@ -208,7 +208,7 @@ bool readProcMaps(const uint64_t currTime, Buffer *const buffer, DynBuf *const p
DIR *proc = opendir("/proc");
if (proc == NULL) {
- logg->logMessage("opendir failed");
+ logg.logMessage("opendir failed");
return result;
}
@@ -222,11 +222,11 @@ bool readProcMaps(const uint64_t currTime, Buffer *const buffer, DynBuf *const p
}
if (!printb->printf("/proc/%i/maps", pid)) {
- logg->logMessage("DynBuf::printf failed");
+ logg.logMessage("DynBuf::printf failed");
goto fail;
}
if (!b->read(printb->getBuf())) {
- logg->logMessage("DynBuf::read failed, likely because the process exited");
+ logg.logMessage("DynBuf::read failed, likely because the process exited");
// This is not a fatal error - the process just doesn't exist any more
continue;
}
@@ -246,16 +246,16 @@ bool readKallsyms(const uint64_t currTime, Buffer *const buffer, const bool *con
int fd = ::open("/proc/kallsyms", O_RDONLY | O_CLOEXEC);
if (fd < 0) {
- logg->logMessage("open failed");
+ logg.logMessage("open failed");
return true;
};
char buf[1<<12];
ssize_t pos = 0;
- while (gSessionData->mSessionIsActive && !ACCESS_ONCE(*isDone)) {
+ while (gSessionData.mSessionIsActive && !ACCESS_ONCE(*isDone)) {
// Assert there is still space in the buffer
if (sizeof(buf) - pos - 1 == 0) {
- logg->logError("no space left in buffer");
+ logg.logError("no space left in buffer");
handleException();
}
@@ -263,13 +263,13 @@ bool readKallsyms(const uint64_t currTime, Buffer *const buffer, const bool *con
// -1 to reserve space for \0
const ssize_t bytes = ::read(fd, buf + pos, sizeof(buf) - pos - 1);
if (bytes < 0) {
- logg->logError("read failed");
+ logg.logError("read failed");
handleException();
}
if (bytes == 0) {
// Assert the buffer is empty
if (pos != 0) {
- logg->logError("buffer not empty on eof");
+ logg.logError("buffer not empty on eof");
handleException();
}
break;
@@ -289,7 +289,7 @@ bool readKallsyms(const uint64_t currTime, Buffer *const buffer, const bool *con
buf[0] = was;
// Assert the memory regions do not overlap
if (pos - newline >= newline + 1) {
- logg->logError("memcpy src and dst overlap");
+ logg.logError("memcpy src and dst overlap");
handleException();
}
if (pos - newline - 2 > 0) {
diff --git a/tools/gator/daemon/Sender.cpp b/tools/gator/daemon/Sender.cpp
index 71ddfced6890..951eb74c087c 100644
--- a/tools/gator/daemon/Sender.cpp
+++ b/tools/gator/daemon/Sender.cpp
@@ -30,7 +30,7 @@ Sender::Sender(OlySocket* socket) {
// Streamline will send data prior to the magic sequence for legacy support, which should be ignored for v4+
while (strcmp("STREAMLINE", streamline) != 0) {
if (mDataSocket->receiveString(streamline, sizeof(streamline)) == -1) {
- logg->logError("Socket disconnected");
+ logg.logError("Socket disconnected");
handleException();
}
}
@@ -40,8 +40,8 @@ Sender::Sender(OlySocket* socket) {
snprintf(magic, 32, "GATOR %i\n", PROTOCOL_VERSION);
mDataSocket->send(magic, strlen(magic));
- gSessionData->mWaitingOnCommand = true;
- logg->logMessage("Completed magic sequence");
+ gSessionData.mWaitingOnCommand = true;
+ logg.logMessage("Completed magic sequence");
}
pthread_mutexattr_t attr;
@@ -50,7 +50,7 @@ Sender::Sender(OlySocket* socket) {
pthread_mutex_init(&mSendMutex, &attr) != 0 ||
pthread_mutexattr_destroy(&attr) != 0 ||
false) {
- logg->logError("Unable to setup mutex");
+ logg.logError("Unable to setup mutex");
handleException();
}
}
@@ -75,19 +75,22 @@ void Sender::createDataFile(char* apcDir) {
sprintf(mDataFileName, "%s/0000000000", apcDir);
mDataFile = fopen_cloexec(mDataFileName, "wb");
if (!mDataFile) {
- logg->logError("Failed to open binary file: %s", mDataFileName);
+ logg.logError("Failed to open binary file: %s", mDataFileName);
handleException();
}
}
-void Sender::writeData(const char* data, int length, int type) {
+void Sender::writeData(const char* data, int length, int type, bool ignoreLockErrors) {
if (length < 0 || (data == NULL && length > 0)) {
return;
}
// Multiple threads call writeData()
if (pthread_mutex_lock(&mSendMutex) != 0) {
- logg->logError("pthread_mutex_lock failed");
+ if (ignoreLockErrors) {
+ return;
+ }
+ logg.logError("pthread_mutex_lock failed");
handleException();
}
@@ -98,7 +101,7 @@ void Sender::writeData(const char* data, int length, int type) {
alarm(alarmDuration);
// Send data over the socket, sending the type and size first
- logg->logMessage("Sending data with length %d", length);
+ logg.logMessage("Sending data with length %d", length);
if (type != RESPONSE_APC_DATA) {
// type and length already added by the Collector for apc data
unsigned char header[5];
@@ -119,7 +122,7 @@ void Sender::writeData(const char* data, int length, int type) {
// Reset the alarm
alarm(alarmDuration);
- logg->logMessage("Resetting the alarm");
+ logg.logMessage("Resetting the alarm");
}
// Stop alarm
@@ -128,16 +131,16 @@ void Sender::writeData(const char* data, int length, int type) {
// Write data to disk as long as it is not meta data
if (mDataFile && type == RESPONSE_APC_DATA) {
- logg->logMessage("Writing data with length %d", length);
+ logg.logMessage("Writing data with length %d", length);
// Send data to the data file
if (fwrite(data, 1, length, mDataFile) != (unsigned int)length) {
- logg->logError("Failed writing binary file %s", mDataFileName);
+ logg.logError("Failed writing binary file %s", mDataFileName);
handleException();
}
}
if (pthread_mutex_unlock(&mSendMutex) != 0) {
- logg->logError("pthread_mutex_unlock failed");
+ logg.logError("pthread_mutex_unlock failed");
handleException();
}
}
diff --git a/tools/gator/daemon/Sender.h b/tools/gator/daemon/Sender.h
index 8f542026e90d..010a2223e72c 100644
--- a/tools/gator/daemon/Sender.h
+++ b/tools/gator/daemon/Sender.h
@@ -26,8 +26,9 @@ class Sender {
public:
Sender(OlySocket* socket);
~Sender();
- void writeData(const char* data, int length, int type);
+ void writeData(const char* data, int length, int type, bool ignoreLockErrors = false);
void createDataFile(char* apcDir);
+
private:
OlySocket* mDataSocket;
FILE* mDataFile;
diff --git a/tools/gator/daemon/SessionData.cpp b/tools/gator/daemon/SessionData.cpp
index 42917c034c51..b81e66b0a6d8 100644
--- a/tools/gator/daemon/SessionData.cpp
+++ b/tools/gator/daemon/SessionData.cpp
@@ -23,19 +23,71 @@
#define CORE_NAME_UNKNOWN "unknown"
-SessionData* gSessionData = NULL;
+const char MALI_GRAPHICS[] = "\0mali_thirdparty_server";
+const size_t MALI_GRAPHICS_SIZE = sizeof(MALI_GRAPHICS);
+
+SessionData gSessionData;
+
+GatorCpu *GatorCpu::mHead;
+
+GatorCpu::GatorCpu(const char *const coreName, const char *const pmncName, const char *const dtName, const int cpuid, const int pmncCounters) : mNext(mHead), mCoreName(coreName), mPmncName(pmncName), mDtName(dtName), mCpuid(cpuid), mPmncCounters(pmncCounters) {
+ mHead = this;
+}
+
+static const char OLD_PMU_PREFIX[] = "ARMv7 Cortex-";
+static const char NEW_PMU_PREFIX[] = "ARMv7_Cortex_";
+
+GatorCpu *GatorCpu::find(const char *const name) {
+ GatorCpu *gatorCpu;
+
+ for (gatorCpu = mHead; gatorCpu != NULL; gatorCpu = gatorCpu->mNext) {
+ if (strcasecmp(gatorCpu->mPmncName, name) == 0 ||
+ // Do these names match but have the old vs new prefix?
+ ((strncasecmp(name, OLD_PMU_PREFIX, sizeof(OLD_PMU_PREFIX) - 1) == 0 &&
+ strncasecmp(gatorCpu->mPmncName, NEW_PMU_PREFIX, sizeof(NEW_PMU_PREFIX) - 1) == 0 &&
+ strcasecmp(name + sizeof(OLD_PMU_PREFIX) - 1, gatorCpu->mPmncName + sizeof(NEW_PMU_PREFIX) - 1) == 0))) {
+ break;
+ }
+ }
+
+ return gatorCpu;
+}
+
+GatorCpu *GatorCpu::find(const int cpuid) {
+ GatorCpu *gatorCpu;
+
+ for (gatorCpu = mHead; gatorCpu != NULL; gatorCpu = gatorCpu->mNext) {
+ if (gatorCpu->mCpuid == cpuid) {
+ break;
+ }
+ }
+
+ return gatorCpu;
+}
+
+UncorePmu *UncorePmu::mHead;
+
+UncorePmu::UncorePmu(const char *const coreName, const char *const pmncName, const int pmncCounters, const bool hasCyclesCounter) : mNext(mHead), mCoreName(coreName), mPmncName(pmncName), mPmncCounters(pmncCounters), mHasCyclesCounter(hasCyclesCounter) {
+ mHead = this;
+}
+
+UncorePmu *UncorePmu::find(const char *const name) {
+ UncorePmu *gatorCpu;
+
+ for (gatorCpu = mHead; gatorCpu != NULL; gatorCpu = gatorCpu->mNext) {
+ if (strcasecmp(name, gatorCpu->mPmncName) == 0) {
+ break;
+ }
+ }
+
+ return gatorCpu;
+}
SharedData::SharedData() : mMaliUtgardCountersSize(0) {
memset(mCpuIds, -1, sizeof(mCpuIds));
}
SessionData::SessionData() {
- mUsDrivers[0] = new HwmonDriver();
- mUsDrivers[1] = new FSDriver();
- mUsDrivers[2] = new MemInfoDriver();
- mUsDrivers[3] = new NetDriver();
- mUsDrivers[4] = new DiskIODriver();
- initialize();
}
SessionData::~SessionData() {
@@ -45,9 +97,15 @@ SessionData::~SessionData() {
inline void *operator new(size_t, void *ptr) { return ptr; }
void SessionData::initialize() {
+ mUsDrivers[0] = new HwmonDriver();
+ mUsDrivers[1] = new FSDriver();
+ mUsDrivers[2] = new MemInfoDriver();
+ mUsDrivers[3] = new NetDriver();
+ mUsDrivers[4] = new DiskIODriver();
+
mSharedData = (SharedData *)mmap(NULL, sizeof(*mSharedData), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (mSharedData == MAP_FAILED) {
- logg->logError("Unable to mmap shared memory for cpuids");
+ logg.logError("Unable to mmap shared memory for cpuids");
handleException();
}
// Use placement new to construct but not allocate the object
@@ -98,7 +156,7 @@ void SessionData::parseSessionXML(char* xmlString) {
} else if (strcmp(session.parameters.sample_rate, "none") == 0) {
mSampleRate = 0;
} else {
- logg->logError("Invalid sample rate (%s) in session xml.", session.parameters.sample_rate);
+ logg.logError("Invalid sample rate (%s) in session xml.", session.parameters.sample_rate);
handleException();
}
mBacktraceDepth = session.parameters.call_stack_unwinding == true ? 128 : 0;
@@ -115,19 +173,19 @@ void SessionData::parseSessionXML(char* xmlString) {
} else if (strcmp(session.parameters.buffer_mode, "large") == 0) {
mTotalBufferSize = 16;
} else {
- logg->logError("Invalid value for buffer mode in session xml.");
+ logg.logError("Invalid value for buffer mode in session xml.");
handleException();
}
// Convert milli- to nanoseconds
mLiveRate = session.parameters.live_rate * (int64_t)1000000;
if (mLiveRate > 0 && mLocalCapture) {
- logg->logMessage("Local capture is not compatable with live, disabling live");
+ logg.logMessage("Local capture is not compatable with live, disabling live");
mLiveRate = 0;
}
if (!mAllowCommands && (mCaptureCommand != NULL)) {
- logg->logError("Running a command during a capture is not currently allowed. Please restart gatord with the -a flag.");
+ logg.logError("Running a command during a capture is not currently allowed. Please restart gatord with the -a flag.");
handleException();
}
}
@@ -166,7 +224,7 @@ void SessionData::readCpuInfo() {
FILE *f = fopen_cloexec("/proc/cpuinfo", "r");
if (f == NULL) {
- logg->logMessage("Error opening /proc/cpuinfo\n"
+ logg.logMessage("Error opening /proc/cpuinfo\n"
"The core name in the captured xml file will be 'unknown'.");
return;
}
@@ -181,7 +239,7 @@ void SessionData::readCpuInfo() {
temp[len - 1] = '\0';
}
- logg->logMessage("cpuinfo: %s", temp);
+ logg.logMessage("cpuinfo: %s", temp);
if (len == 1) {
// New section, clear the processor. Streamline will not know the cpus if the pre Linux 3.8 format of cpuinfo is encountered but also that no incorrect information will be transmitted.
@@ -196,7 +254,7 @@ void SessionData::readCpuInfo() {
if (foundHardware || foundCPUImplementer || foundCPUPart || foundProcessor) {
char* position = strchr(temp, ':');
if (position == NULL || (unsigned int)(position - temp) + 2 >= strlen(temp)) {
- logg->logMessage("Unknown format of /proc/cpuinfo\n"
+ logg.logMessage("Unknown format of /proc/cpuinfo\n"
"The core name in the captured xml file will be 'unknown'.");
return;
}
@@ -211,7 +269,7 @@ void SessionData::readCpuInfo() {
if (foundCPUImplementer) {
const int implementer = strtol(position, NULL, 0);
if (processor >= NR_CPUS) {
- logg->logMessage("Too many processors, please increase NR_CPUS");
+ logg.logMessage("Too many processors, please increase NR_CPUS");
} else if (processor >= 0) {
setImplementer(mSharedData->mCpuIds[processor], implementer);
} else {
@@ -222,7 +280,7 @@ void SessionData::readCpuInfo() {
if (foundCPUPart) {
const int cpuId = strtol(position, NULL, 0);
if (processor >= NR_CPUS) {
- logg->logMessage("Too many processors, please increase NR_CPUS");
+ logg.logMessage("Too many processors, please increase NR_CPUS");
} else if (processor >= 0) {
setPart(mSharedData->mCpuIds[processor], cpuId);
} else {
@@ -244,7 +302,7 @@ void SessionData::readCpuInfo() {
}
if (!foundCoreName) {
- logg->logMessage("Could not determine core name from /proc/cpuinfo\n"
+ logg.logMessage("Could not determine core name from /proc/cpuinfo\n"
"The core name in the captured xml file will be 'unknown'.");
}
fclose(f);
@@ -253,7 +311,7 @@ void SessionData::readCpuInfo() {
uint64_t getTime() {
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) != 0) {
- logg->logError("Failed to get uptime");
+ logg.logError("Failed to get uptime");
handleException();
}
return (NS_PER_S*ts.tv_sec + ts.tv_nsec);
@@ -305,12 +363,12 @@ bool setNonblock(const int fd) {
flags = fcntl(fd, F_GETFL);
if (flags < 0) {
- logg->logMessage("fcntl getfl failed");
+ logg.logMessage("fcntl getfl failed");
return false;
}
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) != 0) {
- logg->logMessage("fcntl setfl failed");
+ logg.logMessage("fcntl setfl failed");
return false;
}
@@ -322,7 +380,7 @@ bool writeAll(const int fd, const void *const buf, const size_t pos) {
while (written < pos) {
ssize_t bytes = write(fd, (const uint8_t *)buf + written, pos - written);
if (bytes <= 0) {
- logg->logMessage("write failed");
+ logg.logMessage("write failed");
return false;
}
written += bytes;
@@ -336,7 +394,7 @@ bool readAll(const int fd, void *const buf, const size_t count) {
while (pos < count) {
ssize_t bytes = read(fd, (uint8_t *)buf + pos, count - pos);
if (bytes <= 0) {
- logg->logMessage("read failed");
+ logg.logMessage("read failed");
return false;
}
pos += bytes;
diff --git a/tools/gator/daemon/SessionData.h b/tools/gator/daemon/SessionData.h
index 12432d02d851..c3547039ac2e 100644
--- a/tools/gator/daemon/SessionData.h
+++ b/tools/gator/daemon/SessionData.h
@@ -19,9 +19,10 @@
#include "FtraceDriver.h"
#include "KMod.h"
#include "MaliVideoDriver.h"
+#include "MidgardDriver.h"
#include "PerfDriver.h"
-#define PROTOCOL_VERSION 22
+#define PROTOCOL_VERSION 23
// Differentiates development versions (timestamp) from release versions
#define PROTOCOL_DEV 1000
@@ -29,11 +30,99 @@
#define NS_PER_MS 1000000LL
#define NS_PER_US 1000LL
+extern const char MALI_GRAPHICS[];
+extern const size_t MALI_GRAPHICS_SIZE;
+
struct ImageLinkList {
char* path;
struct ImageLinkList *next;
};
+class GatorCpu {
+public:
+ GatorCpu(const char *const coreName, const char *const pmncName, const char *const dtName, const int cpuid, const int pmncCounters);
+
+ static GatorCpu *getHead() {
+ return mHead;
+ }
+
+ GatorCpu *getNext() const {
+ return mNext;
+ }
+
+ const char *getCoreName() const {
+ return mCoreName;
+ }
+
+ const char *getPmncName() const {
+ return mPmncName;
+ }
+
+ const char *getDtName() const {
+ return mDtName;
+ }
+
+ int getCpuid() const {
+ return mCpuid;
+ }
+
+ int getPmncCounters() const {
+ return mPmncCounters;
+ }
+
+ static GatorCpu *find(const char *const name);
+
+ static GatorCpu *find(const int cpuid);
+
+private:
+ static GatorCpu *mHead;
+ GatorCpu *const mNext;
+ const char *const mCoreName;
+ const char *const mPmncName;
+ const char *const mDtName;
+ const int mCpuid;
+ const int mPmncCounters;
+};
+
+class UncorePmu {
+public:
+ UncorePmu(const char *const coreName, const char *const pmncName, const int pmncCounters, const bool hasCyclesCounter);
+
+ static UncorePmu *getHead() {
+ return mHead;
+ }
+
+ UncorePmu *getNext() const {
+ return mNext;
+ }
+
+ const char *getCoreName() const {
+ return mCoreName;
+ }
+
+ const char *getPmncName() const {
+ return mPmncName;
+ }
+
+ int getPmncCounters() const {
+ return mPmncCounters;
+ }
+
+ bool getHasCyclesCounter() const {
+ return mHasCyclesCounter;
+ }
+
+ static UncorePmu *find(const char *const name);
+
+private:
+ static UncorePmu *mHead;
+ UncorePmu *const mNext;
+ const char *const mCoreName;
+ const char *const mPmncName;
+ const int mPmncCounters;
+ const bool mHasCyclesCounter;
+};
+
class SharedData {
public:
SharedData();
@@ -41,6 +130,8 @@ public:
int mCpuIds[NR_CPUS];
size_t mMaliUtgardCountersSize;
char mMaliUtgardCounters[1<<12];
+ size_t mMaliMidgardCountersSize;
+ char mMaliMidgardCounters[1<<13];
private:
// Intentionally unimplemented
@@ -54,6 +145,8 @@ public:
SessionData();
~SessionData();
+
+ void initialize();
void parseSessionXML(char* xmlString);
void readModel();
void readCpuInfo();
@@ -64,6 +157,7 @@ public:
KMod mKmod;
PerfDriver mPerf;
MaliVideoDriver mMaliVideo;
+ MidgardDriver mMidgard;
// Intentionally above FtraceDriver as drivers are initialized in reverse order AtraceDriver references AtraceDriver
AtraceDriver mAtraceDriver;
FtraceDriver mFtraceDriver;
@@ -108,14 +202,12 @@ public:
Counter mCounters[MAX_PERFORMANCE_COUNTERS];
private:
- void initialize();
-
// Intentionally unimplemented
SessionData(const SessionData &);
SessionData &operator=(const SessionData &);
};
-extern SessionData* gSessionData;
+extern SessionData gSessionData;
extern const char *const gSrcMd5;
uint64_t getTime();
diff --git a/tools/gator/daemon/SessionXML.cpp b/tools/gator/daemon/SessionXML.cpp
index c638dea45912..cf8f8c7510b0 100644
--- a/tools/gator/daemon/SessionXML.cpp
+++ b/tools/gator/daemon/SessionXML.cpp
@@ -16,19 +16,19 @@
#include "OlyUtility.h"
#include "SessionData.h"
-static const char *TAG_SESSION = "session";
-static const char *TAG_IMAGE = "image";
-
-static const char *ATTR_VERSION = "version";
-static const char *ATTR_CALL_STACK_UNWINDING = "call_stack_unwinding";
-static const char *ATTR_BUFFER_MODE = "buffer_mode";
-static const char *ATTR_SAMPLE_RATE = "sample_rate";
-static const char *ATTR_DURATION = "duration";
-static const char *ATTR_PATH = "path";
-static const char *ATTR_LIVE_RATE = "live_rate";
-static const char *ATTR_CAPTURE_WORKING_DIR = "capture_working_dir";
-static const char *ATTR_CAPTURE_COMMAND = "capture_command";
-static const char *ATTR_CAPTURE_USER = "capture_user";
+static const char TAG_SESSION[] = "session";
+static const char TAG_IMAGE[] = "image";
+
+static const char ATTR_VERSION[] = "version";
+static const char ATTR_CALL_STACK_UNWINDING[] = "call_stack_unwinding";
+static const char ATTR_BUFFER_MODE[] = "buffer_mode";
+static const char ATTR_SAMPLE_RATE[] = "sample_rate";
+static const char ATTR_DURATION[] = "duration";
+static const char ATTR_PATH[] = "path";
+static const char ATTR_LIVE_RATE[] = "live_rate";
+static const char ATTR_CAPTURE_WORKING_DIR[] = "capture_working_dir";
+static const char ATTR_CAPTURE_COMMAND[] = "capture_command";
+static const char ATTR_CAPTURE_USER[] = "capture_user";
SessionXML::SessionXML(const char *str) {
parameters.buffer_mode[0] = 0;
@@ -36,7 +36,7 @@ SessionXML::SessionXML(const char *str) {
parameters.call_stack_unwinding = false;
parameters.live_rate = 0;
mSessionXML = str;
- logg->logMessage("%s", mSessionXML);
+ logg.logMessage("%s", mSessionXML);
}
SessionXML::~SessionXML() {
@@ -55,7 +55,7 @@ void SessionXML::parse() {
return;
}
- logg->logError("No session tag found in the session.xml file");
+ logg.logError("No session tag found in the session.xml file");
handleException();
}
@@ -63,7 +63,7 @@ void SessionXML::sessionTag(mxml_node_t *tree, mxml_node_t *node) {
int version = 0;
if (mxmlElementGetAttr(node, ATTR_VERSION)) version = strtol(mxmlElementGetAttr(node, ATTR_VERSION), NULL, 10);
if (version != 1) {
- logg->logError("Invalid session.xml version: %d", version);
+ logg.logError("Invalid session.xml version: %d", version);
handleException();
}
@@ -76,13 +76,13 @@ void SessionXML::sessionTag(mxml_node_t *tree, mxml_node_t *node) {
strncpy(parameters.sample_rate, mxmlElementGetAttr(node, ATTR_SAMPLE_RATE), sizeof(parameters.sample_rate));
parameters.sample_rate[sizeof(parameters.sample_rate) - 1] = 0; // strncpy does not guarantee a null-terminated string
}
- if (mxmlElementGetAttr(node, ATTR_CAPTURE_WORKING_DIR)) gSessionData->mCaptureWorkingDir = strdup(mxmlElementGetAttr(node, ATTR_CAPTURE_WORKING_DIR));
- if (mxmlElementGetAttr(node, ATTR_CAPTURE_COMMAND)) gSessionData->mCaptureCommand = strdup(mxmlElementGetAttr(node, ATTR_CAPTURE_COMMAND));
- if (mxmlElementGetAttr(node, ATTR_CAPTURE_USER)) gSessionData->mCaptureUser = strdup(mxmlElementGetAttr(node, ATTR_CAPTURE_USER));
+ if (mxmlElementGetAttr(node, ATTR_CAPTURE_WORKING_DIR)) gSessionData.mCaptureWorkingDir = strdup(mxmlElementGetAttr(node, ATTR_CAPTURE_WORKING_DIR));
+ if (mxmlElementGetAttr(node, ATTR_CAPTURE_COMMAND)) gSessionData.mCaptureCommand = strdup(mxmlElementGetAttr(node, ATTR_CAPTURE_COMMAND));
+ if (mxmlElementGetAttr(node, ATTR_CAPTURE_USER)) gSessionData.mCaptureUser = strdup(mxmlElementGetAttr(node, ATTR_CAPTURE_USER));
// integers/bools
- parameters.call_stack_unwinding = util->stringToBool(mxmlElementGetAttr(node, ATTR_CALL_STACK_UNWINDING), false);
- if (mxmlElementGetAttr(node, ATTR_DURATION)) gSessionData->mDuration = strtol(mxmlElementGetAttr(node, ATTR_DURATION), NULL, 10);
+ parameters.call_stack_unwinding = stringToBool(mxmlElementGetAttr(node, ATTR_CALL_STACK_UNWINDING), false);
+ if (mxmlElementGetAttr(node, ATTR_DURATION)) gSessionData.mDuration = strtol(mxmlElementGetAttr(node, ATTR_DURATION), NULL, 10);
if (mxmlElementGetAttr(node, ATTR_LIVE_RATE)) parameters.live_rate = strtol(mxmlElementGetAttr(node, ATTR_LIVE_RATE), NULL, 10);
// parse subtags
@@ -106,6 +106,6 @@ void SessionXML::sessionImage(mxml_node_t *node) {
image = (struct ImageLinkList *)malloc(sizeof(struct ImageLinkList));
image->path = (char*)malloc(length + 1);
image->path = strdup(mxmlElementGetAttr(node, ATTR_PATH));
- image->next = gSessionData->mImages;
- gSessionData->mImages = image;
+ image->next = gSessionData.mImages;
+ gSessionData.mImages = image;
}
diff --git a/tools/gator/daemon/Setup.cpp b/tools/gator/daemon/Setup.cpp
index 524a70204e24..0d39572e9b12 100644
--- a/tools/gator/daemon/Setup.cpp
+++ b/tools/gator/daemon/Setup.cpp
@@ -36,7 +36,7 @@ bool getLinuxVersion(int version[3]) {
// Check the kernel version
struct utsname utsname;
if (uname(&utsname) != 0) {
- logg->logMessage("uname failed");
+ logg.logMessage("uname failed");
return false;
}
@@ -64,7 +64,7 @@ static int pgrep_gator(DynBuf *const printb) {
DIR *proc = opendir("/proc");
if (proc == NULL) {
- logg->logError(GATOR_ERROR "opendir failed");
+ logg.logError(GATOR_ERROR "opendir failed");
handleException();
}
@@ -80,7 +80,7 @@ static int pgrep_gator(DynBuf *const printb) {
}
if (!printb->printf("/proc/%i/stat", pid)) {
- logg->logError(GATOR_ERROR "DynBuf::printf failed");
+ logg.logError(GATOR_ERROR "DynBuf::printf failed");
handleException();
}
@@ -91,13 +91,13 @@ static int pgrep_gator(DynBuf *const printb) {
char *comm = strchr(b.getBuf(), '(');
if (comm == NULL) {
- logg->logError(GATOR_ERROR "parsing stat comm begin failed");
+ logg.logError(GATOR_ERROR "parsing stat comm begin failed");
handleException();
}
++comm;
char *const str = strrchr(comm, ')');
if (str == NULL) {
- logg->logError(GATOR_ERROR "parsing stat comm end failed");
+ logg.logError(GATOR_ERROR "parsing stat comm end failed");
handleException();
}
*str = '\0';
@@ -109,7 +109,7 @@ static int pgrep_gator(DynBuf *const printb) {
char state;
const int count = sscanf(str + 2, " %c ", &state);
if (count != 1) {
- logg->logError(GATOR_ERROR "parsing stat state failed");
+ logg.logError(GATOR_ERROR "parsing stat state failed");
handleException();
}
@@ -149,12 +149,12 @@ void update(const char *const gatorPath) {
int version[3];
if (!getLinuxVersion(version)) {
- logg->logError(GATOR_ERROR "getLinuxVersion failed");
+ logg.logError(GATOR_ERROR "getLinuxVersion failed");
handleException();
}
if (KERNEL_VERSION(version[0], version[1], version[2]) < KERNEL_VERSION(3, 4, 0)) {
- logg->logError(GATOR_ERROR "Streamline can't automatically setup gator as this kernel version is not supported. Please upgrade the kernel on your device.");
+ logg.logError(GATOR_ERROR "Streamline can't automatically setup gator as this kernel version is not supported. Please upgrade the kernel on your device.");
handleException();
}
@@ -184,7 +184,7 @@ void update(const char *const gatorPath) {
execlp("sh", "sh", "-c", buf, NULL);
// Streamline will provide the password if needed
- logg->logError(GATOR_ERROR "Streamline was unable to sudo to root on your device. Please double check passwords, ensure sudo or su work with this user or try a different username.");
+ logg.logError(GATOR_ERROR "Streamline was unable to sudo to root on your device. Please double check passwords, ensure sudo or su work with this user or try a different username.");
handleException();
}
printf(GATOR_MSG "now root\n");
@@ -203,11 +203,11 @@ void update(const char *const gatorPath) {
int gator_main = pgrep_gator(&printb);
if (gator_main > 0) {
if (kill(gator_main, SIGTERM) != 0) {
- logg->logError(GATOR_ERROR "kill SIGTERM failed");
+ logg.logError(GATOR_ERROR "kill SIGTERM failed");
handleException();
}
if (!printb.printf("/proc/%i/exe", gator_main)) {
- logg->logError(GATOR_ERROR "DynBuf::printf failed");
+ logg.logError(GATOR_ERROR "DynBuf::printf failed");
handleException();
}
for (int i = 0; ; ++i) {
@@ -217,11 +217,11 @@ void update(const char *const gatorPath) {
}
if (i == 5) {
if (kill(gator_main, SIGKILL) != 0) {
- logg->logError(GATOR_ERROR "kill SIGKILL failed");
+ logg.logError(GATOR_ERROR "kill SIGKILL failed");
handleException();
}
} else if (i >= 10) {
- logg->logError(GATOR_ERROR "unable to kill running gator");
+ logg.logError(GATOR_ERROR "unable to kill running gator");
handleException();
}
sleep(1);
@@ -233,7 +233,7 @@ void update(const char *const gatorPath) {
syscall(__NR_delete_module, "gator", O_NONBLOCK);
if (access("/sys/module/gator", F_OK) == 0) {
- logg->logError(GATOR_ERROR "Unable to unload gator.ko, the gator module may be built into the kernel or gator.ko cannot be unloaded. Rebooting the device may resolve the issue.");
+ logg.logError(GATOR_ERROR "Unable to unload gator.ko, the gator module may be built into the kernel or gator.ko cannot be unloaded. Rebooting the device may resolve the issue.");
handleException();
}
@@ -246,7 +246,7 @@ void update(const char *const gatorPath) {
if (dot != NULL) {
*dot = '\0';
if (rename(gatorPath, newGatorPath) != 0) {
- logg->logError(GATOR_ERROR "rename failed");
+ logg.logError(GATOR_ERROR "rename failed");
handleException();
}
}
@@ -254,14 +254,14 @@ void update(const char *const gatorPath) {
char buf[128];
int pipefd[2];
if (pipe_cloexec(pipefd) != 0) {
- logg->logError(GATOR_ERROR "pipe failed");
+ logg.logError(GATOR_ERROR "pipe failed");
handleException();
}
// Fork and start gatord (redirect stdin, stdout and stderr so shell can close)
int child = fork();
if (child < 0) {
- logg->logError(GATOR_ERROR "fork failed");
+ logg.logError(GATOR_ERROR "fork failed");
handleException();
} else if (child == 0) {
int inFd;
diff --git a/tools/gator/daemon/Source.cpp b/tools/gator/daemon/Source.cpp
index 64d6206895b0..3084bcba5414 100644
--- a/tools/gator/daemon/Source.cpp
+++ b/tools/gator/daemon/Source.cpp
@@ -18,7 +18,7 @@ Source::~Source() {
void Source::start() {
if (pthread_create(&mThreadID, NULL, runStatic, this)) {
- logg->logError("Failed to create source thread");
+ logg.logError("Failed to create source thread");
handleException();
}
}
diff --git a/tools/gator/daemon/StreamlineSetup.cpp b/tools/gator/daemon/StreamlineSetup.cpp
index 66d1f4e94a2a..f00d7f18596a 100644
--- a/tools/gator/daemon/StreamlineSetup.cpp
+++ b/tools/gator/daemon/StreamlineSetup.cpp
@@ -19,16 +19,16 @@
#include "Sender.h"
#include "SessionData.h"
-static const char* TAG_SESSION = "session";
-static const char* TAG_REQUEST = "request";
-static const char* TAG_CONFIGURATIONS = "configurations";
+static const char TAG_SESSION[] = "session";
+static const char TAG_REQUEST[] = "request";
+static const char TAG_CONFIGURATIONS[] = "configurations";
-static const char* ATTR_TYPE = "type";
-static const char* VALUE_EVENTS = "events";
-static const char* VALUE_CONFIGURATION = "configuration";
-static const char* VALUE_COUNTERS = "counters";
-static const char* VALUE_CAPTURED = "captured";
-static const char* VALUE_DEFAULTS = "defaults";
+static const char ATTR_TYPE[] = "type";
+static const char VALUE_EVENTS[] = "events";
+static const char VALUE_CONFIGURATION[] = "configuration";
+static const char VALUE_COUNTERS[] = "counters";
+static const char VALUE_CAPTURED[] = "captured";
+static const char VALUE_DEFAULTS[] = "defaults";
StreamlineSetup::StreamlineSetup(OlySocket* s) {
bool ready = false;
@@ -40,7 +40,7 @@ StreamlineSetup::StreamlineSetup(OlySocket* s) {
// Receive commands from Streamline (master)
while (!ready) {
// receive command over socket
- gSessionData->mWaitingOnCommand = true;
+ gSessionData.mWaitingOnCommand = true;
data = readCommand(&type);
// parse and handle data
@@ -52,31 +52,31 @@ StreamlineSetup::StreamlineSetup(OlySocket* s) {
handleDeliver(data);
break;
case COMMAND_APC_START:
- logg->logMessage("Received apc start request");
+ logg.logMessage("Received apc start request");
ready = true;
break;
case COMMAND_APC_STOP:
- logg->logMessage("Received apc stop request before apc start request");
+ logg.logMessage("Received apc stop request before apc start request");
exit(0);
break;
case COMMAND_DISCONNECT:
- logg->logMessage("Received disconnect command");
+ logg.logMessage("Received disconnect command");
exit(0);
break;
case COMMAND_PING:
- logg->logMessage("Received ping command");
+ logg.logMessage("Received ping command");
sendData(NULL, 0, RESPONSE_ACK);
break;
default:
- logg->logError("Target error: Unknown command type, %d", type);
+ logg.logError("Target error: Unknown command type, %d", type);
handleException();
}
free(data);
}
- if (gSessionData->mCountersError != NULL) {
- logg->logError("%s", gSessionData->mCountersError);
+ if (gSessionData.mCountersError != NULL) {
+ logg.logError("%s", gSessionData.mCountersError);
handleException();
}
}
@@ -93,10 +93,10 @@ char* StreamlineSetup::readCommand(int* command) {
response = mSocket->receiveNBytes((char*)&header, sizeof(header));
// After receiving a single byte, we are no longer waiting on a command
- gSessionData->mWaitingOnCommand = false;
+ gSessionData.mWaitingOnCommand = false;
if (response < 0) {
- logg->logError("Target error: Unexpected socket disconnect");
+ logg.logError("Target error: Unexpected socket disconnect");
handleException();
}
@@ -105,21 +105,21 @@ char* StreamlineSetup::readCommand(int* command) {
// add artificial limit
if ((length < 0) || length > 1024 * 1024) {
- logg->logError("Target error: Invalid length received, %d", length);
+ logg.logError("Target error: Invalid length received, %d", length);
handleException();
}
// allocate memory to contain the xml file, size of zero returns a zero size object
data = (char*)calloc(length + 1, 1);
if (data == NULL) {
- logg->logError("Unable to allocate memory for xml");
+ logg.logError("Unable to allocate memory for xml");
handleException();
}
// receive data
response = mSocket->receiveNBytes(data, length);
if (response < 0) {
- logg->logError("Target error: Unexpected socket disconnect");
+ logg.logError("Target error: Unexpected socket disconnect");
handleException();
}
@@ -143,26 +143,26 @@ void StreamlineSetup::handleRequest(char* xml) {
}
if (attr && strcmp(attr, VALUE_EVENTS) == 0) {
sendEvents();
- logg->logMessage("Sent events xml response");
+ logg.logMessage("Sent events xml response");
} else if (attr && strcmp(attr, VALUE_CONFIGURATION) == 0) {
sendConfiguration();
- logg->logMessage("Sent configuration xml response");
+ logg.logMessage("Sent configuration xml response");
} else if (attr && strcmp(attr, VALUE_COUNTERS) == 0) {
sendCounters();
- logg->logMessage("Sent counters xml response");
+ logg.logMessage("Sent counters xml response");
} else if (attr && strcmp(attr, VALUE_CAPTURED) == 0) {
CapturedXML capturedXML;
char* capturedText = capturedXML.getXML(false);
sendData(capturedText, strlen(capturedText), RESPONSE_XML);
free(capturedText);
- logg->logMessage("Sent captured xml response");
+ logg.logMessage("Sent captured xml response");
} else if (attr && strcmp(attr, VALUE_DEFAULTS) == 0) {
sendDefaults();
- logg->logMessage("Sent default configuration xml response");
+ logg.logMessage("Sent default configuration xml response");
} else {
char error[] = "Unknown request";
sendData(error, strlen(error), RESPONSE_NAK);
- logg->logMessage("Received unknown request:\n%s", xml);
+ logg.logMessage("Received unknown request:\n%s", xml);
}
mxmlDelete(tree);
@@ -175,17 +175,17 @@ void StreamlineSetup::handleDeliver(char* xml) {
tree = mxmlLoadString(NULL, xml, MXML_NO_CALLBACK);
if (mxmlFindElement(tree, tree, TAG_SESSION, NULL, NULL, MXML_DESCEND_FIRST)) {
// Session XML
- gSessionData->parseSessionXML(xml);
+ gSessionData.parseSessionXML(xml);
sendData(NULL, 0, RESPONSE_ACK);
- logg->logMessage("Received session xml");
+ logg.logMessage("Received session xml");
} else if (mxmlFindElement(tree, tree, TAG_CONFIGURATIONS, NULL, NULL, MXML_DESCEND_FIRST)) {
// Configuration XML
writeConfiguration(xml);
sendData(NULL, 0, RESPONSE_ACK);
- logg->logMessage("Received configuration xml");
+ logg.logMessage("Received configuration xml");
} else {
// Unknown XML
- logg->logMessage("Received unknown XML delivery type");
+ logg.logMessage("Received unknown XML delivery type");
sendData(NULL, 0, RESPONSE_NAK);
}
@@ -222,7 +222,7 @@ void StreamlineSetup::sendDefaults() {
// Artificial size restriction
if (size > 1024*1024) {
- logg->logError("Corrupt default configuration file");
+ logg.logError("Corrupt default configuration file");
handleException();
}
@@ -240,8 +240,11 @@ void StreamlineSetup::sendCounters() {
count += driver->writeCounters(counters);
}
+ mxml_node_t *setup = mxmlNewElement(counters, "setup_warnings");
+ mxmlNewText(setup, 0, logg.getSetup());
+
if (count == 0) {
- logg->logError("No counters found, this could be because /dev/gator/events can not be read or because perf is not working correctly");
+ logg.logError("No counters found, this could be because /dev/gator/events can not be read or because perf is not working correctly");
handleException();
}
@@ -257,16 +260,16 @@ void StreamlineSetup::writeConfiguration(char* xml) {
ConfigurationXML::getPath(path);
- if (util->writeToDisk(path, xml) < 0) {
- logg->logError("Error writing %s\nPlease verify write permissions to this path.", path);
+ if (writeToDisk(path, xml) < 0) {
+ logg.logError("Error writing %s\nPlease verify write permissions to this path.", path);
handleException();
}
// Re-populate gSessionData with the configuration, as it has now changed
{ ConfigurationXML configuration; }
- if (gSessionData->mCountersError != NULL) {
- logg->logError("%s", gSessionData->mCountersError);
+ if (gSessionData.mCountersError != NULL) {
+ logg.logError("%s", gSessionData.mCountersError);
handleException();
}
}
diff --git a/tools/gator/daemon/UEvent.cpp b/tools/gator/daemon/UEvent.cpp
index 6a69f5ab137e..3b0447a2257b 100644
--- a/tools/gator/daemon/UEvent.cpp
+++ b/tools/gator/daemon/UEvent.cpp
@@ -34,7 +34,7 @@ UEvent::~UEvent() {
bool UEvent::init() {
mFd = socket_cloexec(PF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
if (mFd < 0) {
- logg->logMessage("socket failed");
+ logg.logMessage("socket failed");
return false;
}
@@ -44,7 +44,7 @@ bool UEvent::init() {
sockaddr.nl_groups = 1; // bitmask: (1 << 0) == kernel events, (1 << 1) == udev events
sockaddr.nl_pid = 0;
if (bind(mFd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != 0) {
- logg->logMessage("bind failed");
+ logg.logMessage("bind failed");
return false;
}
@@ -54,7 +54,7 @@ bool UEvent::init() {
bool UEvent::read(UEventResult *const result) {
ssize_t bytes = recv(mFd, result->mBuf, sizeof(result->mBuf), 0);
if (bytes <= 0) {
- logg->logMessage("recv failed");
+ logg.logMessage("recv failed");
return false;
}
@@ -64,7 +64,7 @@ bool UEvent::read(UEventResult *const result) {
for (int pos = 0; pos < bytes; pos += strlen(result->mBuf + pos) + 1) {
char *const str = result->mBuf + pos;
- logg->logMessage("uevent + %i: %s", pos, str);
+ logg.logMessage("uevent + %i: %s", pos, str);
if (strncmp(str, ACTION, sizeof(ACTION) - 1) == 0) {
result->mAction = str + sizeof(ACTION) - 1;
} else if (strncmp(str, DEVPATH, sizeof(DEVPATH) - 1) == 0) {
diff --git a/tools/gator/daemon/UserSpaceSource.cpp b/tools/gator/daemon/UserSpaceSource.cpp
index 103631248bf3..6b9565b802be 100644
--- a/tools/gator/daemon/UserSpaceSource.cpp
+++ b/tools/gator/daemon/UserSpaceSource.cpp
@@ -21,7 +21,7 @@
extern Child *child;
-UserSpaceSource::UserSpaceSource(sem_t *senderSem) : mBuffer(0, FRAME_BLOCK_COUNTER, gSessionData->mTotalBufferSize*1024*1024, senderSem) {
+UserSpaceSource::UserSpaceSource(sem_t *senderSem) : mBuffer(0, FRAME_BLOCK_COUNTER, gSessionData.mTotalBufferSize*1024*1024, senderSem) {
}
UserSpaceSource::~UserSpaceSource() {
@@ -34,45 +34,45 @@ bool UserSpaceSource::prepare() {
void UserSpaceSource::run() {
prctl(PR_SET_NAME, (unsigned long)&"gatord-counters", 0, 0, 0);
- for (int i = 0; i < ARRAY_LENGTH(gSessionData->mUsDrivers); ++i) {
- gSessionData->mUsDrivers[i]->start();
+ for (int i = 0; i < ARRAY_LENGTH(gSessionData.mUsDrivers); ++i) {
+ gSessionData.mUsDrivers[i]->start();
}
int64_t monotonicStarted = 0;
- while (monotonicStarted <= 0 && gSessionData->mSessionIsActive) {
+ while (monotonicStarted <= 0 && gSessionData.mSessionIsActive) {
usleep(10);
- if (gSessionData->mPerf.isSetup()) {
- monotonicStarted = gSessionData->mMonotonicStarted;
+ if (gSessionData.mPerf.isSetup()) {
+ monotonicStarted = gSessionData.mMonotonicStarted;
} else {
if (DriverSource::readInt64Driver("/dev/gator/started", &monotonicStarted) == -1) {
- logg->logError("Error reading gator driver start time");
+ logg.logError("Error reading gator driver start time");
handleException();
}
- gSessionData->mMonotonicStarted = monotonicStarted;
+ gSessionData.mMonotonicStarted = monotonicStarted;
}
}
uint64_t nextTime = 0;
- while (gSessionData->mSessionIsActive) {
+ while (gSessionData.mSessionIsActive) {
const uint64_t currTime = getTime() - monotonicStarted;
- // Sample ten times a second ignoring gSessionData->mSampleRate
- nextTime += NS_PER_S/10;//gSessionData->mSampleRate;
+ // Sample ten times a second ignoring gSessionData.mSampleRate
+ nextTime += NS_PER_S/10;//gSessionData.mSampleRate;
if (nextTime < currTime) {
- logg->logMessage("Too slow, currTime: %" PRIi64 " nextTime: %" PRIi64, currTime, nextTime);
+ logg.logMessage("Too slow, currTime: %" PRIi64 " nextTime: %" PRIi64, currTime, nextTime);
nextTime = currTime;
}
if (mBuffer.eventHeader(currTime)) {
- for (int i = 0; i < ARRAY_LENGTH(gSessionData->mUsDrivers); ++i) {
- gSessionData->mUsDrivers[i]->read(&mBuffer);
+ for (int i = 0; i < ARRAY_LENGTH(gSessionData.mUsDrivers); ++i) {
+ gSessionData.mUsDrivers[i]->read(&mBuffer);
}
// Only check after writing all counters so that time and corresponding counters appear in the same frame
mBuffer.check(currTime);
}
- if (gSessionData->mOneShot && gSessionData->mSessionIsActive && (mBuffer.bytesAvailable() <= 0)) {
- logg->logMessage("One shot (counters)");
+ if (gSessionData.mOneShot && gSessionData.mSessionIsActive && (mBuffer.bytesAvailable() <= 0)) {
+ logg.logMessage("One shot (counters)");
child->endSession();
}
diff --git a/tools/gator/daemon/common.mk b/tools/gator/daemon/common.mk
index 0d5a0a835d2c..344abd27fc83 100644
--- a/tools/gator/daemon/common.mk
+++ b/tools/gator/daemon/common.mk
@@ -5,7 +5,7 @@
# -Werror treats warnings as errors
# -std=c++0x is the planned new c++ standard
# -std=c++98 is the 1998 c++ standard
-CPPFLAGS += -O3 -Wall -fno-exceptions -pthread -MMD -DETCDIR=\"/etc\" -Ilibsensors
+CPPFLAGS += -O3 -Wall -fno-exceptions -pthread -MD -DETCDIR=\"/etc\" -Ilibsensors
CXXFLAGS += -fno-rtti -Wextra -Wshadow # -Weffc++
ifeq ($(WERROR),1)
CPPFLAGS += -Werror
@@ -24,9 +24,11 @@ events.xml: events_header.xml $(wildcard events-*.xml) events_footer.xml
include $(wildcard *.d)
include $(wildcard mxml/*.d)
+include $(wildcard libsensors/*.d)
EventsXML.cpp: events_xml.h
ConfigurationXML.cpp: defaults_xml.h
+PmuXML.cpp: pmus_xml.h
# Don't regenerate conf-lex.c or conf-parse.c
libsensors/conf-lex.c: ;
@@ -52,4 +54,4 @@ escape: escape.c
gcc $^ -o $@
clean:
- rm -f *.d *.o mxml/*.d mxml/*.o libsensors/*.d libsensors/*.o $(TARGET) escape events.xml events_xml.h defaults_xml.h SrcMd5.cpp
+ rm -f *.d *.o mxml/*.d mxml/*.o libsensors/*.d libsensors/*.o $(TARGET) escape events.xml *_xml.h SrcMd5.cpp
diff --git a/tools/gator/daemon/defaults.xml b/tools/gator/daemon/defaults.xml
index 9adde32667dc..06f307d4d4ff 100644
--- a/tools/gator/daemon/defaults.xml
+++ b/tools/gator/daemon/defaults.xml
@@ -49,6 +49,11 @@
<configuration counter="ARMv8_Cortex_A72_cnt1" event="0x16"/>
<configuration counter="ARMv8_Cortex_A72_cnt2" event="0x10"/>
<configuration counter="ARMv8_Cortex_A72_cnt3" event="0x19"/>
+ <configuration counter="ARMv8_Exynos_M1_ccnt" event="0x11"/>
+ <configuration counter="ARMv8_Exynos_M1_cnt0" event="0x8"/>
+ <configuration counter="ARMv8_Exynos_M1_cnt1" event="0x16"/>
+ <configuration counter="ARMv8_Exynos_M1_cnt2" event="0x10"/>
+ <configuration counter="ARMv8_Exynos_M1_cnt3" event="0x19"/>
<configuration counter="Scorpion_ccnt" event="0xff"/>
<configuration counter="Scorpion_cnt0" event="0x08"/>
<configuration counter="Scorpion_cnt1" event="0x10"/>
@@ -64,6 +69,8 @@
<configuration counter="Linux_meminfo_memused2"/>
<configuration counter="Linux_meminfo_memfree"/>
<configuration counter="Linux_power_cpu_freq"/>
+ <configuration counter="Linux_cpu_system"/>
+ <configuration counter="Linux_cpu_user"/>
<configuration counter="ARM_Mali-4xx_fragment"/>
<configuration counter="ARM_Mali-4xx_vertex"/>
<configuration counter="ARM_Mali-Midgard_fragment" cores="1"/>
diff --git a/tools/gator/daemon/events-Cortex-A5.xml b/tools/gator/daemon/events-Cortex-A5.xml
index 9fd48abbd571..4b5a5efcb952 100644
--- a/tools/gator/daemon/events-Cortex-A5.xml
+++ b/tools/gator/daemon/events-Cortex-A5.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Data read or write operation that causes a refill at (at least) the lowest level of data or unified cache. Counts the number of allocations performed in the Data Cache because of a read or a write."/>
<event event="0x04" title="Cache" name="Data access" description="Data read or write operation that causes a cache access at (at least) the lowest level of data or unified cache. This includes speculative reads."/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Data read or write operation that causes a TLB refill at (at least) the lowest level of TLB. This does not include micro TLB misses because of PLD, PLI, CP15 Cache operation by MVA and CP15 VA to PA operations."/>
- <event event="0x06" title="Instruction" name="Memory read" description="Data read architecturally executed. Counts the number of data read instructions accepted by the Load Store Unit. This includes counting the speculative and aborted LDR/LDM, and the reads because of the SWP instructions."/>
- <event event="0x07" title="Instruction" name="Memory write" description="Data write architecturally executed. Counts the number of data write instructions accepted by the Load Store Unit. This includes counting the speculative and aborted STR/STM, and the writes because of the SWP instructions."/>
+ <event event="0x06" title="Instruction" name="Load" description="Data read architecturally executed. Counts the number of data read instructions accepted by the Load Store Unit. This includes counting the speculative and aborted LDR/LDM, and the reads because of the SWP instructions."/>
+ <event event="0x07" title="Instruction" name="Store" description="Data write architecturally executed. Counts the number of data write instructions accepted by the Load Store Unit. This includes counting the speculative and aborted STR/STM, and the writes because of the SWP instructions."/>
<event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
<event event="0x09" title="Exception" name="Taken" description="Exception taken. Counts the number of exceptions architecturally taken."/>
<event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed"/>
diff --git a/tools/gator/daemon/events-Cortex-A7.xml b/tools/gator/daemon/events-Cortex-A7.xml
index 22fa9b7a4148..3bcbf04708dd 100644
--- a/tools/gator/daemon/events-Cortex-A7.xml
+++ b/tools/gator/daemon/events-Cortex-A7.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Data read or write operation that causes a refill at (at least) the lowest level of data or unified cache. Counts the number of allocations performed in the Data Cache because of a read or a write."/>
<event event="0x04" title="Cache" name="Data access" description="Data read or write operation that causes a cache access at (at least) the lowest level of data or unified cache. This includes speculative reads."/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Data read or write operation that causes a TLB refill at (at least) the lowest level of TLB. This does not include micro TLB misses because of PLD, PLI, CP15 Cache operation by MVA and CP15 VA to PA operations."/>
- <event event="0x06" title="Instruction" name="Memory Read" description="Data read architecturally executed. Counts the number of data read instructions accepted by the Load Store Unit. This includes counting the speculative and aborted LDR/LDM, and the reads because of the SWP instructions."/>
- <event event="0x07" title="Instruction" name="Memory write" description="Data write architecturally executed. Counts the number of data write instructions accepted by the Load Store Unit. This includes counting the speculative and aborted STR/STM, and the writes because of the SWP instructions."/>
+ <event event="0x06" title="Instruction" name="Load" description="Data read architecturally executed. Counts the number of data read instructions accepted by the Load Store Unit. This includes counting the speculative and aborted LDR/LDM, and the reads because of the SWP instructions."/>
+ <event event="0x07" title="Instruction" name="Store" description="Data write architecturally executed. Counts the number of data write instructions accepted by the Load Store Unit. This includes counting the speculative and aborted STR/STM, and the writes because of the SWP instructions."/>
<event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
<event event="0x09" title="Exception" name="Taken" description="Exception taken. Counts the number of exceptions architecturally taken."/>
<event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed"/>
diff --git a/tools/gator/daemon/events-Cortex-A8.xml b/tools/gator/daemon/events-Cortex-A8.xml
index 7056efd35fe3..b7c28c0027ff 100644
--- a/tools/gator/daemon/events-Cortex-A8.xml
+++ b/tools/gator/daemon/events-Cortex-A8.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Data read or write operation that causes a refill at the lowest level of data or unified cache. Each data read from or write to normal cacheable memory that causes a refill from outside of the cache is counted. Accesses that do not cause a new cache refill, but are satisfied from refilling data of a previous miss are not counted. Each access to a cache line to normal cacheable memory that causes a new linefill is counted, including the multiple transaction of instructions such as LDM or STM, PUSH and POP. Write-through writes that hit in the cache do not cause a linefill and so are not counted. CP15 cache maintenance operations do not count as events. This counter increments for speculative data accesses and for data accesses that are explicitly made by instructions."/>
<event event="0x04" title="Cache" name="Data access" description="Data read or write operation that causes a cache access at the lowest level of data or unified cache. Each access to a cache line to normal cacheable memory is counted including the multiple transaction of instructions such as LDM or STM. CP15 cache maintenance operations do not count as events. This counter increments for speculative data accesses and for data accesses that are explicitly made by instructions."/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Data read or write operation that causes a TLB refill at the lowest level of TLB. Each data read or write operation that causes a translation table walk or an access to another level of TLB caching is counted. CP15 TLB maintenance operations do not count as events. This counter increments for speculative data accesses and for data accesses that are explicitly made by instructions."/>
- <event event="0x06" title="Instruction" name="Memory read" description="Data read architecturally executed. This counter increments for every instruction that explicitly read data, including SWP. This counter only increments for instructions that are unconditional or that pass their condition codes."/>
- <event event="0x07" title="Instruction" name="Memory write" description="Data write architecturally executed. The counter increments for every instruction that explicitly wrote data, including SWP. This counter only increments for instructions that are unconditional or that pass their condition codes."/>
+ <event event="0x06" title="Instruction" name="Load" description="Data read architecturally executed. This counter increments for every instruction that explicitly read data, including SWP. This counter only increments for instructions that are unconditional or that pass their condition codes."/>
+ <event event="0x07" title="Instruction" name="Store" description="Data write architecturally executed. The counter increments for every instruction that explicitly wrote data, including SWP. This counter only increments for instructions that are unconditional or that pass their condition codes."/>
<event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed. This counter counts for all instructions, including conditional instructions that fail their condition codes."/>
<event event="0x09" title="Exception" name="Taken" description="Exception taken. This counts for each exception taken."/>
<event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed. This counter only increments for instructions that are unconditional or that pass their condition codes."/>
diff --git a/tools/gator/daemon/events-Cortex-A9.xml b/tools/gator/daemon/events-Cortex-A9.xml
index e17c03d7a632..3498ec0b575f 100644
--- a/tools/gator/daemon/events-Cortex-A9.xml
+++ b/tools/gator/daemon/events-Cortex-A9.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Memory Read or Write operation that causes a refill of at least the level of data or unified cache closest to the processor"/>
<event event="0x04" title="Cache" name="Data access" description="Memory Read or Write operation that causes a cache access to at least the level of data or unified cache closest to the processor"/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Memory Read or Write operation that causes a TLB refill of at least the level of TLB closest to the processor"/>
- <event event="0x06" title="Instruction" name="Memory read" description="Memory-reading instruction architecturally executed"/>
- <event event="0x07" title="Instruction" name="Memory write" description="Memory-writing instruction architecturally executed"/>
+ <event event="0x06" title="Instruction" name="Load" description="Memory-reading instruction architecturally executed"/>
+ <event event="0x07" title="Instruction" name="Store" description="Memory-writing instruction architecturally executed"/>
<event event="0x09" title="Exception" name="Taken" description="Exception taken"/>
<event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed"/>
<event event="0x0b" title="Instruction" name="CONTEXTIDR" description="Instruction that writes to the CONTEXTIDR architecturally executed"/>
diff --git a/tools/gator/daemon/events-Exynos-M1.xml b/tools/gator/daemon/events-Exynos-M1.xml
new file mode 100644
index 000000000000..da576df3e56f
--- /dev/null
+++ b/tools/gator/daemon/events-Exynos-M1.xml
@@ -0,0 +1,89 @@
+ <counter_set name="ARMv8_Exynos_M1_cnt" count="6"/>
+ <category name="Exynos-M1" counter_set="ARMv8_Exynos_M1_cnt" per_cpu="yes" supports_event_based_sampling="yes">
+ <event counter="ARMv8_Exynos_M1_ccnt" event="0x11" title="Clock" name="Cycles" display="hertz" units="Hz" average_selection="yes" average_cores="yes" description="The number of core clock cycles"/>
+ <event event="0x00" title="Software" name="Increment" description="Instruction architecturally executed - Software increment"/>
+ <event event="0x01" title="Cache" name="Instruction refill" description="L1 instruction cache refill"/>
+ <event event="0x02" title="Cache" name="Inst TLB refill" description="L1 instruction TLB refill"/>
+ <event event="0x03" title="Cache" name="Data refill" description="L1 data cache refill"/>
+ <event event="0x04" title="Cache" name="Data access" description="L1 data cache access"/>
+ <event event="0x05" title="Cache" name="Data TLB refill" description="L1 data TLB refill"/>
+ <event event="0x06" title="Instruction" name="Data Read" description="Architecturally executed load"/>
+ <event event="0x07" title="Instruction" name="Memory write" description="Architecturally executed store"/>
+ <event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
+ <event event="0x09" title="Exception" name="Taken" description="Exception taken"/>
+ <event event="0x0a" title="Exception" name="Return" description="Architecturally executed exception return"/>
+ <event event="0x0b" title="Instruction" name="CONTEXTIDR" description="Architecturally executed write to CONTEXTIDR"/>
+ <event event="0x0c" title="Branch" name="PC change" description="Architecturally executed software change of PC"/>
+ <event event="0x0d" title="Branch" name="Immediate" description="Architecturally executed immediate branch"/>
+ <event event="0x0e" title="Procedure" name="Return" description="Architecturally executed procedure return"/>
+ <event event="0x0f" title="Memory" name="Unaligned access" description="Architecturally executed unaligned load or store"/>
+ <event event="0x10" title="Branch" name="Mispredicted" description="Mispredicted or not predicted branch (speculatively executed)"/>
+ <event event="0x12" title="Branch" name="Potential prediction" description="Predictable branch (speculative executed)"/>
+ <event event="0x13" title="Memory" name="Memory access" description="Data memory access"/>
+ <event event="0x14" title="Cache" name="L1 inst access" description="L1 instruction cache access"/>
+ <event event="0x15" title="Cache" name="L1 data write" description="L1 data cache write-back"/>
+ <event event="0x16" title="Cache" name="L2 data access" description="L2 data cache access"/>
+ <event event="0x17" title="Cache" name="L2 data refill" description="L2 data cache refill"/>
+ <event event="0x18" title="Cache" name="L2 data write" description="L2 data cache write-back"/>
+ <event event="0x19" title="Bus" name="Access" description="Bus access"/>
+ <event event="0x1a" title="Memory" name="Error" description="Local memory error"/>
+ <event event="0x1b" title="Instruction" name="Speculative" description="Instruction speculatively executed"/>
+ <event event="0x1c" title="Memory" name="Translation table" description="Architecturally executed write to translation table base"/>
+ <event event="0x1d" title="Bus" name="Cycle" description="Bus cycle"/>
+ <event event="0x1e" title="Counter chain" name="Odd Performance" description="For odd-numbered counters, counts once for each overflow of the preceding even-numbered counter"/>
+ <event event="0x1f" title="Cache" name="L1 data cache allocation" description="L1 data cache allocation without refill"/>
+ <event event="0x20" title="Cache" name="L2 data cache allocation" description="L2 data cache allocation without refill"/>
+ <event event="0x40" title="Cache" name="L1 data read" description="L1 data cache access - Read"/>
+ <event event="0x41" title="Cache" name="L1 data access write" description="L1 data cache access - Write"/>
+ <event event="0x42" title="Cache" name="L1 data refill read" description="L1 data cache refill - Read"/>
+ <event event="0x43" title="Cache" name="L1 data refill write" description="L1 data cache refill - Write"/>
+ <event event="0x46" title="Cache" name="L1 data victim" description="L1 data cache write-back - Victim"/>
+ <event event="0x47" title="Cache" name="L1 data clean" description="L1 data cache write-back - Cleaning and coherency"/>
+ <event event="0x4c" title="Cache" name="L1 TLB refill read" description="L1 data TLB refill - Read"/>
+ <event event="0x4d" title="Cache" name="L1 TLB refill write" description="L1 data TLB refill - Write"/>
+ <event event="0x50" title="Cache" name="L2 data read" description="L2 data cache access - Read"/>
+ <event event="0x51" title="Cache" name="L2 data access write" description="L2 data cache access - Write"/>
+ <event event="0x52" title="Cache" name="L2 data refill read" description="L2 data cache refill - Read"/>
+ <event event="0x53" title="Cache" name="L2 data refill write" description="L2 data cache refill - Write"/>
+ <event event="0x56" title="Cache" name="L2 data victim" description="L2 data cache write-back - Victim"/>
+ <event event="0x60" title="Bus" name="Read" description="Bus access - Read"/>
+ <event event="0x61" title="Bus" name="Write" description="Bus access - Write"/>
+ <event event="0x66" title="Memory" name="Read" description="Data memory access -Read"/>
+ <event event="0x67" title="Memory" name="Write" description="Data memory access -Write"/>
+ <event event="0x68" title="Memory" name="Unaligned Read" description="Unaligned access - Read"/>
+ <event event="0x69" title="Memory" name="Unaligned Write" description="Unaligned access - Write"/>
+ <event event="0x6a" title="Memory" name="Unaligned" description="Unaligned access"/>
+ <event event="0x6c" title="Intrinsic" name="LDREX" description="Speculatively executed LDREX"/>
+ <event event="0x6d" title="Intrinsic" name="STREX pass" description="Speculatively executed STREX pass"/>
+ <event event="0x6e" title="Intrinsic" name="STREX fail" description="Speculatively executed STREX fail"/>
+ <event event="0x6f" title="Intrinsic" name="STREX" description="Speculatively executed STREX"/>
+ <event event="0x70" title="Instruction" name="Load" description="Speculatively executed Load"/>
+ <event event="0x71" title="Instruction" name="Store" description="Speculatively executed Store"/>
+ <event event="0x72" title="Instruction" name="Load/Store" description="Speculatively executed Load or Store"/>
+ <event event="0x73" title="Instruction" name="Integer" description="Speculatively executed Data processing"/>
+ <event event="0x74" title="Instruction" name="Advanced SIMD" description="Speculatively executed Advanced SIMD"/>
+ <event event="0x75" title="Instruction" name="VFP" description="Speculatively executed VFP"/>
+ <event event="0x76" title="Instruction" name="Software change" description="Speculatively executed S/W change of the PC"/>
+ <event event="0x77" title="Instruction" name="Crypto" description="Speculatively executed Crypto data processing"/>
+ <event event="0x78" title="Branch" name="Immediate Spec" description="Speculatively executed Immediate branch"/>
+ <event event="0x79" title="Procedure" name="Return Spec" description="Speculatively executed Procedure return"/>
+ <event event="0x7a" title="Branch" name="Indirect" description="Speculatively executed Indirect branch"/>
+ <event event="0x7c" title="Instruction" name="ISB" description="Speculatively executed ISB"/>
+ <event event="0x7d" title="Instruction" name="DSB" description="Speculatively executed DSB"/>
+ <event event="0x7e" title="Instruction" name="DMB" description="Speculatively executed DMB"/>
+ <event event="0x81" title="Exception" name="Undefined" description="Exception taken - Undefined instruction"/>
+ <event event="0x82" title="Exception" name="Supervisor" description="Exception taken - Supervisor call"/>
+ <event event="0x83" title="Exception" name="Prefetch abort" description="Exception taken - Prefetch abort"/>
+ <event event="0x84" title="Exception" name="Data abort" description="Exception taken - Data abort"/>
+ <event event="0x86" title="Interrupts" name="IRQ" description="Exception taken - IRQ"/>
+ <event event="0x87" title="Interrupts" name="FIQ" description="Exception taken - FIQ"/>
+ <event event="0x88" title="Exception" name="Secure monitor call" description="Exception taken - Secure Monitor Call"/>
+ <event event="0x8a" title="Exception" name="Hypervisor call" description="Exception taken - Hypervisor call"/>
+ <event event="0x8b" title="Exception" name="Instruction abort non-local" description="Exception taken - Prefetch abort not taken locally"/>
+ <event event="0x8c" title="Exception" name="Data abort non-local" description="Exception taken - Data abort not taken locally"/>
+ <event event="0x8d" title="Exception" name="Other Hypervisor traps" description="Exception taken - Other Hypervisor traps"/>
+ <event event="0x8e" title="Exception" name="IRQ non-local" description="Exception taken - IRQ not taken locally"/>
+ <event event="0x8f" title="Exception" name="FIQ non-local" description="Exception taken - FIQ not taken locally"/>
+ <event event="0x90" title="Release Consistency" name="Load" description="Speculatively executed Load acquire"/>
+ <event event="0x91" title="Release Consistency" name="Store" description="Speculatively executed Store release"/>
+ </category>
diff --git a/tools/gator/daemon/events-Krait-architected.xml b/tools/gator/daemon/events-Krait-architected.xml
index b8d3bcb48de7..fa02e179d36b 100644
--- a/tools/gator/daemon/events-Krait-architected.xml
+++ b/tools/gator/daemon/events-Krait-architected.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Memory Read or Write operation that causes a refill of at least the level of data or unified cache closest to the processor"/>
<event event="0x04" title="Cache" name="Data access" description="Memory Read or Write operation that causes a cache access to at least the level of data or unified cache closest to the processor"/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Memory Read or Write operation that causes a TLB refill of at least the level of TLB closest to the processor"/>
- <event event="0x06" title="Instruction" name="Memory read" description="Memory-reading instruction architecturally executed"/>
- <event event="0x07" title="Instruction" name="Memory write" description="Memory-writing instruction architecturally executed"/>
+ <event event="0x06" title="Instruction" name="Load" description="Memory-reading instruction architecturally executed"/>
+ <event event="0x07" title="Instruction" name="Store" description="Memory-writing instruction architecturally executed"/>
<event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
<event event="0x09" title="Exception" name="Taken" description="Exceptions taken"/>
<event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed"/>
diff --git a/tools/gator/daemon/events-Linux.xml b/tools/gator/daemon/events-Linux.xml
index 0350c0c4b57b..1b1a6af87a6f 100644
--- a/tools/gator/daemon/events-Linux.xml
+++ b/tools/gator/daemon/events-Linux.xml
@@ -11,7 +11,9 @@
<event counter="Linux_meminfo_memfree" title="Memory" name="Free" class="absolute" display="minimum" units="B" description="Available memory size"/>
<event counter="Linux_meminfo_bufferram" title="Memory" name="Buffer" class="absolute" units="B" description="Memory used by OS disk buffers"/>
<event counter="Linux_power_cpu_freq" title="Clock" name="Frequency" per_cpu="yes" class="absolute" units="Hz" series_composition="overlay" average_cores="yes" description="Frequency setting of the CPU"/>
- <event counter="Linux_cpu_wait_contention" title="CPU Contention" name="Wait" per_cpu="no" class="activity" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" multiplier="0.0001" color="0x003c96fb" description="One or more threads are runnable but waiting due to CPU contention"/>
- <event counter="Linux_cpu_wait_io" title="CPU I/O" name="Wait" per_cpu="no" class="activity" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" multiplier="0.0001" color="0x00b30000" description="One or more threads are blocked on an I/O resource"/>
+ <event counter="Linux_cpu_wait_contention" title="CPU Contention" name="Wait" class="activity" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" multiplier="0.0001" color="0x003c96fb" description="One or more threads are runnable but waiting due to CPU contention"/>
+ <event counter="Linux_cpu_wait_io" title="CPU I/O" name="Wait" class="activity" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" multiplier="0.0001" color="0x00b30000" description="One or more threads are blocked on an I/O resource"/>
+ <event counter="Linux_cpu_system" title="CPU Activity" name="System" per_cpu="yes" class="activity" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" multiplier="0.0001" color="0x00DF4742" average_cores="yes" description="Linux System activity"/><!-- cores="needs to be dynamically set" -->
+ <event counter="Linux_cpu_user" title="CPU Activity" name="User" per_cpu="yes" class="activity" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" multiplier="0.0001" color="0x003ADF43" average_cores="yes" description="Linux User activity"/><!-- cores="needs to be dynamically set" -->
<event counter="Linux_power_cpu" title="CPU Status" name="Activity" class="activity" activity1="Off" activity_color1="0x0000ff00" activity2="WFI" activity_color2="0x000000ff" rendering_type="bar" average_selection="yes" average_cores="yes" percentage="yes" description="CPU Status"/>
</category>
diff --git a/tools/gator/daemon/events-Mali-4xx.xml b/tools/gator/daemon/events-Mali-4xx.xml
index e2f4405719c2..3807eeceae34 100644
--- a/tools/gator/daemon/events-Mali-4xx.xml
+++ b/tools/gator/daemon/events-Mali-4xx.xml
@@ -197,7 +197,7 @@
<event event="0x0400" option_set="fs" title="ARM Mali-4xx" name="Filmstrip" description="Scaled framebuffer"/>
</category>
<category name="ARM_Mali-4xx_Voltage" per_cpu="no">
- <event counter="ARM_Mali-4xx_Voltage" title="Mali GPU Voltage" name="Voltage" class="absolute" display="average" average_selection="yes" units="mV" description="GPU core voltage."/>
+ <event counter="ARM_Mali-4xx_Voltage" title="Mali GPU Voltage" name="Voltage" class="absolute" display="average" average_selection="yes" units="V" multiplier="0.001" description="GPU core voltage."/>
</category>
<category name="ARM_Mali-4xx_Frequency" per_cpu="no">
<event counter="ARM_Mali-4xx_Frequency" title="Mali GPU Frequency" name="Frequency" class="absolute" display="average" average_selection="yes" units="MHz" description="GPU core frequency."/>
@@ -247,10 +247,10 @@
<event counter="ARM_Mali-4xx_Total_alloc_pages" title="Mali GPU Alloc" name="pages" class="absolute" display="average" average_selection="yes" description="Total number of allocated pages"/>
</category>
<category name="Mali-4xx Session Memory usage" per_cpu="no">
- <event counter="ARM_Mali-4xx_vertex_index_buffer" title="Mali Memory" name="Vertex and Index buffer" units="B" dclass="absolute" display="average" average_selection="yes" description="Vertex and index input"/>
- <event counter="ARM_Mali-4xx_texture_buffer" title="Mali Memory" name="Texture buffer" units="B" dclass="absolute" display="average" average_selection="yes" description="Texture data"/>
- <event counter="ARM_Mali-4xx_varying_buffer" title="Mali Memory" name="Varying buffer" units="B" dclass="absolute" display="average" average_selection="yes" description="Varying buffer"/>
- <event counter="ARM_Mali-4xx_render_target" title="Mali Memory" name="Render target buffer" units="B" dclass="absolute" display="average" average_selection="yes" description="Render target buffer"/>
- <event counter="ARM_Mali-4xx_plbu_heap" title="Mali Memory" name="Plbu heap" units="B" dclass="absolute" display="average" average_selection="yes" description="The memory to store commands from PLBU when Slave tilelist memory isn't enough"/>
- <event counter="ARM_Mali-4xx_slave_tilelist" title="Mali Memory" name="Slave tilelist" units="B" dclass="absolute" display="average" average_selection="yes" description="Slave tilelist memory"/>
+ <event counter="ARM_Mali-4xx_vertex_index_buffer" title="Mali Memory" name="Vertex and Index buffer" units="B" class="absolute" display="average" average_selection="yes" description="Vertex and index input"/>
+ <event counter="ARM_Mali-4xx_texture_buffer" title="Mali Memory" name="Texture buffer" units="B" class="absolute" display="average" average_selection="yes" description="Texture data"/>
+ <event counter="ARM_Mali-4xx_varying_buffer" title="Mali Memory" name="Varying buffer" units="B" class="absolute" display="average" average_selection="yes" description="Varying buffer"/>
+ <event counter="ARM_Mali-4xx_render_target" title="Mali Memory" name="Render target buffer" units="B" class="absolute" display="average" average_selection="yes" description="Render target buffer"/>
+ <event counter="ARM_Mali-4xx_plbu_heap" title="Mali Memory" name="Plbu heap" units="B" class="absolute" display="average" average_selection="yes" description="The memory to store commands from PLBU when Slave tilelist memory isn't enough"/>
+ <event counter="ARM_Mali-4xx_slave_tilelist" title="Mali Memory" name="Slave tilelist" units="B" class="absolute" display="average" average_selection="yes" description="Slave tilelist memory"/>
</category>
diff --git a/tools/gator/daemon/events-Mali-Midgard.xml b/tools/gator/daemon/events-Mali-Midgard.xml
index 33c1a406225d..737555b0dbf0 100644
--- a/tools/gator/daemon/events-Mali-Midgard.xml
+++ b/tools/gator/daemon/events-Mali-Midgard.xml
@@ -36,11 +36,32 @@ power management is disabled during profiling so these counters are not useful a
<counter_set name="ARM_Mali-Midgard_Filmstrip_cnt" count="1"/>
<category name="Mali-Midgard Filmstrip" counter_set="ARM_Mali-Midgard_Filmstrip_cnt" per_cpu="no">
<option_set name="fs">
- <option event_delta="0x3c" name="1:60" description="captures every 60th frame"/>
- <option event_delta="0x1e" name="1:30" description="captures every 30th frame"/>
- <option event_delta="0xa" name="1:10" description="captures every 10th frame"/>
+ <option event_delta="0x043c" name="1:60 s" description="captures every 60th frame at 1:4 scale"/>
+ <option event_delta="0x041e" name="1:30 s" description="captures every 30th frame at 1:4 scale"/>
+ <option event_delta="0x040a" name="1:10 s" description="captures every 10th frame at 1:4 scale"/>
+ <option event_delta="0x023c" name="1:60 m" description="captures every 60th frame at 1:2 scale"/>
+ <option event_delta="0x021e" name="1:30 m" description="captures every 30th frame at 1:2 scale"/>
+ <option event_delta="0x020a" name="1:10 m" description="captures every 10th frame at 1:2 scale"/>
+ <option event_delta="0x013c" name="1:60 l" description="captures every 60th frame at 1:1 scale"/>
+ <option event_delta="0x011e" name="1:30 l" description="captures every 30th frame at 1:1 scale"/>
+ <option event_delta="0x01-a" name="1:10 l" description="captures every 10th frame at 1:1 scale"/>
</option_set>
- <event event="0x0400" option_set="fs" title="ARM Mali-Midgard" name="Filmstrip" description="Scaled framebuffer"/>
+ <event event="0" option_set="fs" title="ARM Mali-Midgard" name="Filmstrip" description="Scaled framebuffer"/>
+ </category>
+ <counter_set name="ARM_Mali-Midgard_Filmstrip2_cnt" count="1"/>
+ <category name="Mali-Midgard Filmstrip" counter_set="ARM_Mali-Midgard_Filmstrip2_cnt" per_cpu="no">
+ <option_set name="fs">
+ <option event_delta="0x1400f03c" name="1:60 s" description="captures every 60th frame at ~320x240"/>
+ <option event_delta="0x1400f01e" name="1:30 s" description="captures every 30th frame at ~320x240"/>
+ <option event_delta="0x1400f00a" name="1:10 s" description="captures every 10th frame at ~320x240"/>
+ <option event_delta="0x2801e03c" name="1:60 m" description="captures every 60th frame at ~640x480"/>
+ <option event_delta="0x2801e01e" name="1:30 m" description="captures every 30th frame at ~640x480"/>
+ <option event_delta="0x2801e00a" name="1:10 m" description="captures every 10th frame at ~640x480"/>
+ <option event_delta="0x5003c03c" name="1:60 l" description="captures every 60th frame at ~1280x960"/>
+ <option event_delta="0x5003c01e" name="1:30 l" description="captures every 30th frame at ~1280x960"/>
+ <option event_delta="0x5003c00a" name="1:10 l" description="captures every 10th frame at ~1280x960"/>
+ </option_set>
+ <event event="0" option_set="fs" title="ARM Mali-Midgard" name="Filmstrip" description="Scaled framebuffer"/>
</category>
<category name="Mali-Midgard Activity" per_cpu="no">
<event counter="ARM_Mali-Midgard_fragment" title="GPU Fragment" name="Activity" class="activity" activity1="Activity" activity_color1="0x00006fcc" rendering_type="bar" average_selection="yes" percentage="yes" cores="1" description="GPU Job Slot 0 Activity"/>
diff --git a/tools/gator/daemon/events-Mali-T60x_hw.xml b/tools/gator/daemon/events-Mali-T60x_hw.xml
index c35bcd11d798..fc3f56289598 100644
--- a/tools/gator/daemon/events-Mali-T60x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T60x_hw.xml
@@ -1,38 +1,28 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T60x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T60x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T60x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T60x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T60x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T60x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T60x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T60x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T60x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T60x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T60x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T60x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T60x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T60x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T60x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T60x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T60x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T60x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T60x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T60x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T60x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T60x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
<event counter="ARM_Mali-T60x_TI_LEVEL0" title="Mali Tiler Hierarchy" name="L0 prims" description="Number of primitives in hierarchy level 0"/>
<event counter="ARM_Mali-T60x_TI_LEVEL1" title="Mali Tiler Hierarchy" name="L1 prims" description="Number of primitives in hierarchy level 1"/>
<event counter="ARM_Mali-T60x_TI_LEVEL2" title="Mali Tiler Hierarchy" name="L2 prims" description="Number of primitives in hierarchy level 2"/>
@@ -41,76 +31,53 @@
<event counter="ARM_Mali-T60x_TI_LEVEL5" title="Mali Tiler Hierarchy" name="L5 prims" description="Number of primitives in hierarchy level 5"/>
<event counter="ARM_Mali-T60x_TI_LEVEL6" title="Mali Tiler Hierarchy" name="L6 prims" description="Number of primitives in hierarchy level 6"/>
<event counter="ARM_Mali-T60x_TI_LEVEL7" title="Mali Tiler Hierarchy" name="L7 prims" description="Number of primitives in hierarchy level 7"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T60x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T60x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T60x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T60x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
-
<event counter="ARM_Mali-T60x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T60x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T60x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T60x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T60x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T60x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T60x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T60x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T60x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T60x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T60x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T60x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T60x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T60x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of instructions completed by the the A-pipe (normalized per pipeline)"/>
-
<event counter="ARM_Mali-T60x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T60x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T60x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T60x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
<event counter="ARM_Mali-T60x_TEX_RECIRC_FMISS" title="Mali Texture Pipe" name="Cache misses" description="Number of instructions in the T-pipe, recirculated due to cache miss"/>
-
<event counter="ARM_Mali-T60x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
<event counter="ARM_Mali-T60x_LSC_READ_MISSES" title="Mali Load/Store Cache Reads" name="Read misses" description="Number of read misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T60x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
<event counter="ARM_Mali-T60x_LSC_WRITE_MISSES" title="Mali Load/Store Cache Writes" name="Write misses" description="Number of write misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T60x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
<event counter="ARM_Mali-T60x_LSC_ATOMIC_MISSES" title="Mali Load/Store Cache Atomics" name="Atomic misses" description="Number of atomic misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T60x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T60x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
-
<event counter="ARM_Mali-T60x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T60x_L2_READ_LOOKUP" title="Mali L2 Cache Reads" name="L2 read lookups" description="Number of reads into the L2 cache"/>
<event counter="ARM_Mali-T60x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T60x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T60x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T60x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
<event counter="ARM_Mali-T60x_L2_WRITE_LOOKUP" title="Mali L2 Cache Writes" name="L2 write lookups" description="Number of writes into the L2 cache"/>
-
<event counter="ARM_Mali-T60x_L2_EXT_READ_BEATS" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T60x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T60x_L2_EXT_R_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus response buffer full" description="Number of cycles a valid request is blocked by a full response buffer"/>
<event counter="ARM_Mali-T60x_L2_EXT_RD_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus read data buffer full" description="Number of cycles a valid request is blocked by a full read data buffer"/>
-
<event counter="ARM_Mali-T60x_L2_EXT_WRITE_BEATS" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T60x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T60x_L2_EXT_W_BUF_FULL" title="Mali L2 Cache Ext Writes" name="External bus write buffer full" description="Number of cycles a valid request is blocked by a full write buffer"/>
-
- </category> \ No newline at end of file
+ </category>
diff --git a/tools/gator/daemon/events-Mali-T62x_hw.xml b/tools/gator/daemon/events-Mali-T62x_hw.xml
index 4bc93068f75b..a98a70b05e54 100644
--- a/tools/gator/daemon/events-Mali-T62x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T62x_hw.xml
@@ -1,38 +1,28 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T62x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T62x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T62x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T62x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T62x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T62x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T62x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T62x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T62x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T62x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T62x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T62x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T62x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T62x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T62x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T62x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T62x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T62x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T62x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T62x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T62x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T62x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
<event counter="ARM_Mali-T62x_TI_LEVEL0" title="Mali Tiler Hierarchy" name="L0 prims" description="Number of primitives in hierarchy level 0"/>
<event counter="ARM_Mali-T62x_TI_LEVEL1" title="Mali Tiler Hierarchy" name="L1 prims" description="Number of primitives in hierarchy level 1"/>
<event counter="ARM_Mali-T62x_TI_LEVEL2" title="Mali Tiler Hierarchy" name="L2 prims" description="Number of primitives in hierarchy level 2"/>
@@ -41,76 +31,54 @@
<event counter="ARM_Mali-T62x_TI_LEVEL5" title="Mali Tiler Hierarchy" name="L5 prims" description="Number of primitives in hierarchy level 5"/>
<event counter="ARM_Mali-T62x_TI_LEVEL6" title="Mali Tiler Hierarchy" name="L6 prims" description="Number of primitives in hierarchy level 6"/>
<event counter="ARM_Mali-T62x_TI_LEVEL7" title="Mali Tiler Hierarchy" name="L7 prims" description="Number of primitives in hierarchy level 7"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T62x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T62x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T62x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T62x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
<event counter="ARM_Mali-T62x_FRAG_CYCLES_FPKQ_ACTIVE" title="Mali Core Cycles" name="Fragment cycles pre-pipe buffer not empty" description="Number of cycles the pre-pipe queue contains quads"/>
-
<event counter="ARM_Mali-T62x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T62x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T62x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T62x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T62x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T62x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T62x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T62x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T62x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T62x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T62x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T62x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T62x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T62x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of instructions completed by the the A-pipe (normalized per pipeline)"/>
-
<event counter="ARM_Mali-T62x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T62x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T62x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T62x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
<event counter="ARM_Mali-T62x_TEX_RECIRC_FMISS" title="Mali Texture Pipe" name="Cache misses" description="Number of instructions in the T-pipe, recirculated due to cache miss"/>
-
<event counter="ARM_Mali-T62x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
<event counter="ARM_Mali-T62x_LSC_READ_MISSES" title="Mali Load/Store Cache Reads" name="Read misses" description="Number of read misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T62x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
<event counter="ARM_Mali-T62x_LSC_WRITE_MISSES" title="Mali Load/Store Cache Writes" name="Write misses" description="Number of write misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T62x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
<event counter="ARM_Mali-T62x_LSC_ATOMIC_MISSES" title="Mali Load/Store Cache Atomics" name="Atomic misses" description="Number of atomic misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T62x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T62x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
<event counter="ARM_Mali-T62x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T62x_L2_READ_LOOKUP" title="Mali L2 Cache Reads" name="L2 read lookups" description="Number of reads into the L2 cache"/>
<event counter="ARM_Mali-T62x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T62x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T62x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T62x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
<event counter="ARM_Mali-T62x_L2_WRITE_LOOKUP" title="Mali L2 Cache Writes" name="L2 write lookups" description="Number of writes into the L2 cache"/>
-
<event counter="ARM_Mali-T62x_L2_EXT_READ_BEATS" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T62x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T62x_L2_EXT_R_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus response buffer full" description="Number of cycles a valid request is blocked by a full response buffer"/>
<event counter="ARM_Mali-T62x_L2_EXT_RD_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus read data buffer full" description="Number of cycles a valid request is blocked by a full read data buffer"/>
-
<event counter="ARM_Mali-T62x_L2_EXT_WRITE_BEATS" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T62x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T62x_L2_EXT_W_BUF_FULL" title="Mali L2 Cache Ext Writes" name="External bus write buffer full" description="Number of cycles a valid request is blocked by a full write buffer"/>
-
- </category> \ No newline at end of file
+ </category>
diff --git a/tools/gator/daemon/events-Mali-T72x_hw.xml b/tools/gator/daemon/events-Mali-T72x_hw.xml
index fd9cb0f16c6e..b66bfef5c44c 100644
--- a/tools/gator/daemon/events-Mali-T72x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T72x_hw.xml
@@ -1,101 +1,69 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T72x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T72x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T72x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T72x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T72x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T72x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T72x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T72x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T72x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T72x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T72x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T72x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T72x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T72x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T72x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T72x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T72x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T72x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T72x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T72x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T72x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T72x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T72x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T72x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T72x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T72x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
-
<event counter="ARM_Mali-T72x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T72x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T72x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T72x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T72x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T72x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T72x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T72x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T72x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T72x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T72x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T72x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T72x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T72x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of batched instructions executed by the A-pipe"/>
-
<event counter="ARM_Mali-T72x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T72x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T72x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T72x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
-
-
<event counter="ARM_Mali-T72x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
<event counter="ARM_Mali-T72x_LSC_READ_MISSES" title="Mali Load/Store Cache Reads" name="Read misses" description="Number of read misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T72x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
<event counter="ARM_Mali-T72x_LSC_WRITE_MISSES" title="Mali Load/Store Cache Writes" name="Write misses" description="Number of write misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T72x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
<event counter="ARM_Mali-T72x_LSC_ATOMIC_MISSES" title="Mali Load/Store Cache Atomics" name="Atomic misses" description="Number of atomic misses in the Load/Store cache"/>
-
<event counter="ARM_Mali-T72x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T72x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
<event counter="ARM_Mali-T72x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T72x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T72x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T72x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T72x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T72x_L2_EXT_READ_BEAT" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T72x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
-
<event counter="ARM_Mali-T72x_L2_EXT_WRITE_BEAT" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T72x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
-
</category>
diff --git a/tools/gator/daemon/events-Mali-T76x_hw.xml b/tools/gator/daemon/events-Mali-T76x_hw.xml
index 94d059fc09dd..9a1bd8dbc1c3 100644
--- a/tools/gator/daemon/events-Mali-T76x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T76x_hw.xml
@@ -1,38 +1,28 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T76x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T76x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T76x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T76x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T76x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T76x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T76x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T76x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T76x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T76x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T76x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T76x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T76x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T76x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T76x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T76x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T76x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T76x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T76x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T76x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T76x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T76x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
<event counter="ARM_Mali-T76x_TI_LEVEL0" title="Mali Tiler Hierarchy" name="L0 prims" description="Number of primitives in hierarchy level 0"/>
<event counter="ARM_Mali-T76x_TI_LEVEL1" title="Mali Tiler Hierarchy" name="L1 prims" description="Number of primitives in hierarchy level 1"/>
<event counter="ARM_Mali-T76x_TI_LEVEL2" title="Mali Tiler Hierarchy" name="L2 prims" description="Number of primitives in hierarchy level 2"/>
@@ -41,77 +31,54 @@
<event counter="ARM_Mali-T76x_TI_LEVEL5" title="Mali Tiler Hierarchy" name="L5 prims" description="Number of primitives in hierarchy level 5"/>
<event counter="ARM_Mali-T76x_TI_LEVEL6" title="Mali Tiler Hierarchy" name="L6 prims" description="Number of primitives in hierarchy level 6"/>
<event counter="ARM_Mali-T76x_TI_LEVEL7" title="Mali Tiler Hierarchy" name="L7 prims" description="Number of primitives in hierarchy level 7"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T76x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T76x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T76x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T76x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
<event counter="ARM_Mali-T76x_FRAG_CYCLES_FPKQ_ACTIVE" title="Mali Core Cycles" name="Fragment cycles pre-pipe buffer not empty" description="Number of cycles the pre-pipe queue contains quads"/>
-
<event counter="ARM_Mali-T76x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T76x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T76x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T76x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T76x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T76x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T76x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T76x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T76x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T76x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T76x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T76x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T76x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T76x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of instructions completed by the the A-pipe (normalized per pipeline)"/>
-
<event counter="ARM_Mali-T76x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T76x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T76x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T76x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
<event counter="ARM_Mali-T76x_TEX_RECIRC_FMISS" title="Mali Texture Pipe" name="Cache misses" description="Number of instructions in the T-pipe, recirculated due to cache miss"/>
-
<event counter="ARM_Mali-T76x_LSC_READ_OP" title="Mali Load/Store Cache Reads" name="Read operations" description="Number of read operations in the Load/Store cache"/>
<event counter="ARM_Mali-T76x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T76x_LSC_WRITE_OP" title="Mali Load/Store Cache Writes" name="Write operations" description="Number of write operations in the Load/Store cache"/>
<event counter="ARM_Mali-T76x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T76x_LSC_ATOMIC_OP" title="Mali Load/Store Cache Atomics" name="Atomic operations" description="Number of atomic operations in the Load/Store cache"/>
<event counter="ARM_Mali-T76x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T76x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T76x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
-
<event counter="ARM_Mali-T76x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T76x_L2_READ_LOOKUP" title="Mali L2 Cache Reads" name="L2 read lookups" description="Number of reads into the L2 cache"/>
<event counter="ARM_Mali-T76x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T76x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T76x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T76x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
<event counter="ARM_Mali-T76x_L2_WRITE_LOOKUP" title="Mali L2 Cache Writes" name="L2 write lookups" description="Number of writes into the L2 cache"/>
-
<event counter="ARM_Mali-T76x_L2_EXT_READ_BEATS" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T76x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T76x_L2_EXT_R_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus response buffer full" description="Number of cycles a valid request is blocked by a full response buffer"/>
<event counter="ARM_Mali-T76x_L2_EXT_RD_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus read data buffer full" description="Number of cycles a valid request is blocked by a full read data buffer"/>
-
<event counter="ARM_Mali-T76x_L2_EXT_WRITE_BEATS" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T76x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T76x_L2_EXT_W_BUF_FULL" title="Mali L2 Cache Ext Writes" name="External bus write buffer full" description="Number of cycles a valid request is blocked by a full write buffer"/>
-
- </category> \ No newline at end of file
+ </category>
diff --git a/tools/gator/daemon/events-Mali-T82x_hw.xml b/tools/gator/daemon/events-Mali-T82x_hw.xml
index 994c8b154189..4aa35627638a 100644
--- a/tools/gator/daemon/events-Mali-T82x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T82x_hw.xml
@@ -1,108 +1,76 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T82x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T82x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T82x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T82x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T82x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T82x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T82x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T82x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T82x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T82x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T82x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T82x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T82x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T82x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T82x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T82x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T82x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T82x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T82x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T82x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T82x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T82x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T82x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T82x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T82x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T82x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
<event counter="ARM_Mali-T82x_FRAG_CYCLES_FPKQ_ACTIVE" title="Mali Core Cycles" name="Fragment cycles pre-pipe buffer not empty" description="Number of cycles the pre-pipe queue contains quads"/>
-
<event counter="ARM_Mali-T82x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T82x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T82x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T82x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T82x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T82x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T82x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T82x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T82x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T82x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T82x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T82x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T82x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T82x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of batched instructions executed by the A-pipe (normalized per pipe)"/>
-
<event counter="ARM_Mali-T82x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T82x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T82x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T82x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
<event counter="ARM_Mali-T82x_TEX_RECIRC_FMISS" title="Mali Texture Pipe" name="Cache misses" description="Number of instructions in the T-pipe, recirculated due to cache miss"/>
-
<event counter="ARM_Mali-T82x_LSC_READ_OP" title="Mali Load/Store Cache Reads" name="Read operations" description="Number of read operations in the Load/Store cache"/>
<event counter="ARM_Mali-T82x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T82x_LSC_WRITE_OP" title="Mali Load/Store Cache Writes" name="Write operations" description="Number of write operations in the Load/Store cache"/>
<event counter="ARM_Mali-T82x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T82x_LSC_ATOMIC_OP" title="Mali Load/Store Cache Atomics" name="Atomic operations" description="Number of atomic operations in the Load/Store cache"/>
<event counter="ARM_Mali-T82x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T82x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T82x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
-
<event counter="ARM_Mali-T82x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T82x_L2_READ_LOOKUP" title="Mali L2 Cache Reads" name="L2 read lookups" description="Number of reads into the L2 cache"/>
<event counter="ARM_Mali-T82x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T82x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T82x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T82x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
<event counter="ARM_Mali-T82x_L2_WRITE_LOOKUP" title="Mali L2 Cache Writes" name="L2 write lookups" description="Number of writes into the L2 cache"/>
-
<event counter="ARM_Mali-T82x_L2_EXT_READ_BEATS" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T82x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T82x_L2_EXT_R_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus response buffer full" description="Number of cycles a valid request is blocked by a full response buffer"/>
<event counter="ARM_Mali-T82x_L2_EXT_RD_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus read data buffer full" description="Number of cycles a valid request is blocked by a full read data buffer"/>
-
<event counter="ARM_Mali-T82x_L2_EXT_WRITE_BEATS" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T82x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T82x_L2_EXT_W_BUF_FULL" title="Mali L2 Cache Ext Writes" name="External bus write buffer full" description="Number of cycles a valid request is blocked by a full write buffer"/>
-
</category>
diff --git a/tools/gator/daemon/events-Mali-T83x_hw.xml b/tools/gator/daemon/events-Mali-T83x_hw.xml
index 39f7acf31798..a71eb03d6bd0 100644
--- a/tools/gator/daemon/events-Mali-T83x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T83x_hw.xml
@@ -1,108 +1,76 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T83x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T83x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T83x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T83x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T83x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T83x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T83x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T83x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T83x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T83x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T83x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T83x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T83x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T83x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T83x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T83x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T83x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T83x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T83x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T83x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T83x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T83x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T83x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T83x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T83x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T83x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
<event counter="ARM_Mali-T83x_FRAG_CYCLES_FPKQ_ACTIVE" title="Mali Core Cycles" name="Fragment cycles pre-pipe buffer not empty" description="Number of cycles the pre-pipe queue contains quads"/>
-
<event counter="ARM_Mali-T83x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T83x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T83x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T83x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T83x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T83x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T83x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T83x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T83x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T83x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T83x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T83x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T83x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T83x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of batched instructions executed by the A-pipe (normalized per pipe)"/>
-
<event counter="ARM_Mali-T83x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T83x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T83x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T83x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
<event counter="ARM_Mali-T83x_TEX_RECIRC_FMISS" title="Mali Texture Pipe" name="Cache misses" description="Number of instructions in the T-pipe, recirculated due to cache miss"/>
-
<event counter="ARM_Mali-T83x_LSC_READ_OP" title="Mali Load/Store Cache Reads" name="Read operations" description="Number of read operations in the Load/Store cache"/>
<event counter="ARM_Mali-T83x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T83x_LSC_WRITE_OP" title="Mali Load/Store Cache Writes" name="Write operations" description="Number of write operations in the Load/Store cache"/>
<event counter="ARM_Mali-T83x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T83x_LSC_ATOMIC_OP" title="Mali Load/Store Cache Atomics" name="Atomic operations" description="Number of atomic operations in the Load/Store cache"/>
<event counter="ARM_Mali-T83x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T83x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T83x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
-
<event counter="ARM_Mali-T83x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T83x_L2_READ_LOOKUP" title="Mali L2 Cache Reads" name="L2 read lookups" description="Number of reads into the L2 cache"/>
<event counter="ARM_Mali-T83x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T83x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T83x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T83x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
<event counter="ARM_Mali-T83x_L2_WRITE_LOOKUP" title="Mali L2 Cache Writes" name="L2 write lookups" description="Number of writes into the L2 cache"/>
-
<event counter="ARM_Mali-T83x_L2_EXT_READ_BEATS" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T83x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T83x_L2_EXT_R_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus response buffer full" description="Number of cycles a valid request is blocked by a full response buffer"/>
<event counter="ARM_Mali-T83x_L2_EXT_RD_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus read data buffer full" description="Number of cycles a valid request is blocked by a full read data buffer"/>
-
<event counter="ARM_Mali-T83x_L2_EXT_WRITE_BEATS" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T83x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T83x_L2_EXT_W_BUF_FULL" title="Mali L2 Cache Ext Writes" name="External bus write buffer full" description="Number of cycles a valid request is blocked by a full write buffer"/>
-
</category>
diff --git a/tools/gator/daemon/events-Mali-T86x_hw.xml b/tools/gator/daemon/events-Mali-T86x_hw.xml
index 6653543d5caa..4f74051f5936 100644
--- a/tools/gator/daemon/events-Mali-T86x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T86x_hw.xml
@@ -1,38 +1,28 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T86x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T86x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T86x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T86x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T86x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T86x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T86x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T86x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T86x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T86x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T86x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T86x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T86x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T86x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T86x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T86x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T86x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T86x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T86x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T86x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T86x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T86x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
<event counter="ARM_Mali-T86x_TI_LEVEL0" title="Mali Tiler Hierarchy" name="L0 prims" description="Number of primitives in hierarchy level 0"/>
<event counter="ARM_Mali-T86x_TI_LEVEL1" title="Mali Tiler Hierarchy" name="L1 prims" description="Number of primitives in hierarchy level 1"/>
<event counter="ARM_Mali-T86x_TI_LEVEL2" title="Mali Tiler Hierarchy" name="L2 prims" description="Number of primitives in hierarchy level 2"/>
@@ -41,77 +31,54 @@
<event counter="ARM_Mali-T86x_TI_LEVEL5" title="Mali Tiler Hierarchy" name="L5 prims" description="Number of primitives in hierarchy level 5"/>
<event counter="ARM_Mali-T86x_TI_LEVEL6" title="Mali Tiler Hierarchy" name="L6 prims" description="Number of primitives in hierarchy level 6"/>
<event counter="ARM_Mali-T86x_TI_LEVEL7" title="Mali Tiler Hierarchy" name="L7 prims" description="Number of primitives in hierarchy level 7"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T86x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T86x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T86x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T86x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
<event counter="ARM_Mali-T86x_FRAG_CYCLES_FPKQ_ACTIVE" title="Mali Core Cycles" name="Fragment cycles pre-pipe buffer not empty" description="Number of cycles the pre-pipe queue contains quads"/>
-
<event counter="ARM_Mali-T86x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T86x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T86x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T86x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T86x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T86x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T86x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T86x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T86x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T86x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T86x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T86x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T86x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T86x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of instructions completed by the the A-pipe (normalized per pipeline)"/>
-
<event counter="ARM_Mali-T86x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T86x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T86x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T86x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
<event counter="ARM_Mali-T86x_TEX_RECIRC_FMISS" title="Mali Texture Pipe" name="Cache misses" description="Number of instructions in the T-pipe, recirculated due to cache miss"/>
-
<event counter="ARM_Mali-T86x_LSC_READ_OP" title="Mali Load/Store Cache Reads" name="Read operations" description="Number of read operations in the Load/Store cache"/>
<event counter="ARM_Mali-T86x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T86x_LSC_WRITE_OP" title="Mali Load/Store Cache Writes" name="Write operations" description="Number of write operations in the Load/Store cache"/>
<event counter="ARM_Mali-T86x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T86x_LSC_ATOMIC_OP" title="Mali Load/Store Cache Atomics" name="Atomic operations" description="Number of atomic operations in the Load/Store cache"/>
<event counter="ARM_Mali-T86x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T86x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T86x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
-
<event counter="ARM_Mali-T86x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T86x_L2_READ_LOOKUP" title="Mali L2 Cache Reads" name="L2 read lookups" description="Number of reads into the L2 cache"/>
<event counter="ARM_Mali-T86x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T86x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T86x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T86x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
<event counter="ARM_Mali-T86x_L2_WRITE_LOOKUP" title="Mali L2 Cache Writes" name="L2 write lookups" description="Number of writes into the L2 cache"/>
-
<event counter="ARM_Mali-T86x_L2_EXT_READ_BEATS" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T86x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T86x_L2_EXT_R_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus response buffer full" description="Number of cycles a valid request is blocked by a full response buffer"/>
<event counter="ARM_Mali-T86x_L2_EXT_RD_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus read data buffer full" description="Number of cycles a valid request is blocked by a full read data buffer"/>
-
<event counter="ARM_Mali-T86x_L2_EXT_WRITE_BEATS" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T86x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T86x_L2_EXT_W_BUF_FULL" title="Mali L2 Cache Ext Writes" name="External bus write buffer full" description="Number of cycles a valid request is blocked by a full write buffer"/>
-
</category>
diff --git a/tools/gator/daemon/events-Mali-T88x_hw.xml b/tools/gator/daemon/events-Mali-T88x_hw.xml
index 19385d19c9de..a9173f2b780e 100644
--- a/tools/gator/daemon/events-Mali-T88x_hw.xml
+++ b/tools/gator/daemon/events-Mali-T88x_hw.xml
@@ -1,38 +1,28 @@
-
<category name="Mali Job Manager" per_cpu="no">
-
<event counter="ARM_Mali-T88x_GPU_ACTIVE" title="Mali Job Manager Cycles" name="GPU cycles" description="Number of cycles GPU active"/>
<event counter="ARM_Mali-T88x_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles GPU interrupt pending"/>
<event counter="ARM_Mali-T88x_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) active"/>
<event counter="ARM_Mali-T88x_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) active"/>
<event counter="ARM_Mali-T88x_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) active"/>
-
<event counter="ARM_Mali-T88x_JS0_JOBS" title="Mali Job Manager Jobs" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
<event counter="ARM_Mali-T88x_JS1_JOBS" title="Mali Job Manager Jobs" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
<event counter="ARM_Mali-T88x_JS2_JOBS" title="Mali Job Manager Jobs" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
-
<event counter="ARM_Mali-T88x_JS0_TASKS" title="Mali Job Manager Tasks" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
<event counter="ARM_Mali-T88x_JS1_TASKS" title="Mali Job Manager Tasks" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
<event counter="ARM_Mali-T88x_JS2_TASKS" title="Mali Job Manager Tasks" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
-
</category>
-
<category name="Mali Tiler" per_cpu="no">
-
<event counter="ARM_Mali-T88x_TI_ACTIVE" title="Mali Tiler Cycles" name="Tiler cycles" description="Number of cycles Tiler active"/>
-
<event counter="ARM_Mali-T88x_TI_POLYGONS" title="Mali Tiler Primitives" name="Polygons" description="Number of polygons processed"/>
<event counter="ARM_Mali-T88x_TI_QUADS" title="Mali Tiler Primitives" name="Quads" description="Number of quads processed"/>
<event counter="ARM_Mali-T88x_TI_TRIANGLES" title="Mali Tiler Primitives" name="Triangles" description="Number of triangles processed"/>
<event counter="ARM_Mali-T88x_TI_LINES" title="Mali Tiler Primitives" name="Lines" description="Number of lines processed"/>
<event counter="ARM_Mali-T88x_TI_POINTS" title="Mali Tiler Primitives" name="Points" description="Number of points processed"/>
-
<event counter="ARM_Mali-T88x_TI_FRONT_FACING" title="Mali Tiler Culling" name="Front facing prims" description="Number of front facing primitives"/>
<event counter="ARM_Mali-T88x_TI_BACK_FACING" title="Mali Tiler Culling" name="Back facing prims" description="Number of back facing primitives"/>
<event counter="ARM_Mali-T88x_TI_PRIM_VISIBLE" title="Mali Tiler Culling" name="Visible prims" description="Number of visible primitives"/>
<event counter="ARM_Mali-T88x_TI_PRIM_CULLED" title="Mali Tiler Culling" name="Culled prims" description="Number of culled primitives"/>
<event counter="ARM_Mali-T88x_TI_PRIM_CLIPPED" title="Mali Tiler Culling" name="Clipped prims" description="Number of clipped primitives"/>
-
<event counter="ARM_Mali-T88x_TI_LEVEL0" title="Mali Tiler Hierarchy" name="L0 prims" description="Number of primitives in hierarchy level 0"/>
<event counter="ARM_Mali-T88x_TI_LEVEL1" title="Mali Tiler Hierarchy" name="L1 prims" description="Number of primitives in hierarchy level 1"/>
<event counter="ARM_Mali-T88x_TI_LEVEL2" title="Mali Tiler Hierarchy" name="L2 prims" description="Number of primitives in hierarchy level 2"/>
@@ -41,77 +31,54 @@
<event counter="ARM_Mali-T88x_TI_LEVEL5" title="Mali Tiler Hierarchy" name="L5 prims" description="Number of primitives in hierarchy level 5"/>
<event counter="ARM_Mali-T88x_TI_LEVEL6" title="Mali Tiler Hierarchy" name="L6 prims" description="Number of primitives in hierarchy level 6"/>
<event counter="ARM_Mali-T88x_TI_LEVEL7" title="Mali Tiler Hierarchy" name="L7 prims" description="Number of primitives in hierarchy level 7"/>
-
</category>
-
<category name="Mali Shader Core" per_cpu="no">
-
<event counter="ARM_Mali-T88x_TRIPIPE_ACTIVE" title="Mali Core Cycles" name="Tripipe cycles" description="Number of cycles tripipe was active"/>
<event counter="ARM_Mali-T88x_FRAG_ACTIVE" title="Mali Core Cycles" name="Fragment cycles" description="Number of cycles fragment processing was active"/>
<event counter="ARM_Mali-T88x_COMPUTE_ACTIVE" title="Mali Core Cycles" name="Compute cycles" description="Number of cycles vertex\compute processing was active"/>
<event counter="ARM_Mali-T88x_FRAG_CYCLES_NO_TILE" title="Mali Core Cycles" name="Fragment cycles waiting for tile" description="Number of cycles spent waiting for a physical tile buffer"/>
<event counter="ARM_Mali-T88x_FRAG_CYCLES_FPKQ_ACTIVE" title="Mali Core Cycles" name="Fragment cycles pre-pipe buffer not empty" description="Number of cycles the pre-pipe queue contains quads"/>
-
<event counter="ARM_Mali-T88x_FRAG_THREADS" title="Mali Fragment Threads" name="Fragment threads" description="Number of fragment threads started"/>
<event counter="ARM_Mali-T88x_FRAG_DUMMY_THREADS" title="Mali Fragment Threads" name="Dummy fragment threads" description="Number of dummy fragment threads started"/>
<event counter="ARM_Mali-T88x_FRAG_THREADS_LZS_TEST" title="Mali Fragment Threads" name="Fragment threads doing late ZS" description="Number of threads doing late ZS test"/>
<event counter="ARM_Mali-T88x_FRAG_THREADS_LZS_KILLED" title="Mali Fragment Threads" name="Fragment threads killed late ZS" description="Number of threads killed by late ZS test"/>
-
<event counter="ARM_Mali-T88x_COMPUTE_TASKS" title="Mali Compute Tasks" name="Compute tasks" description="Number of compute tasks"/>
<event counter="ARM_Mali-T88x_COMPUTE_THREADS" title="Mali Compute Threads" name="Compute threads" description="Number of compute threads started"/>
-
<event counter="ARM_Mali-T88x_FRAG_PRIMITIVES" title="Mali Fragment Primitives" name="Primitives loaded" description="Number of primitives loaded from tiler"/>
<event counter="ARM_Mali-T88x_FRAG_PRIMITIVES_DROPPED" title="Mali Fragment Primitives" name="Primitives dropped" description="Number of primitives dropped because out of tile"/>
-
<event counter="ARM_Mali-T88x_FRAG_QUADS_RAST" title="Mali Fragment Quads" name="Quads rasterized" description="Number of quads rasterized"/>
<event counter="ARM_Mali-T88x_FRAG_QUADS_EZS_TEST" title="Mali Fragment Quads" name="Quads doing early ZS" description="Number of quads doing early ZS test"/>
<event counter="ARM_Mali-T88x_FRAG_QUADS_EZS_KILLED" title="Mali Fragment Quads" name="Quads killed early Z" description="Number of quads killed by early ZS test"/>
-
<event counter="ARM_Mali-T88x_FRAG_NUM_TILES" title="Mali Fragment Tasks" name="Tiles rendered" description="Number of tiles rendered"/>
<event counter="ARM_Mali-T88x_FRAG_TRANS_ELIM" title="Mali Fragment Tasks" name="Tile writes killed by TE" description="Number of tile writes skipped by transaction elimination"/>
-
<event counter="ARM_Mali-T88x_ARITH_WORDS" title="Mali Arithmetic Pipe" name="A instructions" description="Number of instructions completed by the the A-pipe (normalized per pipeline)"/>
-
<event counter="ARM_Mali-T88x_LS_WORDS" title="Mali Load/Store Pipe" name="LS instructions" description="Number of instructions completed by the LS-pipe"/>
<event counter="ARM_Mali-T88x_LS_ISSUES" title="Mali Load/Store Pipe" name="LS instruction issues" description="Number of instructions issued to the LS-pipe, including restarts"/>
-
<event counter="ARM_Mali-T88x_TEX_WORDS" title="Mali Texture Pipe" name="T instructions" description="Number of instructions completed by the T-pipe"/>
<event counter="ARM_Mali-T88x_TEX_ISSUES" title="Mali Texture Pipe" name="T instruction issues" description="Number of threads through loop 2 address calculation"/>
<event counter="ARM_Mali-T88x_TEX_RECIRC_FMISS" title="Mali Texture Pipe" name="Cache misses" description="Number of instructions in the T-pipe, recirculated due to cache miss"/>
-
<event counter="ARM_Mali-T88x_LSC_READ_OP" title="Mali Load/Store Cache Reads" name="Read operations" description="Number of read operations in the Load/Store cache"/>
<event counter="ARM_Mali-T88x_LSC_READ_HITS" title="Mali Load/Store Cache Reads" name="Read hits" description="Number of read hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T88x_LSC_WRITE_OP" title="Mali Load/Store Cache Writes" name="Write operations" description="Number of write operations in the Load/Store cache"/>
<event counter="ARM_Mali-T88x_LSC_WRITE_HITS" title="Mali Load/Store Cache Writes" name="Write hits" description="Number of write hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T88x_LSC_ATOMIC_OP" title="Mali Load/Store Cache Atomics" name="Atomic operations" description="Number of atomic operations in the Load/Store cache"/>
<event counter="ARM_Mali-T88x_LSC_ATOMIC_HITS" title="Mali Load/Store Cache Atomics" name="Atomic hits" description="Number of atomic hits in the Load/Store cache"/>
-
<event counter="ARM_Mali-T88x_LSC_LINE_FETCHES" title="Mali Load/Store Cache Bus" name="Line fetches" description="Number of line fetches in the Load/Store cache"/>
<event counter="ARM_Mali-T88x_LSC_DIRTY_LINE" title="Mali Load/Store Cache Bus" name="Dirty line evictions" description="Number of dirty line evictions in the Load/Store cache"/>
-
<event counter="ARM_Mali-T88x_LSC_SNOOPS" title="Mali Load/Store Cache Bus" name="Snoops in to LSC" description="Number of coherent memory snoops in to the Load/Store cache"/>
-
</category>
-
<category name="Mali L2 Cache" per_cpu="no">
-
<event counter="ARM_Mali-T88x_L2_READ_LOOKUP" title="Mali L2 Cache Reads" name="L2 read lookups" description="Number of reads into the L2 cache"/>
<event counter="ARM_Mali-T88x_L2_READ_SNOOP" title="Mali L2 Cache Reads" name="Read snoops" description="Number of read transaction snoops"/>
<event counter="ARM_Mali-T88x_L2_READ_HIT" title="Mali L2 Cache Reads" name="L2 read hits" description="Number of reads hitting in the L2 cache"/>
-
<event counter="ARM_Mali-T88x_L2_WRITE_SNOOP" title="Mali L2 Cache Writes" name="Write snoops" description="Number of write transaction snoops"/>
<event counter="ARM_Mali-T88x_L2_WRITE_HIT" title="Mali L2 Cache Writes" name="L2 write hits" description="Number of writes hitting in the L2 cache"/>
<event counter="ARM_Mali-T88x_L2_WRITE_LOOKUP" title="Mali L2 Cache Writes" name="L2 write lookups" description="Number of writes into the L2 cache"/>
-
<event counter="ARM_Mali-T88x_L2_EXT_READ_BEATS" title="Mali L2 Cache Ext Reads" name="External read beats" description="Number of external bus read beats"/>
<event counter="ARM_Mali-T88x_L2_EXT_AR_STALL" title="Mali L2 Cache Ext Reads" name="External bus stalls (AR)" description="Number of cycles a valid read address (AR) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T88x_L2_EXT_R_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus response buffer full" description="Number of cycles a valid request is blocked by a full response buffer"/>
<event counter="ARM_Mali-T88x_L2_EXT_RD_BUF_FULL" title="Mali L2 Cache Ext Reads" name="External bus read data buffer full" description="Number of cycles a valid request is blocked by a full read data buffer"/>
-
<event counter="ARM_Mali-T88x_L2_EXT_WRITE_BEATS" title="Mali L2 Cache Ext Writes" name="External write beats" description="Number of external bus write beats"/>
<event counter="ARM_Mali-T88x_L2_EXT_W_STALL" title="Mali L2 Cache Ext Writes" name="External bus stalls (W)" description="Number of cycles a valid write data (W channel) is stalled by the external interconnect"/>
<event counter="ARM_Mali-T88x_L2_EXT_W_BUF_FULL" title="Mali L2 Cache Ext Writes" name="External bus write buffer full" description="Number of cycles a valid request is blocked by a full write buffer"/>
-
</category>
diff --git a/tools/gator/daemon/events-Other.xml b/tools/gator/daemon/events-Other.xml
index 8aec282b7e11..88e8b20e7001 100644
--- a/tools/gator/daemon/events-Other.xml
+++ b/tools/gator/daemon/events-Other.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Level 1 data cache refill"/>
<event event="0x04" title="Cache" name="Data access" description="Level 1 data cache access"/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Level 1 data TLB refill"/>
- <event event="0x06" title="Instruction" name="Memory read" description="Instruction architecturally executed, condition code check pass, load"/>
- <event event="0x07" title="Instruction" name="Memory write" description="Instruction architecturally executed, condition code check pass, store"/>
+ <event event="0x06" title="Instruction" name="Load" description="Instruction architecturally executed, condition code check pass, load"/>
+ <event event="0x07" title="Instruction" name="Store" description="Instruction architecturally executed, condition code check pass, store"/>
<event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
<event event="0x09" title="Exception" name="Taken" description="Exception taken"/>
<event event="0x0a" title="Exception" name="Return" description="Instruction architecturally executed, condition code check pass, exception return"/>
diff --git a/tools/gator/daemon/events-Scorpion.xml b/tools/gator/daemon/events-Scorpion.xml
index fa716fdc4840..e3cba38c9941 100644
--- a/tools/gator/daemon/events-Scorpion.xml
+++ b/tools/gator/daemon/events-Scorpion.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Memory Read or Write operation that causes a refill of at least the level of data or unified cache closest to the processor"/>
<event event="0x04" title="Cache" name="Data access" description="Memory Read or Write operation that causes a cache access to at least the level of data or unified cache closest to the processor"/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Memory Read or Write operation that causes a TLB refill of at least the level of TLB closest to the processor"/>
- <event event="0x06" title="Instruction" name="Memory read" description="Memory-reading instruction architecturally executed"/>
- <event event="0x07" title="Instruction" name="Memory write" description="Memory-writing instruction architecturally executed"/>
+ <event event="0x06" title="Instruction" name="Load" description="Memory-reading instruction architecturally executed"/>
+ <event event="0x07" title="Instruction" name="Store" description="Memory-writing instruction architecturally executed"/>
<event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
<event event="0x09" title="Exception" name="Taken" description="Exceptions taken"/>
<event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed"/>
diff --git a/tools/gator/daemon/events-ScorpionMP.xml b/tools/gator/daemon/events-ScorpionMP.xml
index c648ccefb287..77c8855a2c51 100644
--- a/tools/gator/daemon/events-ScorpionMP.xml
+++ b/tools/gator/daemon/events-ScorpionMP.xml
@@ -7,8 +7,8 @@
<event event="0x03" title="Cache" name="Data refill" description="Memory Read or Write operation that causes a refill of at least the level of data or unified cache closest to the processor"/>
<event event="0x04" title="Cache" name="Data access" description="Memory Read or Write operation that causes a cache access to at least the level of data or unified cache closest to the processor"/>
<event event="0x05" title="Cache" name="Data TLB refill" description="Memory Read or Write operation that causes a TLB refill of at least the level of TLB closest to the processor"/>
- <event event="0x06" title="Instruction" name="Memory read" description="Memory-reading instruction architecturally executed"/>
- <event event="0x07" title="Instruction" name="Memory write" description="Memory-writing instruction architecturally executed"/>
+ <event event="0x06" title="Instruction" name="Load" description="Memory-reading instruction architecturally executed"/>
+ <event event="0x07" title="Instruction" name="Store" description="Memory-writing instruction architecturally executed"/>
<event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
<event event="0x09" title="Exception" name="Taken" description="Exceptions taken"/>
<event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed"/>
diff --git a/tools/gator/daemon/k/perf_event.h b/tools/gator/daemon/k/perf_event.h
index e886c48cadf6..c88e19225b84 100644
--- a/tools/gator/daemon/k/perf_event.h
+++ b/tools/gator/daemon/k/perf_event.h
@@ -136,8 +136,10 @@ enum perf_event_sample_format {
PERF_SAMPLE_WEIGHT = 1U << 14,
PERF_SAMPLE_DATA_SRC = 1U << 15,
PERF_SAMPLE_IDENTIFIER = 1U << 16,
+ PERF_SAMPLE_TRANSACTION = 1U << 17,
+ PERF_SAMPLE_REGS_INTR = 1U << 18,
- PERF_SAMPLE_MAX = 1U << 17, /* non-ABI */
+ PERF_SAMPLE_MAX = 1U << 19, /* non-ABI */
};
/*
@@ -150,20 +152,42 @@ enum perf_event_sample_format {
* The branch types can be combined, however BRANCH_ANY covers all types
* of branches and therefore it supersedes all the other types.
*/
+enum perf_branch_sample_type_shift {
+ PERF_SAMPLE_BRANCH_USER_SHIFT = 0, /* user branches */
+ PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1, /* kernel branches */
+ PERF_SAMPLE_BRANCH_HV_SHIFT = 2, /* hypervisor branches */
+
+ PERF_SAMPLE_BRANCH_ANY_SHIFT = 3, /* any branch types */
+ PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4, /* any call branch */
+ PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5, /* any return branch */
+ PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6, /* indirect calls */
+ PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7, /* transaction aborts */
+ PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8, /* in transaction */
+ PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9, /* not in transaction */
+ PERF_SAMPLE_BRANCH_COND_SHIFT = 10, /* conditional branches */
+
+ PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11, /* call/ret stack */
+
+ PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */
+};
+
enum perf_branch_sample_type {
- PERF_SAMPLE_BRANCH_USER = 1U << 0, /* user branches */
- PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, /* kernel branches */
- PERF_SAMPLE_BRANCH_HV = 1U << 2, /* hypervisor branches */
-
- PERF_SAMPLE_BRANCH_ANY = 1U << 3, /* any branch types */
- PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */
- PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */
- PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */
- PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */
- PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */
- PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */
-
- PERF_SAMPLE_BRANCH_MAX = 1U << 10, /* non-ABI */
+ PERF_SAMPLE_BRANCH_USER = 1U << PERF_SAMPLE_BRANCH_USER_SHIFT,
+ PERF_SAMPLE_BRANCH_KERNEL = 1U << PERF_SAMPLE_BRANCH_KERNEL_SHIFT,
+ PERF_SAMPLE_BRANCH_HV = 1U << PERF_SAMPLE_BRANCH_HV_SHIFT,
+
+ PERF_SAMPLE_BRANCH_ANY = 1U << PERF_SAMPLE_BRANCH_ANY_SHIFT,
+ PERF_SAMPLE_BRANCH_ANY_CALL = 1U << PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT,
+ PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT,
+ PERF_SAMPLE_BRANCH_IND_CALL = 1U << PERF_SAMPLE_BRANCH_IND_CALL_SHIFT,
+ PERF_SAMPLE_BRANCH_ABORT_TX = 1U << PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT,
+ PERF_SAMPLE_BRANCH_IN_TX = 1U << PERF_SAMPLE_BRANCH_IN_TX_SHIFT,
+ PERF_SAMPLE_BRANCH_NO_TX = 1U << PERF_SAMPLE_BRANCH_NO_TX_SHIFT,
+ PERF_SAMPLE_BRANCH_COND = 1U << PERF_SAMPLE_BRANCH_COND_SHIFT,
+
+ PERF_SAMPLE_BRANCH_CALL_STACK = 1U << PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT,
+
+ PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
};
#define PERF_SAMPLE_BRANCH_PLM_ALL \
@@ -181,6 +205,28 @@ enum perf_sample_regs_abi {
};
/*
+ * Values for the memory transaction event qualifier, mostly for
+ * abort events. Multiple bits can be set.
+ */
+enum {
+ PERF_TXN_ELISION = (1 << 0), /* From elision */
+ PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */
+ PERF_TXN_SYNC = (1 << 2), /* Instruction is related */
+ PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */
+ PERF_TXN_RETRY = (1 << 4), /* Retry possible */
+ PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */
+ PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */
+ PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */
+
+ PERF_TXN_MAX = (1 << 8), /* non-ABI */
+
+ /* bits 32..63 are reserved for the abort code */
+
+ PERF_TXN_ABORT_MASK = (0xffffffffULL << 32),
+ PERF_TXN_ABORT_SHIFT = 32,
+};
+
+/*
* The format of the data returned by read() on a perf event fd,
* as specified by attr.read_format:
*
@@ -214,6 +260,8 @@ enum perf_event_read_format {
#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
/* add: sample_stack_user */
+#define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */
+#define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */
/*
* Hardware event_id to monitor via a performance monitoring event:
@@ -278,8 +326,9 @@ struct perf_event_attr {
exclude_callchain_kernel : 1, /* exclude kernel callchains */
exclude_callchain_user : 1, /* exclude user callchains */
mmap2 : 1, /* include mmap with inode data */
-
- __reserved_1 : 40;
+ comm_exec : 1, /* flag comm events that are due to an exec */
+ use_clockid : 1, /* use @clockid for time fields */
+ __reserved_1 : 38;
union {
__u32 wakeup_events; /* wakeup every n events */
@@ -308,8 +357,22 @@ struct perf_event_attr {
*/
__u32 sample_stack_user;
- /* Align to u64. */
- __u32 __reserved_2;
+ __s32 clockid;
+ /*
+ * Defines set of regs to dump for each sample
+ * state captured on:
+ * - precise = 0: PMU interrupt
+ * - precise > 0: sampled instruction
+ *
+ * See asm/perf_regs.h for details.
+ */
+ __u64 sample_regs_intr;
+
+ /*
+ * Wakeup watermark for AUX area
+ */
+ __u32 aux_watermark;
+ __u32 __reserved_2; /* align to __u64 */
};
#define perf_flags(attr) (*(&(attr)->read_format + 1))
@@ -325,6 +388,7 @@ struct perf_event_attr {
#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
#define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *)
+#define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32)
enum perf_event_ioc_flags {
PERF_IOC_FLAG_GROUP = 1U << 0,
@@ -340,7 +404,7 @@ struct perf_event_mmap_page {
/*
* Bits needed to read the hw events in user-space.
*
- * u32 seq, time_mult, time_shift, idx, width;
+ * u32 seq, time_mult, time_shift, index, width;
* u64 count, enabled, running;
* u64 cyc, time_offset;
* s64 pmc = 0;
@@ -359,11 +423,11 @@ struct perf_event_mmap_page {
* time_shift = pc->time_shift;
* }
*
- * idx = pc->index;
+ * index = pc->index;
* count = pc->offset;
- * if (pc->cap_usr_rdpmc && idx) {
+ * if (pc->cap_user_rdpmc && index) {
* width = pc->pmc_width;
- * pmc = rdpmc(idx - 1);
+ * pmc = rdpmc(index - 1);
* }
*
* barrier();
@@ -391,7 +455,7 @@ struct perf_event_mmap_page {
};
/*
- * If cap_usr_rdpmc this field provides the bit-width of the value
+ * If cap_user_rdpmc this field provides the bit-width of the value
* read using the rdpmc() or equivalent instruction. This can be used
* to sign extend the result like:
*
@@ -415,10 +479,10 @@ struct perf_event_mmap_page {
*
* Where time_offset,time_mult,time_shift and cyc are read in the
* seqcount loop described above. This delta can then be added to
- * enabled and possible running (if idx), improving the scaling:
+ * enabled and possible running (if index), improving the scaling:
*
* enabled += delta;
- * if (idx)
+ * if (index)
* running += delta;
*
* quot = count / running;
@@ -465,9 +529,30 @@ struct perf_event_mmap_page {
* In this case the kernel will not over-write unread data.
*
* See perf_output_put_handle() for the data ordering.
+ *
+ * data_{offset,size} indicate the location and size of the perf record
+ * buffer within the mmapped area.
*/
__u64 data_head; /* head in the data section */
__u64 data_tail; /* user-space written tail */
+ __u64 data_offset; /* where the buffer starts */
+ __u64 data_size; /* data buffer size */
+
+ /*
+ * AUX area is defined by aux_{offset,size} fields that should be set
+ * by the userspace, so that
+ *
+ * aux_offset >= data_offset + data_size
+ *
+ * prior to mmap()ing it. Size of the mmap()ed area should be aux_size.
+ *
+ * Ring buffer pointers aux_{head,tail} have the same semantics as
+ * data_{head,tail} and same ordering rules apply.
+ */
+ __u64 aux_head;
+ __u64 aux_tail;
+ __u64 aux_offset;
+ __u64 aux_size;
};
#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
@@ -478,7 +563,12 @@ struct perf_event_mmap_page {
#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
+/*
+ * PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on
+ * different events so can reuse the same bit position.
+ */
#define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
+#define PERF_RECORD_MISC_COMM_EXEC (1 << 13)
/*
* Indicates that the content of PERF_SAMPLE_IP points to
* the actual instruction that triggered the event. See also
@@ -656,6 +746,9 @@ enum perf_event_type {
*
* { u64 weight; } && PERF_SAMPLE_WEIGHT
* { u64 data_src; } && PERF_SAMPLE_DATA_SRC
+ * { u64 transaction; } && PERF_SAMPLE_TRANSACTION
+ * { u64 abi; # enum perf_sample_regs_abi
+ * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR
* };
*/
PERF_RECORD_SAMPLE = 9,
@@ -675,12 +768,38 @@ enum perf_event_type {
* u32 min;
* u64 ino;
* u64 ino_generation;
+ * u32 prot, flags;
* char filename[];
* struct sample_id sample_id;
* };
*/
PERF_RECORD_MMAP2 = 10,
+ /*
+ * Records that new data landed in the AUX buffer part.
+ *
+ * struct {
+ * struct perf_event_header header;
+ *
+ * u64 aux_offset;
+ * u64 aux_size;
+ * u64 flags;
+ * struct sample_id sample_id;
+ * };
+ */
+ PERF_RECORD_AUX = 11,
+
+ /*
+ * Indicates that instruction trace has started
+ *
+ * struct {
+ * struct perf_event_header header;
+ * u32 pid;
+ * u32 tid;
+ * };
+ */
+ PERF_RECORD_ITRACE_START = 12,
+
PERF_RECORD_MAX, /* non-ABI */
};
@@ -698,9 +817,16 @@ enum perf_callchain_context {
PERF_CONTEXT_MAX = (__u64)-4095,
};
-#define PERF_FLAG_FD_NO_GROUP (1U << 0)
-#define PERF_FLAG_FD_OUTPUT (1U << 1)
-#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */
+/**
+ * PERF_RECORD_AUX::flags bits
+ */
+#define PERF_AUX_FLAG_TRUNCATED 0x01 /* record was truncated to fit */
+#define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */
+
+#define PERF_FLAG_FD_NO_GROUP (1UL << 0)
+#define PERF_FLAG_FD_OUTPUT (1UL << 1)
+#define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */
+#define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */
union perf_mem_data_src {
__u64 val;
@@ -763,7 +889,7 @@ union perf_mem_data_src {
#define PERF_MEM_TLB_SHIFT 26
#define PERF_MEM_S(a, s) \
- (((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
+ (((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
/*
* single taken branch record layout:
diff --git a/tools/gator/daemon/libsensors/access.c b/tools/gator/daemon/libsensors/access.c
index 8e227e2550db..0fb76aeffe44 100644
--- a/tools/gator/daemon/libsensors/access.c
+++ b/tools/gator/daemon/libsensors/access.c
@@ -1,7 +1,7 @@
/*
access.c - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007-2009 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -435,7 +435,7 @@ sensors_get_subfeature(const sensors_chip_name *name,
}
/* Evaluate an expression */
-int sensors_eval_expr(const sensors_chip_features *chip_features,
+static int sensors_eval_expr(const sensors_chip_features *chip_features,
const sensors_expr *expr,
double val, int depth, double *result)
{
diff --git a/tools/gator/daemon/libsensors/access.h b/tools/gator/daemon/libsensors/access.h
index 1d3784340757..4273f063dd47 100644
--- a/tools/gator/daemon/libsensors/access.h
+++ b/tools/gator/daemon/libsensors/access.h
@@ -1,7 +1,7 @@
/*
access.h - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/tools/gator/daemon/libsensors/conf-lex.c b/tools/gator/daemon/libsensors/conf-lex.c
index a54664b3d77b..603b6d434f69 100644
--- a/tools/gator/daemon/libsensors/conf-lex.c
+++ b/tools/gator/daemon/libsensors/conf-lex.c
@@ -27,7 +27,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 39
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -180,7 +180,12 @@ typedef unsigned int flex_uint32_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
-extern int sensors_yyleng;
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t sensors_yyleng;
extern FILE *sensors_yyin, *sensors_yyout;
@@ -189,6 +194,7 @@ extern FILE *sensors_yyin, *sensors_yyout;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
+ #define YY_LINENO_REWIND_TO(ptr)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
@@ -206,11 +212,6 @@ extern FILE *sensors_yyin, *sensors_yyout;
#define unput(c) yyunput( c, (yytext_ptr) )
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
@@ -228,7 +229,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
- int yy_n_chars;
+ yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
@@ -298,8 +299,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* yy_hold_char holds the character lost when sensors_yytext is formed. */
static char yy_hold_char;
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-int sensors_yyleng;
+static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
+yy_size_t sensors_yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
@@ -327,7 +328,7 @@ static void sensors_yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
YY_BUFFER_STATE sensors_yy_scan_buffer (char *base,yy_size_t size );
YY_BUFFER_STATE sensors_yy_scan_string (yyconst char *yy_str );
-YY_BUFFER_STATE sensors_yy_scan_bytes (yyconst char *bytes,int len );
+YY_BUFFER_STATE sensors_yy_scan_bytes (yyconst char *bytes,yy_size_t len );
void *sensors_yyalloc (yy_size_t );
void *sensors_yyrealloc (void *,yy_size_t );
@@ -359,7 +360,7 @@ void sensors_yyfree (void * );
/* Begin user sect3 */
-#define sensors_yywrap(n) 1
+#define sensors_yywrap() 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
@@ -374,6 +375,7 @@ int sensors_yylineno = 1;
extern char *sensors_yytext;
#define yytext_ptr sensors_yytext
+
static yyconst flex_int16_t yy_nxt[][39] =
{
{
@@ -1251,7 +1253,7 @@ int sensors_yylineno;
/* Any whitespace-like character */
/* Note: `10', `10.4' and `.4' are valid, `10.' is not */
/* Only positive whole numbers are recognized here */
-#line 1255 "<stdout>"
+#line 1257 "<stdout>"
#define INITIAL 0
#define MIDDLE 1
@@ -1293,7 +1295,7 @@ FILE *sensors_yyget_out (void );
void sensors_yyset_out (FILE * out_str );
-int sensors_yyget_leng (void );
+yy_size_t sensors_yyget_leng (void );
char *sensors_yyget_text (void );
@@ -1439,15 +1441,6 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 80 "lib/conf-lex.l"
-
-
- /*
- * STATE: INITIAL
- */
-
-#line 1450 "<stdout>"
-
if ( !(yy_init) )
{
(yy_init) = 1;
@@ -1474,6 +1467,16 @@ YY_DECL
sensors_yy_load_buffer_state( );
}
+ {
+#line 80 "lib/conf-lex.l"
+
+
+ /*
+ * STATE: INITIAL
+ */
+
+#line 1479 "<stdout>"
+
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = (yy_c_buf_p);
@@ -1899,7 +1902,7 @@ YY_RULE_SETUP
#line 332 "lib/conf-lex.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1903 "<stdout>"
+#line 1906 "<stdout>"
case YY_STATE_EOF(ERR):
yyterminate();
@@ -2030,6 +2033,7 @@ YY_FATAL_ERROR( "flex scanner jammed" );
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
+ } /* end of user's declarations */
} /* end of sensors_yylex */
/* yy_get_next_buffer - try to read in a new buffer
@@ -2085,21 +2089,21 @@ static int yy_get_next_buffer (void)
else
{
- int num_to_read =
+ yy_size_t num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
- int new_size = b->yy_buf_size * 2;
+ yy_size_t new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
@@ -2130,7 +2134,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), (size_t) num_to_read );
+ (yy_n_chars), num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
@@ -2200,7 +2204,7 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_current_state][1];
yy_is_jam = (yy_current_state <= 0);
- return yy_is_jam ? 0 : yy_current_state;
+ return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_INPUT
@@ -2227,7 +2231,7 @@ static int yy_get_next_buffer (void)
else
{ /* need more input */
- int offset = (yy_c_buf_p) - (yytext_ptr);
+ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
@@ -2387,10 +2391,6 @@ static void sensors_yy_load_buffer_state (void)
sensors_yyfree((void *) b );
}
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a sensors_yyrestart() or at EOF.
@@ -2503,7 +2503,7 @@ void sensors_yypop_buffer_state (void)
*/
static void sensors_yyensure_buffer_stack (void)
{
- int num_to_alloc;
+ yy_size_t num_to_alloc;
if (!(yy_buffer_stack)) {
@@ -2600,12 +2600,12 @@ YY_BUFFER_STATE sensors_yy_scan_string (yyconst char * yystr )
*
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE sensors_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
+YY_BUFFER_STATE sensors_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
- int i;
+ yy_size_t i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
@@ -2687,7 +2687,7 @@ FILE *sensors_yyget_out (void)
/** Get the length of the current token.
*
*/
-int sensors_yyget_leng (void)
+yy_size_t sensors_yyget_leng (void)
{
return sensors_yyleng;
}
@@ -2835,7 +2835,7 @@ void sensors_yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 332 "lib/conf-lex.l"
+#line 331 "lib/conf-lex.l"
diff --git a/tools/gator/daemon/libsensors/conf-parse.c b/tools/gator/daemon/libsensors/conf-parse.c
index fb775460a1c3..ace1eec8691c 100644
--- a/tools/gator/daemon/libsensors/conf-parse.c
+++ b/tools/gator/daemon/libsensors/conf-parse.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.5"
+#define YYBISON_VERSION "3.0.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -58,23 +58,19 @@
/* Pull parsers. */
#define YYPULL 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
#define yyparse sensors_yyparse
#define yylex sensors_yylex
#define yyerror sensors_yyerror
-#define yylval sensors_yylval
-#define yychar sensors_yychar
#define yydebug sensors_yydebug
#define yynerrs sensors_yynerrs
+#define yylval sensors_yylval
+#define yychar sensors_yychar
/* Copy the first part of user declarations. */
-
-/* Line 268 of yacc.c */
-#line 1 "lib/conf-parse.y"
+#line 1 "lib/conf-parse.y" /* yacc.c:339 */
/*
conf-parse.y - Part of libsensors, a Linux library for reading sensor data.
@@ -152,14 +148,15 @@ static sensors_chip *current_chip = NULL;
sizeof(sensors_chip_name));
+#line 152 "lib/conf-parse.c" /* yacc.c:339 */
-/* Line 268 of yacc.c */
-#line 158 "lib/conf-parse.c"
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
@@ -169,40 +166,43 @@ static sensors_chip *current_chip = NULL;
# define YYERROR_VERBOSE 0
#endif
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
+/* In a future release of Bison, this section will be replaced
+ by #include "conf-parse.h". */
+#ifndef YY_SENSORS_YY_LIB_CONF_PARSE_H_INCLUDED
+# define YY_SENSORS_YY_LIB_CONF_PARSE_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int sensors_yydebug;
#endif
-
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NEG = 258,
- EOL = 259,
- BUS = 260,
- LABEL = 261,
- SET = 262,
- CHIP = 263,
- COMPUTE = 264,
- IGNORE = 265,
- FLOAT = 266,
- NAME = 267,
- ERROR = 268
- };
+ enum yytokentype
+ {
+ NEG = 258,
+ EOL = 259,
+ BUS = 260,
+ LABEL = 261,
+ SET = 262,
+ CHIP = 263,
+ COMPUTE = 264,
+ IGNORE = 265,
+ FLOAT = 266,
+ NAME = 267,
+ ERROR = 268
+ };
#endif
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
{
-
-/* Line 293 of yacc.c */
-#line 79 "lib/conf-parse.y"
+#line 79 "lib/conf-parse.y" /* yacc.c:355 */
double value;
char *name;
@@ -213,22 +213,22 @@ typedef union YYSTYPE
sensors_chip_name chip;
sensors_config_line line;
-
-
-/* Line 293 of yacc.c */
-#line 220 "lib/conf-parse.c"
-} YYSTYPE;
+#line 217 "lib/conf-parse.c" /* yacc.c:355 */
+};
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-/* Copy the second part of user declarations. */
+extern YYSTYPE sensors_yylval;
+int sensors_yyparse (void);
-/* Line 343 of yacc.c */
-#line 232 "lib/conf-parse.c"
+#endif /* !YY_SENSORS_YY_LIB_CONF_PARSE_H_INCLUDED */
+
+/* Copy the second part of user declarations. */
+
+#line 232 "lib/conf-parse.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -242,11 +242,8 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
#else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -266,8 +263,7 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -281,39 +277,68 @@ typedef short int yytype_int16;
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
-# define YY_(msgid) msgid
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
+# define YYUSE(E) ((void) (E))
#else
-# define YYUSE(e) /* empty */
+# define YYUSE(E) /* empty */
#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-static int
-YYID (yyi)
- int yyi;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -331,9 +356,9 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
@@ -343,8 +368,8 @@ YYID (yyi)
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -360,7 +385,7 @@ YYID (yyi)
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -368,15 +393,13 @@ YYID (yyi)
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -386,7 +409,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -411,35 +434,35 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO. The source and destination do
+/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -455,17 +478,19 @@ union yyalloc
#define YYNNTS 16
/* YYNRULES -- Number of rules. */
#define YYNRULES 34
-/* YYNRULES -- Number of states. */
+/* YYNSTATES -- Number of states. */
#define YYNSTATES 63
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 268
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -498,33 +523,7 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint8 yyprhs[] =
-{
- 0, 0, 3, 4, 7, 10, 13, 16, 19, 22,
- 25, 28, 32, 36, 40, 46, 49, 52, 54, 57,
- 59, 61, 63, 67, 71, 75, 79, 82, 86, 89,
- 92, 94, 96, 98, 100
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 25, 0, -1, -1, 25, 26, -1, 27, 11, -1,
- 28, 11, -1, 29, 11, -1, 32, 11, -1, 30,
- 11, -1, 31, 11, -1, 1, 11, -1, 12, 35,
- 36, -1, 13, 37, 38, -1, 14, 37, 34, -1,
- 16, 37, 34, 10, 34, -1, 17, 37, -1, 15,
- 33, -1, 39, -1, 33, 39, -1, 18, -1, 19,
- -1, 21, -1, 34, 4, 34, -1, 34, 3, 34,
- -1, 34, 5, 34, -1, 34, 6, 34, -1, 3,
- 34, -1, 22, 34, 23, -1, 8, 34, -1, 9,
- 34, -1, 19, -1, 19, -1, 19, -1, 19, -1,
- 19, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 119, 119, 120, 123, 124, 125, 126, 127, 128,
@@ -534,7 +533,7 @@ static const yytype_uint16 yyrline[] =
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@@ -545,13 +544,13 @@ static const char *const yytname[] =
"line", "bus_statement", "label_statement", "set_statement",
"compute_statement", "ignore_statement", "chip_statement",
"chip_name_list", "expression", "bus_id", "adapter_name",
- "function_name", "string", "chip_name", 0
+ "function_name", "string", "chip_name", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 45, 43, 42, 47, 258, 94, 96,
@@ -560,48 +559,18 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 24, 25, 25, 26, 26, 26, 26, 26, 26,
- 26, 27, 28, 29, 30, 31, 32, 33, 33, 34,
- 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
- 35, 36, 37, 38, 39
-};
+#define YYPACT_NINF -27
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
- 2, 3, 3, 3, 5, 2, 2, 1, 2, 1,
- 1, 1, 3, 3, 3, 3, 2, 3, 2, 2,
- 1, 1, 1, 1, 1
-};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-27)))
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 3, 0, 0, 0, 0, 0, 0, 10, 30, 0,
- 32, 0, 0, 34, 16, 17, 0, 15, 4, 5,
- 6, 8, 9, 7, 31, 11, 33, 12, 0, 0,
- 0, 19, 20, 21, 0, 13, 18, 0, 26, 28,
- 29, 0, 0, 0, 0, 0, 0, 27, 23, 22,
- 24, 25, 14
-};
+#define YYTABLE_NINF -1
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- -1, 1, 10, 11, 12, 13, 14, 15, 16, 24,
- 45, 19, 35, 21, 37, 25
-};
+#define yytable_value_is_error(Yytable_value) \
+ 0
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -27
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int8 yypact[] =
{
-27, 37, -27, -4, -3, 1, 1, 6, 1, 1,
@@ -613,17 +582,37 @@ static const yytype_int8 yypact[] =
-27, -27, 36
};
-/* YYPGOTO[NTERM-NUM]. */
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0, 0, 10, 30, 0,
+ 32, 0, 0, 34, 16, 17, 0, 15, 4, 5,
+ 6, 8, 9, 7, 31, 11, 33, 12, 0, 0,
+ 0, 19, 20, 21, 0, 13, 18, 0, 26, 28,
+ 29, 0, 0, 0, 0, 0, 0, 27, 23, 22,
+ 24, 25, 14
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-27, -27, -27, -27, -27, -27, -27, -27, -27, -27,
-26, -27, -27, 38, -27, 31
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 1, 10, 11, 12, 13, 14, 15, 16, 24,
+ 45, 19, 35, 21, 37, 25
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
47, 52, 53, 54, 55, 54, 55, 17, 52, 53,
@@ -634,12 +623,6 @@ static const yytype_uint8 yytable[] =
5, 6, 7, 8, 9, 46, 0, 0, 36
};
-#define yypact_value_is_default(yystate) \
- ((yystate) == (-27))
-
-#define yytable_value_is_error(yytable_value) \
- YYID (0)
-
static const yytype_int8 yycheck[] =
{
26, 3, 4, 5, 6, 5, 6, 11, 3, 4,
@@ -650,8 +633,8 @@ static const yytype_int8 yycheck[] =
13, 14, 15, 16, 17, 24, -1, -1, 19
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 25, 0, 1, 12, 13, 14, 15, 16, 17,
@@ -663,94 +646,59 @@ static const yytype_uint8 yystos[] =
34, 34, 34
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 24, 25, 25, 26, 26, 26, 26, 26, 26,
+ 26, 27, 28, 29, 30, 31, 32, 33, 33, 34,
+ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+ 35, 36, 37, 38, 39
+};
-#define YYRECOVERING() (!!yyerrstatus)
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 3, 3, 3, 5, 2, 2, 1, 2, 1,
+ 1, 1, 3, 3, 3, 3, 2, 3, 2, 2,
+ 1, 1, 1, 1, 1
+};
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
-
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
-/* This macro is provided for backward compatibility. */
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -760,54 +708,46 @@ while (YYID (0))
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
{
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -815,22 +755,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
@@ -841,16 +770,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -861,49 +782,42 @@ yy_stack_print (yybottom, yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
static void
-yy_reduce_print (yyvsp, yyrule)
- YYSTYPE *yyvsp;
- int yyrule;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
+ unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -917,7 +831,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -940,15 +854,8 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -964,16 +871,8 @@ yystrlen (yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1003,27 +902,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1046,12 +945,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = 0;
+ const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1059,10 +957,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -1111,11 +1005,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
}
}
}
@@ -1135,10 +1031,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
- yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
if (*yymsg_alloc < yysize)
{
@@ -1175,48 +1073,20 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
{
YYUSE (yyvaluep);
-
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- switch (yytype)
- {
-
- default:
- break;
- }
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-/* Prevent warnings from -Wmissing-prototypes. */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
/* The lookahead symbol. */
@@ -1224,7 +1094,6 @@ int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-
/* Number of syntax errors so far. */
int yynerrs;
@@ -1233,37 +1102,18 @@ int yynerrs;
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
{
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
- Refer to the stacks thru separate pointers, to allow yyoverflow
+ Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
@@ -1281,7 +1131,7 @@ yyparse ()
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- int yytoken;
+ int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
@@ -1299,9 +1149,8 @@ yyparse ()
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yytoken = 0;
- yyss = yyssa;
- yyvs = yyvsa;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1310,14 +1159,6 @@ yyparse ()
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
- yyssp = yyss;
- yyvsp = yyvs;
-
goto yysetstate;
/*------------------------------------------------------------.
@@ -1338,23 +1179,23 @@ yyparse ()
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1362,22 +1203,22 @@ yyparse ()
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1386,10 +1227,10 @@ yyparse ()
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1418,7 +1259,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex ();
}
if (yychar <= YYEOF)
@@ -1458,7 +1299,9 @@ yybackup:
yychar = YYEMPTY;
yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
@@ -1481,7 +1324,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1495,95 +1338,88 @@ yyreduce:
switch (yyn)
{
case 11:
-
-/* Line 1806 of yacc.c */
-#line 133 "lib/conf-parse.y"
+#line 133 "lib/conf-parse.y" /* yacc.c:1646 */
{ sensors_bus new_el;
- new_el.line = (yyvsp[(1) - (3)].line);
- new_el.bus = (yyvsp[(2) - (3)].bus);
- new_el.adapter = (yyvsp[(3) - (3)].name);
+ new_el.line = (yyvsp[-2].line);
+ new_el.bus = (yyvsp[-1].bus);
+ new_el.adapter = (yyvsp[0].name);
bus_add_el(&new_el);
}
+#line 1349 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 12:
-
-/* Line 1806 of yacc.c */
-#line 142 "lib/conf-parse.y"
+#line 142 "lib/conf-parse.y" /* yacc.c:1646 */
{ sensors_label new_el;
if (!current_chip) {
sensors_yyerror("Label statement before first chip statement");
- free((yyvsp[(2) - (3)].name));
- free((yyvsp[(3) - (3)].name));
+ free((yyvsp[-1].name));
+ free((yyvsp[0].name));
YYERROR;
}
- new_el.line = (yyvsp[(1) - (3)].line);
- new_el.name = (yyvsp[(2) - (3)].name);
- new_el.value = (yyvsp[(3) - (3)].name);
+ new_el.line = (yyvsp[-2].line);
+ new_el.name = (yyvsp[-1].name);
+ new_el.value = (yyvsp[0].name);
label_add_el(&new_el);
}
+#line 1366 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 13:
-
-/* Line 1806 of yacc.c */
-#line 157 "lib/conf-parse.y"
+#line 157 "lib/conf-parse.y" /* yacc.c:1646 */
{ sensors_set new_el;
if (!current_chip) {
sensors_yyerror("Set statement before first chip statement");
- free((yyvsp[(2) - (3)].name));
- sensors_free_expr((yyvsp[(3) - (3)].expr));
+ free((yyvsp[-1].name));
+ sensors_free_expr((yyvsp[0].expr));
YYERROR;
}
- new_el.line = (yyvsp[(1) - (3)].line);
- new_el.name = (yyvsp[(2) - (3)].name);
- new_el.value = (yyvsp[(3) - (3)].expr);
+ new_el.line = (yyvsp[-2].line);
+ new_el.name = (yyvsp[-1].name);
+ new_el.value = (yyvsp[0].expr);
set_add_el(&new_el);
}
+#line 1383 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 14:
-
-/* Line 1806 of yacc.c */
-#line 172 "lib/conf-parse.y"
+#line 172 "lib/conf-parse.y" /* yacc.c:1646 */
{ sensors_compute new_el;
if (!current_chip) {
sensors_yyerror("Compute statement before first chip statement");
- free((yyvsp[(2) - (5)].name));
- sensors_free_expr((yyvsp[(3) - (5)].expr));
- sensors_free_expr((yyvsp[(5) - (5)].expr));
+ free((yyvsp[-3].name));
+ sensors_free_expr((yyvsp[-2].expr));
+ sensors_free_expr((yyvsp[0].expr));
YYERROR;
}
- new_el.line = (yyvsp[(1) - (5)].line);
- new_el.name = (yyvsp[(2) - (5)].name);
- new_el.from_proc = (yyvsp[(3) - (5)].expr);
- new_el.to_proc = (yyvsp[(5) - (5)].expr);
+ new_el.line = (yyvsp[-4].line);
+ new_el.name = (yyvsp[-3].name);
+ new_el.from_proc = (yyvsp[-2].expr);
+ new_el.to_proc = (yyvsp[0].expr);
compute_add_el(&new_el);
}
+#line 1402 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 15:
-
-/* Line 1806 of yacc.c */
-#line 189 "lib/conf-parse.y"
+#line 189 "lib/conf-parse.y" /* yacc.c:1646 */
{ sensors_ignore new_el;
if (!current_chip) {
sensors_yyerror("Ignore statement before first chip statement");
- free((yyvsp[(2) - (2)].name));
+ free((yyvsp[0].name));
YYERROR;
}
- new_el.line = (yyvsp[(1) - (2)].line);
- new_el.name = (yyvsp[(2) - (2)].name);
+ new_el.line = (yyvsp[-1].line);
+ new_el.name = (yyvsp[0].name);
ignore_add_el(&new_el);
}
+#line 1417 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 16:
-
-/* Line 1806 of yacc.c */
-#line 202 "lib/conf-parse.y"
+#line 202 "lib/conf-parse.y" /* yacc.c:1646 */
{ sensors_chip new_el;
- new_el.line = (yyvsp[(1) - (2)].line);
+ new_el.line = (yyvsp[-1].line);
new_el.labels = NULL;
new_el.sets = NULL;
new_el.computes = NULL;
@@ -1592,204 +1428,185 @@ yyreduce:
new_el.sets_count = new_el.sets_max = 0;
new_el.computes_count = new_el.computes_max = 0;
new_el.ignores_count = new_el.ignores_max = 0;
- new_el.chips = (yyvsp[(2) - (2)].chips);
+ new_el.chips = (yyvsp[0].chips);
chip_add_el(&new_el);
current_chip = sensors_config_chips +
sensors_config_chips_count - 1;
}
+#line 1437 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 17:
-
-/* Line 1806 of yacc.c */
-#line 220 "lib/conf-parse.y"
+#line 220 "lib/conf-parse.y" /* yacc.c:1646 */
{
(yyval.chips).fits = NULL;
(yyval.chips).fits_count = (yyval.chips).fits_max = 0;
- fits_add_el(&(yyvsp[(1) - (1)].chip),(yyval.chips));
+ fits_add_el(&(yyvsp[0].chip),(yyval.chips));
}
+#line 1447 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 18:
-
-/* Line 1806 of yacc.c */
-#line 226 "lib/conf-parse.y"
- { (yyval.chips) = (yyvsp[(1) - (2)].chips);
- fits_add_el(&(yyvsp[(2) - (2)].chip),(yyval.chips));
+#line 226 "lib/conf-parse.y" /* yacc.c:1646 */
+ { (yyval.chips) = (yyvsp[-1].chips);
+ fits_add_el(&(yyvsp[0].chip),(yyval.chips));
}
+#line 1455 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 19:
-
-/* Line 1806 of yacc.c */
-#line 232 "lib/conf-parse.y"
+#line 232 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
- (yyval.expr)->data.val = (yyvsp[(1) - (1)].value);
+ (yyval.expr)->data.val = (yyvsp[0].value);
(yyval.expr)->kind = sensors_kind_val;
}
+#line 1464 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 20:
-
-/* Line 1806 of yacc.c */
-#line 237 "lib/conf-parse.y"
+#line 237 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
- (yyval.expr)->data.var = (yyvsp[(1) - (1)].name);
+ (yyval.expr)->data.var = (yyvsp[0].name);
(yyval.expr)->kind = sensors_kind_var;
}
+#line 1473 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 21:
-
-/* Line 1806 of yacc.c */
-#line 242 "lib/conf-parse.y"
+#line 242 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_source;
}
+#line 1481 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 22:
-
-/* Line 1806 of yacc.c */
-#line 246 "lib/conf-parse.y"
+#line 246 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_sub;
(yyval.expr)->data.subexpr.op = sensors_add;
- (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr);
- (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr);
+ (yyval.expr)->data.subexpr.sub1 = (yyvsp[-2].expr);
+ (yyval.expr)->data.subexpr.sub2 = (yyvsp[0].expr);
}
+#line 1492 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 23:
-
-/* Line 1806 of yacc.c */
-#line 253 "lib/conf-parse.y"
+#line 253 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_sub;
(yyval.expr)->data.subexpr.op = sensors_sub;
- (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr);
- (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr);
+ (yyval.expr)->data.subexpr.sub1 = (yyvsp[-2].expr);
+ (yyval.expr)->data.subexpr.sub2 = (yyvsp[0].expr);
}
+#line 1503 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 24:
-
-/* Line 1806 of yacc.c */
-#line 260 "lib/conf-parse.y"
+#line 260 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_sub;
(yyval.expr)->data.subexpr.op = sensors_multiply;
- (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr);
- (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr);
+ (yyval.expr)->data.subexpr.sub1 = (yyvsp[-2].expr);
+ (yyval.expr)->data.subexpr.sub2 = (yyvsp[0].expr);
}
+#line 1514 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 25:
-
-/* Line 1806 of yacc.c */
-#line 267 "lib/conf-parse.y"
+#line 267 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_sub;
(yyval.expr)->data.subexpr.op = sensors_divide;
- (yyval.expr)->data.subexpr.sub1 = (yyvsp[(1) - (3)].expr);
- (yyval.expr)->data.subexpr.sub2 = (yyvsp[(3) - (3)].expr);
+ (yyval.expr)->data.subexpr.sub1 = (yyvsp[-2].expr);
+ (yyval.expr)->data.subexpr.sub2 = (yyvsp[0].expr);
}
+#line 1525 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 26:
-
-/* Line 1806 of yacc.c */
-#line 274 "lib/conf-parse.y"
+#line 274 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_sub;
(yyval.expr)->data.subexpr.op = sensors_negate;
- (yyval.expr)->data.subexpr.sub1 = (yyvsp[(2) - (2)].expr);
+ (yyval.expr)->data.subexpr.sub1 = (yyvsp[0].expr);
(yyval.expr)->data.subexpr.sub2 = NULL;
}
+#line 1536 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 27:
-
-/* Line 1806 of yacc.c */
-#line 281 "lib/conf-parse.y"
- { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
+#line 281 "lib/conf-parse.y" /* yacc.c:1646 */
+ { (yyval.expr) = (yyvsp[-1].expr); }
+#line 1542 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 28:
-
-/* Line 1806 of yacc.c */
-#line 283 "lib/conf-parse.y"
+#line 283 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_sub;
(yyval.expr)->data.subexpr.op = sensors_exp;
- (yyval.expr)->data.subexpr.sub1 = (yyvsp[(2) - (2)].expr);
+ (yyval.expr)->data.subexpr.sub1 = (yyvsp[0].expr);
(yyval.expr)->data.subexpr.sub2 = NULL;
}
+#line 1553 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 29:
-
-/* Line 1806 of yacc.c */
-#line 290 "lib/conf-parse.y"
+#line 290 "lib/conf-parse.y" /* yacc.c:1646 */
{ (yyval.expr) = malloc_expr();
(yyval.expr)->kind = sensors_kind_sub;
(yyval.expr)->data.subexpr.op = sensors_log;
- (yyval.expr)->data.subexpr.sub1 = (yyvsp[(2) - (2)].expr);
+ (yyval.expr)->data.subexpr.sub1 = (yyvsp[0].expr);
(yyval.expr)->data.subexpr.sub2 = NULL;
}
+#line 1564 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 30:
-
-/* Line 1806 of yacc.c */
-#line 299 "lib/conf-parse.y"
- { int res = sensors_parse_bus_id((yyvsp[(1) - (1)].name),&(yyval.bus));
- free((yyvsp[(1) - (1)].name));
+#line 299 "lib/conf-parse.y" /* yacc.c:1646 */
+ { int res = sensors_parse_bus_id((yyvsp[0].name),&(yyval.bus));
+ free((yyvsp[0].name));
if (res) {
sensors_yyerror("Parse error in bus id");
YYERROR;
}
}
+#line 1576 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 31:
-
-/* Line 1806 of yacc.c */
-#line 309 "lib/conf-parse.y"
- { (yyval.name) = (yyvsp[(1) - (1)].name); }
+#line 309 "lib/conf-parse.y" /* yacc.c:1646 */
+ { (yyval.name) = (yyvsp[0].name); }
+#line 1582 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 32:
-
-/* Line 1806 of yacc.c */
-#line 313 "lib/conf-parse.y"
- { (yyval.name) = (yyvsp[(1) - (1)].name); }
+#line 313 "lib/conf-parse.y" /* yacc.c:1646 */
+ { (yyval.name) = (yyvsp[0].name); }
+#line 1588 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 33:
-
-/* Line 1806 of yacc.c */
-#line 317 "lib/conf-parse.y"
- { (yyval.name) = (yyvsp[(1) - (1)].name); }
+#line 317 "lib/conf-parse.y" /* yacc.c:1646 */
+ { (yyval.name) = (yyvsp[0].name); }
+#line 1594 "lib/conf-parse.c" /* yacc.c:1646 */
break;
case 34:
-
-/* Line 1806 of yacc.c */
-#line 321 "lib/conf-parse.y"
- { int res = sensors_parse_chip_name((yyvsp[(1) - (1)].name),&(yyval.chip));
- free((yyvsp[(1) - (1)].name));
+#line 321 "lib/conf-parse.y" /* yacc.c:1646 */
+ { int res = sensors_parse_chip_name((yyvsp[0].name),&(yyval.chip));
+ free((yyvsp[0].name));
if (res) {
sensors_yyerror("Parse error in chip name");
YYERROR;
}
}
+#line 1606 "lib/conf-parse.c" /* yacc.c:1646 */
break;
-
-/* Line 1806 of yacc.c */
-#line 1793 "lib/conf-parse.c"
+#line 1610 "lib/conf-parse.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1811,7 +1628,7 @@ yyreduce:
*++yyvsp = yyval;
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -1826,9 +1643,9 @@ yyreduce:
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -1879,20 +1696,20 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -1911,7 +1728,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -1924,35 +1741,37 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
+ yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
@@ -1976,7 +1795,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -1995,14 +1814,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
+ yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -2013,14 +1832,9 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
-
-/* Line 2067 of yacc.c */
-#line 330 "lib/conf-parse.y"
+#line 330 "lib/conf-parse.y" /* yacc.c:1906 */
void sensors_yyerror(const char *err)
@@ -2039,4 +1853,3 @@ sensors_expr *malloc_expr(void)
sensors_fatal_error(__func__, "Allocating a new expression");
return res;
}
-
diff --git a/tools/gator/daemon/libsensors/conf-parse.h b/tools/gator/daemon/libsensors/conf-parse.h
index 89c9c1a0d59f..954f0d846b66 100644
--- a/tools/gator/daemon/libsensors/conf-parse.h
+++ b/tools/gator/daemon/libsensors/conf-parse.h
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,39 +26,45 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+#ifndef YY_SENSORS_YY_LIB_CONF_PARSE_H_INCLUDED
+# define YY_SENSORS_YY_LIB_CONF_PARSE_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int sensors_yydebug;
+#endif
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NEG = 258,
- EOL = 259,
- BUS = 260,
- LABEL = 261,
- SET = 262,
- CHIP = 263,
- COMPUTE = 264,
- IGNORE = 265,
- FLOAT = 266,
- NAME = 267,
- ERROR = 268
- };
+ enum yytokentype
+ {
+ NEG = 258,
+ EOL = 259,
+ BUS = 260,
+ LABEL = 261,
+ SET = 262,
+ CHIP = 263,
+ COMPUTE = 264,
+ IGNORE = 265,
+ FLOAT = 266,
+ NAME = 267,
+ ERROR = 268
+ };
#endif
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
{
-
-/* Line 2068 of yacc.c */
-#line 79 "lib/conf-parse.y"
+#line 79 "lib/conf-parse.y" /* yacc.c:1909 */
double value;
char *name;
@@ -69,16 +75,15 @@ typedef union YYSTYPE
sensors_chip_name chip;
sensors_config_line line;
-
-
-/* Line 2068 of yacc.c */
-#line 76 "lib/conf-parse.h"
-} YYSTYPE;
+#line 79 "lib/conf-parse.h" /* yacc.c:1909 */
+};
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+
extern YYSTYPE sensors_yylval;
+int sensors_yyparse (void);
+#endif /* !YY_SENSORS_YY_LIB_CONF_PARSE_H_INCLUDED */
diff --git a/tools/gator/daemon/libsensors/data.c b/tools/gator/daemon/libsensors/data.c
index cac9c8dc6eb1..86e157c35798 100644
--- a/tools/gator/daemon/libsensors/data.c
+++ b/tools/gator/daemon/libsensors/data.c
@@ -1,7 +1,7 @@
/*
data.c - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007, 2009 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/tools/gator/daemon/libsensors/data.h b/tools/gator/daemon/libsensors/data.h
index 4a23eabe1414..aaf87ef07f53 100644
--- a/tools/gator/daemon/libsensors/data.h
+++ b/tools/gator/daemon/libsensors/data.h
@@ -1,7 +1,7 @@
/*
data.h - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007, 2009 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/tools/gator/daemon/libsensors/error.c b/tools/gator/daemon/libsensors/error.c
index 55bde81295fb..5add3c504127 100644
--- a/tools/gator/daemon/libsensors/error.c
+++ b/tools/gator/daemon/libsensors/error.c
@@ -1,7 +1,7 @@
/*
error.c - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007-2009 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,18 +24,6 @@
#include "error.h"
#include "general.h"
-static void sensors_default_parse_error(const char *err, int lineno);
-static void sensors_default_parse_error_wfn(const char *err,
- const char *filename, int lineno);
-static void sensors_default_fatal_error(const char *proc, const char *err);
-
-void (*sensors_parse_error) (const char *err, int lineno) =
- sensors_default_parse_error;
-void (*sensors_parse_error_wfn) (const char *err, const char *filename,
- int lineno) = sensors_default_parse_error_wfn;
-void (*sensors_fatal_error) (const char *proc, const char *err) =
- sensors_default_fatal_error;
-
static const char *errorlist[] = {
/* Invalid error code */ "Unknown error",
/* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name",
@@ -60,7 +48,7 @@ const char *sensors_strerror(int errnum)
return errorlist[errnum];
}
-void sensors_default_parse_error(const char *err, int lineno)
+static void sensors_default_parse_error(const char *err, int lineno)
{
if (lineno)
fprintf(stderr, "Error: Line %d: %s\n", lineno, err);
@@ -68,7 +56,7 @@ void sensors_default_parse_error(const char *err, int lineno)
fprintf(stderr, "Error: %s\n", err);
}
-void sensors_default_parse_error_wfn(const char *err,
+static void sensors_default_parse_error_wfn(const char *err,
const char *filename, int lineno)
{
/* If application provided a custom parse error reporting function
@@ -85,8 +73,15 @@ void sensors_default_parse_error_wfn(const char *err,
fprintf(stderr, "Error: File %s: %s\n", filename, err);
}
-void sensors_default_fatal_error(const char *proc, const char *err)
+static void sensors_default_fatal_error(const char *proc, const char *err)
{
fprintf(stderr, "Fatal error in `%s': %s\n", proc, err);
exit(1);
}
+
+void (*sensors_parse_error) (const char *err, int lineno) =
+ sensors_default_parse_error;
+void (*sensors_parse_error_wfn) (const char *err, const char *filename,
+ int lineno) = sensors_default_parse_error_wfn;
+void (*sensors_fatal_error) (const char *proc, const char *err) =
+ sensors_default_fatal_error;
diff --git a/tools/gator/daemon/libsensors/error.h b/tools/gator/daemon/libsensors/error.h
index 37cdc956151d..eb23613e907d 100644
--- a/tools/gator/daemon/libsensors/error.h
+++ b/tools/gator/daemon/libsensors/error.h
@@ -1,7 +1,7 @@
/*
error.h - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007-2009 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/tools/gator/daemon/libsensors/init.c b/tools/gator/daemon/libsensors/init.c
index 558046e76c24..42e70cd21045 100644
--- a/tools/gator/daemon/libsensors/init.c
+++ b/tools/gator/daemon/libsensors/init.c
@@ -1,7 +1,7 @@
/*
init.c - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007, 2009 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2013 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,9 +20,9 @@
*/
/*** This file modified by ARM on Jan 23, 2013 to cast alphasort to supress a warning as it's prototype is different on android. ***/
+/*** This file modified by ARM on Aug 14, 2015 to comment out _BSD_SOURCE as it causes warnings with glibc 2.20 and doesn't appear to be needed. ***/
-/* Needed for scandir() and alphasort() */
-#define _BSD_SOURCE
+/* #define _BSD_SOURCE */
#include <sys/types.h>
#include <sys/stat.h>
@@ -177,6 +177,8 @@ static int add_config_from_dir(const char *dir)
return res;
}
+/* Ideally, initialization and configuraton file loading should be exposed
+ separately, to make it possible to load several configuration files. */
int sensors_init(FILE *input)
{
int res;
diff --git a/tools/gator/daemon/libsensors/init.h b/tools/gator/daemon/libsensors/init.h
index 47006a62db63..799f1eff69f7 100644
--- a/tools/gator/daemon/libsensors/init.h
+++ b/tools/gator/daemon/libsensors/init.h
@@ -1,6 +1,6 @@
/*
init.h - Part of libsensors, a Linux library for reading sensor data.
- Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/tools/gator/daemon/libsensors/sensors.h b/tools/gator/daemon/libsensors/sensors.h
index 7874d028dc82..1fa42fb69606 100644
--- a/tools/gator/daemon/libsensors/sensors.h
+++ b/tools/gator/daemon/libsensors/sensors.h
@@ -1,7 +1,7 @@
/*
sensors.h - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
- Copyright (C) 2007, 2010 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2014 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -33,7 +33,7 @@
when the API + ABI breaks), the third digit is incremented to track small
API additions like new flags / enum values. The second digit is for tracking
larger additions like new methods. */
-#define SENSORS_API_VERSION 0x432
+#define SENSORS_API_VERSION 0x440
#define SENSORS_CHIP_NAME_PREFIX_ANY NULL
#define SENSORS_CHIP_NAME_ADDR_ANY (-1)
@@ -150,6 +150,7 @@ typedef enum sensors_feature_type {
SENSORS_FEATURE_INTRUSION = 0x11,
SENSORS_FEATURE_MAX_OTHER,
SENSORS_FEATURE_BEEP_ENABLE = 0x18,
+ SENSORS_FEATURE_MAX,
SENSORS_FEATURE_UNKNOWN = INT_MAX,
} sensors_feature_type;
@@ -193,6 +194,8 @@ typedef enum sensors_subfeature_type {
SENSORS_SUBFEATURE_TEMP_EMERGENCY_HYST,
SENSORS_SUBFEATURE_TEMP_LOWEST,
SENSORS_SUBFEATURE_TEMP_HIGHEST,
+ SENSORS_SUBFEATURE_TEMP_MIN_HYST,
+ SENSORS_SUBFEATURE_TEMP_LCRIT_HYST,
SENSORS_SUBFEATURE_TEMP_ALARM = (SENSORS_FEATURE_TEMP << 8) | 0x80,
SENSORS_SUBFEATURE_TEMP_MAX_ALARM,
SENSORS_SUBFEATURE_TEMP_MIN_ALARM,
diff --git a/tools/gator/daemon/libsensors/sysfs.c b/tools/gator/daemon/libsensors/sysfs.c
index 2b494c9975b4..a4004d4171f3 100644
--- a/tools/gator/daemon/libsensors/sysfs.c
+++ b/tools/gator/daemon/libsensors/sysfs.c
@@ -1,7 +1,7 @@
/*
sysfs.c - Part of libsensors, a library for reading Linux sensor data
Copyright (c) 2005 Mark M. Hoffman <mhoffman@lightlink.com>
- Copyright (C) 2007-2010 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2014 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -143,22 +143,6 @@ static int sysfs_foreach_busdev(const char *bus_type,
char sensors_sysfs_mount[NAME_MAX];
-#define MAX_MAIN_SENSOR_TYPES (SENSORS_FEATURE_MAX_MAIN - SENSORS_FEATURE_IN)
-#define MAX_OTHER_SENSOR_TYPES (SENSORS_FEATURE_MAX_OTHER - SENSORS_FEATURE_VID)
-#define MAX_SENSORS_PER_TYPE 24
-/* max_subfeatures is now computed dynamically */
-#define FEATURE_SIZE (max_subfeatures * 2)
-#define FEATURE_TYPE_SIZE (MAX_SENSORS_PER_TYPE * FEATURE_SIZE)
-
-/*
- * Room for all 7 main types (in, fan, temp, power, energy, current, humidity)
- * and 2 other types (VID, intrusion) with all their subfeatures + misc features
- */
-#define SUB_OFFSET_OTHER (MAX_MAIN_SENSOR_TYPES * FEATURE_TYPE_SIZE)
-#define SUB_OFFSET_MISC (SUB_OFFSET_OTHER + \
- MAX_OTHER_SENSOR_TYPES * FEATURE_TYPE_SIZE)
-#define ALL_POSSIBLE_SUBFEATURES (SUB_OFFSET_MISC + 1)
-
static
int get_type_scaling(sensors_subfeature_type type)
{
@@ -235,9 +219,11 @@ static const struct subfeature_type_match temp_matches[] = {
{ "max", SENSORS_SUBFEATURE_TEMP_MAX },
{ "max_hyst", SENSORS_SUBFEATURE_TEMP_MAX_HYST },
{ "min", SENSORS_SUBFEATURE_TEMP_MIN },
+ { "min_hyst", SENSORS_SUBFEATURE_TEMP_MIN_HYST },
{ "crit", SENSORS_SUBFEATURE_TEMP_CRIT },
{ "crit_hyst", SENSORS_SUBFEATURE_TEMP_CRIT_HYST },
{ "lcrit", SENSORS_SUBFEATURE_TEMP_LCRIT },
+ { "lcrit_hyst", SENSORS_SUBFEATURE_TEMP_LCRIT_HYST },
{ "emergency", SENSORS_SUBFEATURE_TEMP_EMERGENCY },
{ "emergency_hyst", SENSORS_SUBFEATURE_TEMP_EMERGENCY_HYST },
{ "lowest", SENSORS_SUBFEATURE_TEMP_LOWEST },
@@ -387,7 +373,7 @@ sensors_subfeature_type sensors_subfeature_get_type(const char *name, int *nr)
return SENSORS_SUBFEATURE_UNKNOWN;
}
-static int sensors_compute_max(void)
+static int sensors_compute_max_sf(void)
{
int i, j, max, offset;
const struct subfeature_type_match *submatches;
@@ -434,10 +420,13 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
const char *dev_path)
{
int i, fnum = 0, sfnum = 0, prev_slot;
- static int max_subfeatures;
+ static int max_subfeatures, feature_size;
DIR *dir;
struct dirent *ent;
- sensors_subfeature *all_subfeatures;
+ struct {
+ int count;
+ sensors_subfeature *sf;
+ } all_types[SENSORS_FEATURE_MAX];
sensors_subfeature *dyn_subfeatures;
sensors_feature *dyn_features;
sensors_feature_type ftype;
@@ -447,16 +436,15 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
return -errno;
/* Dynamically figure out the max number of subfeatures */
- if (!max_subfeatures)
- max_subfeatures = sensors_compute_max();
-
- /* We use a large sparse table at first to store all found
- subfeatures, so that we can store them sorted at type and index
- and then later create a dense sorted table. */
- all_subfeatures = calloc(ALL_POSSIBLE_SUBFEATURES,
- sizeof(sensors_subfeature));
- if (!all_subfeatures)
- sensors_fatal_error(__func__, "Out of memory");
+ if (!max_subfeatures) {
+ max_subfeatures = sensors_compute_max_sf();
+ feature_size = max_subfeatures * 2;
+ }
+
+ /* We use a set of large sparse tables at first (one per main
+ feature type present) to store all found subfeatures, so that we
+ can store them sorted and then later create a dense sorted table. */
+ memset(&all_types, 0, sizeof(all_types));
while ((ent = readdir(dir))) {
char *name;
@@ -487,37 +475,46 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
break;
}
- if (nr < 0 || nr >= MAX_SENSORS_PER_TYPE) {
- /* More sensors of one type than MAX_SENSORS_PER_TYPE,
- we have to ignore it */
+ /* Skip invalid entries. The high limit is arbitrary, we just
+ don't want to allocate an insane amount of memory. */
+ if (nr < 0 || nr >= 1024) {
#ifdef DEBUG
sensors_fatal_error(__func__,
- "Increase MAX_SENSORS_PER_TYPE!");
+ "Invalid channel number!");
#endif
continue;
}
+ /* (Re-)allocate memory if needed */
+ if (all_types[ftype].count < nr + 1) {
+ int old_count = all_types[ftype].count;
+ int step = ftype < SENSORS_FEATURE_VID ? 8 :
+ ftype < SENSORS_FEATURE_BEEP_ENABLE ? 2 : 1;
+
+ while (all_types[ftype].count < nr + 1)
+ all_types[ftype].count += step;
+
+ all_types[ftype].sf = realloc(all_types[ftype].sf,
+ all_types[ftype].count *
+ feature_size *
+ sizeof(sensors_subfeature));
+ if (!all_types[ftype].sf)
+ sensors_fatal_error(__func__, "Out of memory");
+ memset(all_types[ftype].sf + old_count * feature_size,
+ 0, (all_types[ftype].count - old_count) *
+ feature_size * sizeof(sensors_subfeature));
+ }
+
/* "calculate" a place to store the subfeature in our sparse,
sorted table */
- switch (ftype) {
- case SENSORS_FEATURE_VID:
- case SENSORS_FEATURE_INTRUSION:
- i = SUB_OFFSET_OTHER +
- (ftype - SENSORS_FEATURE_VID) * FEATURE_TYPE_SIZE +
- nr * FEATURE_SIZE + (sftype & 0xFF);
- break;
- case SENSORS_FEATURE_BEEP_ENABLE:
- i = SUB_OFFSET_MISC +
- (ftype - SENSORS_FEATURE_BEEP_ENABLE);
- break;
- default:
- i = ftype * FEATURE_TYPE_SIZE +
- nr * FEATURE_SIZE +
+ if (ftype < SENSORS_FEATURE_VID)
+ i = nr * feature_size +
((sftype & 0x80) >> 7) * max_subfeatures +
(sftype & 0x7F);
- }
+ else
+ i = nr * feature_size + (sftype & 0xFF);
- if (all_subfeatures[i].name) {
+ if (all_types[ftype].sf[i].name) {
#ifdef DEBUG
sensors_fatal_error(__func__, "Duplicate subfeature");
#endif
@@ -525,15 +522,16 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
}
/* fill in the subfeature members */
- all_subfeatures[i].type = sftype;
- all_subfeatures[i].name = strdup(name);
- if (!all_subfeatures[i].name)
+ all_types[ftype].sf[i].type = sftype;
+ all_types[ftype].sf[i].name = strdup(name);
+ if (!all_types[ftype].sf[i].name)
sensors_fatal_error(__func__, "Out of memory");
/* Other and misc subfeatures are never scaled */
if (sftype < SENSORS_SUBFEATURE_VID && !(sftype & 0x80))
- all_subfeatures[i].flags |= SENSORS_COMPUTE_MAPPING;
- all_subfeatures[i].flags |= sensors_get_attr_mode(dev_path, name);
+ all_types[ftype].sf[i].flags |= SENSORS_COMPUTE_MAPPING;
+ all_types[ftype].sf[i].flags |=
+ sensors_get_attr_mode(dev_path, name);
sfnum++;
}
@@ -545,14 +543,16 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
}
/* How many main features? */
+ for (ftype = 0; ftype < SENSORS_FEATURE_MAX; ftype++) {
prev_slot = -1;
- for (i = 0; i < ALL_POSSIBLE_SUBFEATURES; i++) {
- if (!all_subfeatures[i].name)
+ for (i = 0; i < all_types[ftype].count * feature_size; i++) {
+ if (!all_types[ftype].sf[i].name)
continue;
- if (i >= SUB_OFFSET_MISC || i / FEATURE_SIZE != prev_slot) {
+ if (i / feature_size != prev_slot) {
fnum++;
- prev_slot = i / FEATURE_SIZE;
+ prev_slot = i / feature_size;
+ }
}
}
@@ -564,31 +564,33 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
/* Copy from the sparse array to the compact array */
sfnum = 0;
fnum = -1;
+ for (ftype = 0; ftype < SENSORS_FEATURE_MAX; ftype++) {
prev_slot = -1;
- for (i = 0; i < ALL_POSSIBLE_SUBFEATURES; i++) {
- if (!all_subfeatures[i].name)
+ for (i = 0; i < all_types[ftype].count * feature_size; i++) {
+ if (!all_types[ftype].sf[i].name)
continue;
/* New main feature? */
- if (i >= SUB_OFFSET_MISC || i / FEATURE_SIZE != prev_slot) {
- ftype = all_subfeatures[i].type >> 8;
+ if (i / feature_size != prev_slot) {
fnum++;
- prev_slot = i / FEATURE_SIZE;
+ prev_slot = i / feature_size;
- dyn_features[fnum].name = get_feature_name(ftype,
- all_subfeatures[i].name);
+ dyn_features[fnum].name =
+ get_feature_name(ftype,
+ all_types[ftype].sf[i].name);
dyn_features[fnum].number = fnum;
dyn_features[fnum].first_subfeature = sfnum;
dyn_features[fnum].type = ftype;
}
- dyn_subfeatures[sfnum] = all_subfeatures[i];
+ dyn_subfeatures[sfnum] = all_types[ftype].sf[i];
dyn_subfeatures[sfnum].number = sfnum;
/* Back to the feature */
dyn_subfeatures[sfnum].mapping = fnum;
sfnum++;
}
+ }
chip->subfeature = dyn_subfeatures;
chip->subfeature_count = sfnum;
@@ -596,7 +598,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
chip->feature_count = ++fnum;
exit_free:
- free(all_subfeatures);
+ for (ftype = 0; ftype < SENSORS_FEATURE_MAX; ftype++)
+ free(all_types[ftype].sf);
return 0;
}
diff --git a/tools/gator/daemon/libsensors/sysfs.h b/tools/gator/daemon/libsensors/sysfs.h
index 38584afd028e..2e1114e13212 100644
--- a/tools/gator/daemon/libsensors/sysfs.h
+++ b/tools/gator/daemon/libsensors/sysfs.h
@@ -1,7 +1,7 @@
/*
sysfs.h - part of libsensors, a library for reading Linux sensor data
Copyright (C) Mark M. Hoffman <mhoffman@lightlink.com>
- Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>
+ Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/tools/gator/daemon/libsensors/version.h b/tools/gator/daemon/libsensors/version.h
index 76ceb08c29d0..7a730775734b 100644
--- a/tools/gator/daemon/libsensors/version.h
+++ b/tools/gator/daemon/libsensors/version.h
@@ -1 +1 @@
-#define LM_VERSION "3.3.2"
+#define LM_VERSION "3.4.0"
diff --git a/tools/gator/daemon/main.cpp b/tools/gator/daemon/main.cpp
index 95e179ef4459..e9223b9a0163 100644
--- a/tools/gator/daemon/main.cpp
+++ b/tools/gator/daemon/main.cpp
@@ -27,6 +27,7 @@
#include "Monitor.h"
#include "OlySocket.h"
#include "OlyUtility.h"
+#include "PmuXML.h"
#include "SessionData.h"
#include "Setup.h"
@@ -41,6 +42,7 @@ static bool driverMountedAtStart = false;
struct cmdline_t {
char *module;
+ char *pmuPath;
int port;
bool update;
};
@@ -49,16 +51,14 @@ struct cmdline_t {
void cleanUp() {
if (shutdownFilesystem() == -1) {
- logg->logMessage("Error shutting down gator filesystem");
+ logg.logMessage("Error shutting down gator filesystem");
}
delete sock;
- delete util;
- delete logg;
}
// CTRL C Signal Handler
static void handler(int signum) {
- logg->logMessage("Received signal %d, gator daemon exiting", signum);
+ logg.logMessage("Received signal %d, gator daemon exiting", signum);
// Case 1: both child and parent receive the signal
if (numSessions > 0) {
@@ -70,7 +70,7 @@ static void handler(int signum) {
// Case 2: only the parent received the signal
if (numSessions > 0) {
// Kill child threads - the first signal exits gracefully
- logg->logMessage("Killing process group as %d child was running when signal was received", numSessions);
+ logg.logMessage("Killing process group as %d child was running when signal was received", numSessions);
kill(0, SIGINT);
// Give time for the child to exit
@@ -78,7 +78,7 @@ static void handler(int signum) {
if (numSessions > 0) {
// The second signal force kills the child
- logg->logMessage("Force kill the child");
+ logg.logMessage("Force kill the child");
kill(0, SIGINT);
// Again, sleep for 1 second
sleep(1);
@@ -102,7 +102,7 @@ static void child_exit(int) {
pthread_mutex_lock(&numSessions_mutex);
numSessions--;
pthread_mutex_unlock(&numSessions_mutex);
- logg->logMessage("Child process %d exited with status %d", pid, status);
+ logg.logMessage("Child process %d exited with status %d", pid, status);
}
}
@@ -134,7 +134,7 @@ public:
memset(&mDstAns, 0, sizeof(mDstAns));
memcpy(mDstAns.rviHeader, "STR_ANS ", sizeof(mDstAns.rviHeader));
if (gethostname(mDstAns.dhcpName, sizeof(mDstAns.dhcpName) - 1) != 0) {
- logg->logError("gethostname failed");
+ logg.logError("gethostname failed");
handleException();
}
// Subvert the defaultGateway field for the port number
@@ -157,7 +157,7 @@ public:
addrlen = sizeof(sockaddr);
read = recvfrom(mReq, &buf, sizeof(buf), 0, (struct sockaddr *)&sockaddr, &addrlen);
if (read < 0) {
- logg->logError("recvfrom failed");
+ logg.logError("recvfrom failed");
handleException();
} else if ((read == 12) && (memcmp(buf, DST_REQ, sizeof(DST_REQ)) == 0)) {
// Don't care if sendto fails - gatord shouldn't exit because of it and Streamline will retry
@@ -181,21 +181,21 @@ private:
family = AF_INET;
s = socket_cloexec(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == -1) {
- logg->logError("socket failed");
+ logg.logError("socket failed");
handleException();
}
}
on = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) != 0) {
- logg->logError("setsockopt REUSEADDR failed");
+ logg.logError("setsockopt REUSEADDR failed");
handleException();
}
// Listen on both IPv4 and IPv6
on = 0;
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&on, sizeof(on)) != 0) {
- logg->logMessage("setsockopt IPV6_V6ONLY failed");
+ logg.logMessage("setsockopt IPV6_V6ONLY failed");
}
memset((void*)&sockaddr, 0, sizeof(sockaddr));
@@ -203,7 +203,7 @@ private:
sockaddr.sin6_port = htons(port);
sockaddr.sin6_addr = in6addr_any;
if (bind(s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
- logg->logError("socket failed");
+ logg.logError("socket failed");
handleException();
}
@@ -259,28 +259,27 @@ static bool setupFilesystem(char* module) {
// if still mounted
if (access("/dev/gator/buffer", F_OK) == 0) {
- logg->logError("Unable to remove the running gator.ko. Manually remove the module or use the running module by not specifying one on the commandline");
+ logg.logError("Unable to remove the running gator.ko. Manually remove the module or use the running module by not specifying one on the commandline");
handleException();
}
}
const int retval = mountGatorFS();
if (retval == 1) {
- logg->logMessage("Driver already running at startup");
+ logg.logMessage("Driver already running at startup");
driverRunningAtStart = true;
} else if (retval == 0) {
- logg->logMessage("Driver already mounted at startup");
+ logg.logMessage("Driver already mounted at startup");
driverRunningAtStart = driverMountedAtStart = true;
} else {
- char command[256]; // arbitrarily large amount
char location[256]; // arbitrarily large amount
if (module) {
strncpy(location, module, sizeof(location));
} else {
// Is the driver co-located in the same directory?
- if (util->getApplicationFullPath(location, sizeof(location)) != 0) { // allow some buffer space
- logg->logMessage("Unable to determine the full path of gatord, the cwd will be used");
+ if (getApplicationFullPath(location, sizeof(location)) != 0) { // allow some buffer space
+ logg.logMessage("Unable to determine the full path of gatord, the cwd will be used");
}
strncat(location, "gator.ko", sizeof(location) - strlen(location) - 1);
}
@@ -291,20 +290,20 @@ static bool setupFilesystem(char* module) {
return false;
} else {
// gator location specified on the command line but it was not found
- logg->logError("gator module not found at %s", location);
+ logg.logError("gator module not found at %s", location);
handleException();
}
}
// Load driver
if (!init_module(location)) {
- logg->logMessage("Unable to load gator.ko driver with command: %s", command);
- logg->logError("Unable to load (insmod) gator.ko driver:\n >>> gator.ko must be built against the current kernel version & configuration\n >>> See dmesg for more details");
+ logg.logMessage("Unable to load gator.ko driver from location %s", location);
+ logg.logError("Unable to load (insmod) gator.ko driver:\n >>> gator.ko must be built against the current kernel version & configuration\n >>> See dmesg for more details");
handleException();
}
if (mountGatorFS() == -1) {
- logg->logError("Unable to mount the gator filesystem needed for profiling.");
+ logg.logError("Unable to mount the gator filesystem needed for profiling.");
handleException();
}
}
@@ -325,12 +324,13 @@ static int shutdownFilesystem() {
return 0; // success
}
-static const char OPTSTRING[] = "hvVudap:s:c:e:E:m:o:";
+static const char OPTSTRING[] = "hvVudap:s:c:e:E:P:m:o:";
static bool hasDebugFlag(int argc, char** argv) {
int c;
optind = 1;
+ opterr = 0;
while ((c = getopt(argc, argv, OPTSTRING)) != -1) {
if (c == 'd') {
return true;
@@ -342,8 +342,8 @@ static bool hasDebugFlag(int argc, char** argv) {
static struct cmdline_t parseCommandLine(int argc, char** argv) {
struct cmdline_t cmdline;
+ memset(&cmdline, 0, sizeof(cmdline));
cmdline.port = DEFAULT_PORT;
- cmdline.module = NULL;
cmdline.update = false;
char version_string[256]; // arbitrary length to hold the version information
int c;
@@ -356,19 +356,23 @@ static struct cmdline_t parseCommandLine(int argc, char** argv) {
}
optind = 1;
+ opterr = 1;
while ((c = getopt(argc, argv, OPTSTRING)) != -1) {
switch (c) {
case 'c':
- gSessionData->mConfigurationXMLPath = optarg;
+ gSessionData.mConfigurationXMLPath = optarg;
break;
case 'd':
// Already handled
break;
case 'e':
- gSessionData->mEventsXMLPath = optarg;
+ gSessionData.mEventsXMLPath = optarg;
break;
case 'E':
- gSessionData->mEventsXMLAppend = optarg;
+ gSessionData.mEventsXMLAppend = optarg;
+ break;
+ case 'P':
+ cmdline.pmuPath = optarg;
break;
case 'm':
cmdline.module = optarg;
@@ -376,29 +380,30 @@ static struct cmdline_t parseCommandLine(int argc, char** argv) {
case 'p':
cmdline.port = strtol(optarg, NULL, 10);
if ((cmdline.port == 8082) || (cmdline.port == 8083)) {
- logg->logError("Gator can't use port %i, as it already uses ports 8082 and 8083 for annotations. Please select a different port.", cmdline.port);
+ logg.logError("Gator can't use port %i, as it already uses ports 8082 and 8083 for annotations. Please select a different port.", cmdline.port);
handleException();
}
break;
case 's':
- gSessionData->mSessionXMLPath = optarg;
+ gSessionData.mSessionXMLPath = optarg;
break;
case 'o':
- gSessionData->mTargetPath = optarg;
+ gSessionData.mTargetPath = optarg;
break;
case 'u':
cmdline.update = true;
break;
case 'a':
- gSessionData->mAllowCommands = true;
+ gSessionData.mAllowCommands = true;
break;
case 'h':
case '?':
- logg->logError(
+ logg.logError(
"%s. All parameters are optional:\n"
"-c config_xml path and filename of the configuration XML to use\n"
"-e events_xml path and filename of the events XML to use\n"
"-E events_xml path and filename of events XML to append\n"
+ "-P pmu_xml path and filename of pmu XML to append\n"
"-h this help page\n"
"-m module path and filename of gator.ko\n"
"-p port_number port upon which the server listens; default is 8080\n"
@@ -411,29 +416,29 @@ static struct cmdline_t parseCommandLine(int argc, char** argv) {
handleException();
break;
case 'v':
- logg->logError("%s", version_string);
+ logg.logError("%s", version_string);
handleException();
break;
case 'V':
- logg->logError("%s\nSRC_MD5: %s", version_string, gSrcMd5);
+ logg.logError("%s\nSRC_MD5: %s", version_string, gSrcMd5);
handleException();
break;
}
}
// Error checking
- if (cmdline.port != DEFAULT_PORT && gSessionData->mSessionXMLPath != NULL) {
- logg->logError("Only a port or a session xml can be specified, not both");
+ if (cmdline.port != DEFAULT_PORT && gSessionData.mSessionXMLPath != NULL) {
+ logg.logError("Only a port or a session xml can be specified, not both");
handleException();
}
- if (gSessionData->mTargetPath != NULL && gSessionData->mSessionXMLPath == NULL) {
- logg->logError("Missing -s command line option required for a local capture.");
+ if (gSessionData.mTargetPath != NULL && gSessionData.mSessionXMLPath == NULL) {
+ logg.logError("Missing -s command line option required for a local capture.");
handleException();
}
if (optind < argc) {
- logg->logError("Unknown argument: %s. Use '-h' for help.", argv[optind]);
+ logg.logError("Unknown argument: %s. Use '-h' for help.", argv[optind]);
handleException();
}
@@ -448,7 +453,8 @@ static void handleClient() {
int pid = fork();
if (pid < 0) {
// Error
- logg->logError("Fork process failed. Please power cycle the target device if this error persists.");
+ logg.logError("Fork process failed. Please power cycle the target device if this error persists.");
+ handleException();
} else if (pid == 0) {
// Child
sock->closeServerSocket();
@@ -471,7 +477,7 @@ static void handleClient() {
int wait = 0;
while (numSessions > 1) {
// Throttle until one of the children exits before continuing to accept another socket connection
- logg->logMessage("%d sessions active!", numSessions);
+ logg.logMessage("%d sessions active!", numSessions);
if (wait++ >= 10) { // Wait no more than 10 seconds
// Kill last created child
kill(pid, SIGALRM);
@@ -489,11 +495,8 @@ int main(int argc, char** argv) {
setsid();
// Set up global thread-safe logging
- logg = new Logging(hasDebugFlag(argc, argv));
- // Global data class
- gSessionData = new SessionData();
- // Set up global utility class
- util = new OlyUtility();
+ logg.setDebug(hasDebugFlag(argc, argv));
+ gSessionData.initialize();
prctl(PR_SET_NAME, (unsigned long)&"gatord-main", 0, 0, 0);
pthread_mutex_init(&numSessions_mutex, NULL);
@@ -504,7 +507,7 @@ int main(int argc, char** argv) {
// Set to high priority
if (setpriority(PRIO_PROCESS, syscall(__NR_gettid), -19) == -1) {
- logg->logMessage("setpriority() failed");
+ logg.logMessage("setpriority() failed");
}
// Parse the command line parameters
@@ -513,23 +516,26 @@ int main(int argc, char** argv) {
if (cmdline.update) {
update(argv[0]);
cmdline.update = false;
- gSessionData->mAllowCommands = true;
+ gSessionData.mAllowCommands = true;
}
// Verify root permissions
uid_t euid = geteuid();
if (euid) {
- logg->logError("gatord must be launched with root privileges");
+ logg.logError("gatord must be launched with root privileges");
handleException();
}
+ PmuXML::read(cmdline.pmuPath);
+
// Call before setting up the SIGCHLD handler, as system() spawns child processes
if (setupFilesystem(cmdline.module)) {
DriverSource::checkVersion();
+ PmuXML::writeToKernel();
} else {
- logg->logMessage("Unable to set up gatorfs, trying perf");
- if (!gSessionData->mPerf.setup()) {
- logg->logError(
+ logg.logMessage("Unable to set up gatorfs, trying perf");
+ if (!gSessionData.mPerf.setup()) {
+ logg.logError(
"Unable to locate gator.ko driver:\n"
" >>> gator.ko should be co-located with gatord in the same directory\n"
" >>> OR insmod gator.ko prior to launching gatord\n"
@@ -557,7 +563,7 @@ int main(int argc, char** argv) {
signal(SIGPIPE, SIG_IGN);
// If the command line argument is a session xml file, no need to open a socket
- if (gSessionData->mSessionXMLPath) {
+ if (gSessionData.mSessionXMLPath) {
child = new Child();
child->run();
delete child;
@@ -565,10 +571,10 @@ int main(int argc, char** argv) {
annotateListener.setup();
int pipefd[2];
if (pipe_cloexec(pipefd) != 0) {
- logg->logError("Unable to set up annotate pipe");
+ logg.logError("Unable to set up annotate pipe");
handleException();
}
- gSessionData->mAnnotateStart = pipefd[1];
+ gSessionData.mAnnotateStart = pipefd[1];
sock = new OlyServerSocket(cmdline.port);
udpListener.setup(cmdline.port);
if (!monitor.init() ||
@@ -578,16 +584,16 @@ int main(int argc, char** argv) {
!monitor.add(annotateListener.getUdsFd()) ||
!monitor.add(pipefd[0]) ||
false) {
- logg->logError("Monitor setup failed");
+ logg.logError("Monitor setup failed");
handleException();
}
// Forever loop, can be exited via a signal or exception
while (1) {
struct epoll_event events[2];
- logg->logMessage("Waiting on connection...");
+ logg.logMessage("Waiting on connection...");
int ready = monitor.wait(events, ARRAY_LENGTH(events), -1);
if (ready < 0) {
- logg->logError("Monitor::wait failed");
+ logg.logError("Monitor::wait failed");
handleException();
}
for (int i = 0; i < ready; ++i) {
@@ -602,7 +608,7 @@ int main(int argc, char** argv) {
} else if (events[i].data.fd == pipefd[0]) {
uint64_t val;
if (read(pipefd[0], &val, sizeof(val)) != sizeof(val)) {
- logg->logMessage("Reading annotate pipe failed");
+ logg.logMessage("Reading annotate pipe failed");
}
annotateListener.signal();
}
diff --git a/tools/gator/daemon/notify/COPYING b/tools/gator/daemon/notify/COPYING
deleted file mode 100644
index d159169d1050..000000000000
--- a/tools/gator/daemon/notify/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/tools/gator/daemon/notify/Makefile b/tools/gator/daemon/notify/Makefile
deleted file mode 100644
index 0d8f0415f0e2..000000000000
--- a/tools/gator/daemon/notify/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-ifneq ($(SDKDIR),)
-
-# Find the oldest SDK Platform installed >= 16
-SDK_PLATFORM := $(shell ls -d $(SDKDIR)/platforms/android-1[6-9] $(SDKDIR)/platforms/android-[2-9][0-9] | head -1)
-# Find the newest SDK Build-tools
-SDK_BUILD_TOOLS := $(shell ls -d $(SDKDIR)/build-tools/* | tail -1)
-
-all: notify.dex
-
-notify.dex: Notify.java
- javac -cp $(SDK_PLATFORM)/data/layoutlib.jar -source 1.6 -target 1.6 $^
- $(SDK_BUILD_TOOLS)/dx --dex --output=$@ $(^:%.java=%.class)
-
-else
-
-all:
- $(error Please specify SDKDIR as the location to the Android SDK)
-
-endif
-
-.PHONY: clean
-
-clean:
- rm -f *~ *.class *.dex
diff --git a/tools/gator/daemon/notify/Notify.java b/tools/gator/daemon/notify/Notify.java
deleted file mode 100644
index 970245114880..000000000000
--- a/tools/gator/daemon/notify/Notify.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (C) ARM Limited 2015. 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.
- */
-
-import android.os.IBinder;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-
-public class Notify {
- public static void main(String[] args) throws RemoteException {
- for (String service : ServiceManager.listServices()) {
- IBinder b = ServiceManager.checkService(service);
- if (b != null) {
- Parcel p = null;
- try {
- p = Parcel.obtain();
- b.transact(IBinder.SYSPROPS_TRANSACTION, p, null, 0);
- } finally {
- if (p != null) {
- p.recycle();
- }
- }
- }
- }
- }
-}
diff --git a/tools/gator/daemon/pmus.xml b/tools/gator/daemon/pmus.xml
new file mode 100644
index 000000000000..a6198dfbe24b
--- /dev/null
+++ b/tools/gator/daemon/pmus.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmus>
+ <!--
+ pmnc_name is the name used by perf (case insensitive)
+ cpuid is the Implementer and Primary part number from the Main ID Register (not required for uncore_pmu)
+ core_name is the human readable name shown in Streamline
+ dt_name is the name used in the device tree (optional)
+ pmnc_counters is the number of events that can be selected simultaneously
+
+ Adding a line in this file allows gatord to identify the PMU. A corresponding events-*.xml file should also be added to associate events with that PMU.
+ -->
+ <pmu pmnc_name="ARM_ARM11" cpuid="0x41b36" core_name="ARM1136" dt_name="arm,arm1136" pmnc_counters="3"/>
+ <pmu pmnc_name="ARM_ARM11" cpuid="0x41b56" core_name="ARM1156" dt_name="arm,arm1156" pmnc_counters="3"/>
+ <pmu pmnc_name="ARM_ARM11" cpuid="0x41b76" core_name="ARM1176" dt_name="arm,arm1176" pmnc_counters="3"/>
+ <pmu pmnc_name="ARM_ARM11MPCore" cpuid="0x41b02" core_name="ARM11MPCore" dt_name="arm,arm11mpcore" pmnc_counters="3"/>
+ <pmu pmnc_name="ARMv7_Cortex_A5" cpuid="0x41c05" core_name="Cortex-A5" dt_name="arm,cortex-a5" pmnc_counters="2"/>
+ <pmu pmnc_name="ARMv7_Cortex_A7" cpuid="0x41c07" core_name="Cortex-A7" dt_name="arm,cortex-a7" pmnc_counters="4"/>
+ <pmu pmnc_name="ARMv7_Cortex_A8" cpuid="0x41c08" core_name="Cortex-A8" dt_name="arm,cortex-a8" pmnc_counters="4"/>
+ <pmu pmnc_name="ARMv7_Cortex_A9" cpuid="0x41c09" core_name="Cortex-A9" dt_name="arm,cortex-a9" pmnc_counters="6"/>
+ <pmu pmnc_name="ARMv7_Cortex_A15" cpuid="0x41c0f" core_name="Cortex-A15" dt_name="arm,cortex-a15" pmnc_counters="6"/>
+ <pmu pmnc_name="ARMv7_Cortex_A17" cpuid="0x41c0d" core_name="Cortex-A17" dt_name="arm,cortex-a17" pmnc_counters="6"/>
+ <pmu pmnc_name="ARMv7_Cortex_A17" cpuid="0x41c0e" core_name="Cortex-A17" dt_name="arm,cortex-a17" pmnc_counters="6"/>
+ <pmu pmnc_name="Scorpion" cpuid="0x5100f" core_name="Scorpion" pmnc_counters="4"/>
+ <pmu pmnc_name="ScorpionMP" cpuid="0x5102d" core_name="ScorpionMP" pmnc_counters="4"/>
+ <pmu pmnc_name="Krait" cpuid="0x51049" core_name="KraitSIM" pmnc_counters="4"/>
+ <pmu pmnc_name="Krait" cpuid="0x5104d" core_name="Krait" pmnc_counters="4"/>
+ <pmu pmnc_name="Krait" cpuid="0x5106f" core_name="Krait S4 Pro" pmnc_counters="4"/>
+ <pmu pmnc_name="ARMv8_Cortex_A53" cpuid="0x41d03" core_name="Cortex-A53" dt_name="arm,cortex-a53" pmnc_counters="6"/>
+ <pmu pmnc_name="ARMv8_Cortex_A57" cpuid="0x41d07" core_name="Cortex-A57" dt_name="arm,cortex-a57" pmnc_counters="6"/>
+ <pmu pmnc_name="ARMv8_Cortex_A72" cpuid="0x41d08" core_name="Cortex-A72" dt_name="arm,cortex-a72" pmnc_counters="6"/>
+ <pmu pmnc_name="ARMv8_Exynos_M1" cpuid="0x53001" core_name="Exynos-M1" pmnc_counters="6"/>
+
+ <uncore_pmu pmnc_name="CCI_400" core_name="CCI_400" pmnc_counters="4"/>
+ <uncore_pmu pmnc_name="CCI_400_r1" core_name="CCI_400_r1" pmnc_counters="4"/>
+ <uncore_pmu pmnc_name="CCI_500" core_name="CCI_500" pmnc_counters="8" has_cycles_counter="no"/>
+ <uncore_pmu pmnc_name="ccn" core_name="ARM_CCN_5XX" pmnc_counters="8"/>
+</pmus>