diff options
author | Jon Medhurst <tixy@linaro.org> | 2012-05-10 17:30:53 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2012-05-21 12:51:31 +0100 |
commit | 90528bd1784f62fec3accf8fb6d1002b120bfe47 (patch) | |
tree | aaa5c8b19664dd9399b7654e214c30f142a70af6 /tools/gator/daemon/SessionData.cpp | |
parent | 76e10d158efb6d4516018846f60c2ab5501900bc (diff) |
gator: Version 5.10
New gator release (build 1385) for ARM DS-5 v5.10
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'tools/gator/daemon/SessionData.cpp')
-rw-r--r-- | tools/gator/daemon/SessionData.cpp | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/tools/gator/daemon/SessionData.cpp b/tools/gator/daemon/SessionData.cpp new file mode 100644 index 00000000000..a245369a37a --- /dev/null +++ b/tools/gator/daemon/SessionData.cpp @@ -0,0 +1,112 @@ +/** + * Copyright (C) ARM Limited 2010-2012. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <string.h> +#include "SessionData.h" +#include "SessionXML.h" +#include "Logging.h" +extern void handleException(); + +SessionData* gSessionData = NULL; + +SessionData::SessionData() { + initialize(); +} + +SessionData::~SessionData() { +} + +void SessionData::initialize() { + mWaitingOnCommand = false; + mSessionIsActive = false; + mLocalCapture = false; + mOneShot = false; + strcpy(mCoreName, "unknown"); + mConfigurationXMLPath = NULL; + mSessionXMLPath = NULL; + mEventsXMLPath = NULL; + mAPCDir = NULL; + mSampleRate = 0; + mDuration = 0; + mBytes = 0; + mBacktraceDepth = 0; + mTotalBufferSize = 0; + mCores = 1; + + initializeCounters(); +} + +void SessionData::initializeCounters() { + // PMU Counters + for (int i = 0; i < MAX_PERFORMANCE_COUNTERS; i++) { + mPerfCounterType[i][0] = 0; + mPerfCounterTitle[i][0] = 0; + mPerfCounterName[i][0] = 0; + mPerfCounterDescription[i][0] = 0; + mPerfCounterOperation[i][0] = 0; + mPerfCounterAlias[i][0] = 0; + mPerfCounterDisplay[i][0] = 0; + mPerfCounterUnits[i][0] = 0; + mPerfCounterEnabled[i] = 0; + mPerfCounterEvent[i] = 0; + mPerfCounterColor[i] = 0; + mPerfCounterKey[i] = 0; + mPerfCounterCount[i] = 0; + mPerfCounterPerCPU[i] = false; + mPerfCounterEBSCapable[i] = false; + mPerfCounterLevel[i] = false; + mPerfCounterAverageSelection[i] = false; + } +} + +void SessionData::parseSessionXML(char* xmlString) { + SessionXML session(xmlString); + session.parse(); + + // Parameter error checking + if (session.parameters.output_path == 0 && session.parameters.target_path == 0) { + logg->logError(__FILE__, __LINE__, "No capture path (target or host) was provided."); + handleException(); + } else if (gSessionData->mLocalCapture && session.parameters.target_path == 0) { + logg->logError(__FILE__, __LINE__, "Missing target_path tag in session xml required for a local capture."); + handleException(); + } + + // Set session data values + if (strcmp(session.parameters.sample_rate, "high") == 0) { + gSessionData->mSampleRate = 10000; + } else if (strcmp(session.parameters.sample_rate, "normal") == 0) { + gSessionData->mSampleRate = 1000; + } else if (strcmp(session.parameters.sample_rate, "low") == 0) { + gSessionData->mSampleRate = 100; + } else { + gSessionData->mSampleRate = 0; + } + gSessionData->mBacktraceDepth = session.parameters.call_stack_unwinding == true ? 128 : 0; + gSessionData->mDuration = session.parameters.duration; + + // Determine buffer size (in MB) based on buffer mode + gSessionData->mOneShot = true; + if (strcmp(session.parameters.buffer_mode, "streaming") == 0) { + gSessionData->mOneShot = false; + gSessionData->mTotalBufferSize = 1; + } else if (strcmp(session.parameters.buffer_mode, "small") == 0) { + gSessionData->mTotalBufferSize = 1; + } else if (strcmp(session.parameters.buffer_mode, "normal") == 0) { + gSessionData->mTotalBufferSize = 4; + } else if (strcmp(session.parameters.buffer_mode, "large") == 0) { + gSessionData->mTotalBufferSize = 16; + } else { + logg->logError(__FILE__, __LINE__, "Invalid value for buffer mode in session xml."); + handleException(); + } + + gSessionData->mImages = session.parameters.images; + gSessionData->mTargetPath = session.parameters.target_path; + gSessionData->mTitle = session.parameters.title; +} |