Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 89022 Details for
Bug 200251
[enh] Add support for "application" mode in the Java 1.5+ (JVMTI) Profiler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
200251_1.txt (text/plain), 51.61 KB, created by
Igor Alelekov
on 2008-02-06 11:38:55 EST
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Igor Alelekov
Created:
2008-02-06 11:38:55 EST
Size:
51.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.jvmti.runtime >Index: src-native/src/JPIAgent/ECWrapper.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/ECWrapper.h,v >retrieving revision 1.8 >diff -u -r1.8 ECWrapper.h >--- src-native/src/JPIAgent/ECWrapper.h 25 Apr 2007 14:23:16 -0000 1.8 >+++ src-native/src/JPIAgent/ECWrapper.h 6 Feb 2008 16:11:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 - 2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -32,8 +32,9 @@ > ECWrapper(CPrint* pCPrint, CFilters* pCFilters, COptions* pCOptions); > ~ECWrapper(void); > >- void InitACCollector(CEC_Callbacks* callbacks); >- >+ void InitACCollector(); >+ void RegisterMartiniCallbacks(CEC_Callbacks* callbacks); >+ > //protected: > static CPrint* m_pCPrint; > static CFilters* m_pCFilters; >Index: src-native/src/JPIAgent/ECWrapper.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/ECWrapper.cpp,v >retrieving revision 1.26 >diff -u -r1.26 ECWrapper.cpp >--- src-native/src/JPIAgent/ECWrapper.cpp 24 Aug 2007 17:29:24 -0000 1.26 >+++ src-native/src/JPIAgent/ECWrapper.cpp 6 Feb 2008 16:11:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 - 2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -47,68 +47,126 @@ > > //=== ACC_ENV =============================================================================================== > >+static boolean ACTracingStarted = false; >+static boolean appTracingStarted = false; >+static boolean tracingStarted = false; >+static boolean printingStarted = false; >+ >+static void startTracing(); >+static void start(); >+static void stopTracing(); >+static void stop(); >+ >+extern "C" int isProfilerApiEnabled() { >+ return (ECWrapper::m_pCOptions != NULL) && ECWrapper::m_pCOptions->isProfilerApiEnabled(); >+} >+ >+API_EXPORT void ACC_CALL ACStartTracing() { >+ LOG_TRACE("ACStartTracing command!"); >+ if (ACTracingStarted) return; >+ >+ ACTracingStarted = true; >+ startTracing(); >+} >+ >+extern "C" void appStartTracing() { >+ LOG_TRACE("appStartTracing command!"); >+ if (appTracingStarted) return; >+ >+ appTracingStarted = true; >+ startTracing(); >+} >+ > /** START_TRACING ************************************************************* > * This is the entry point which must be called to start a trace. It takes > * care of emitting all the header information. > */ >-API_EXPORT void ACC_CALL >-StartTracing() >-{ >- LOG_TRACE("StartTracing command!"); >- LOG_ASSERT(ECWrapper::m_pCPrint != 0); >- ECWrapper::m_pCPrint->m_jvmtiAgent_suspendIO = false; >- ECWrapper::m_pCPrint->PrintStartingFragments(); >-} >- >-/** STOP_TRACING ************************************************************** >-* This is where a trace is stopped. >-*/ >-API_EXPORT void ACC_CALL >-StopTracing() >-{ >- LOG_TRACE("StopTracing command!"); >- LOG_ASSERT(ECWrapper::m_pCPrint != 0); >- LOG_ASSERT(ECWrapper::m_pCOptions != 0); >- ECWrapper::m_pCPrint->printTraceEndElement(); >- ECWrapper::m_pCPrint->m_jvmtiAgent_suspendIO = true; >+static void startTracing() { >+ if (tracingStarted) return; >+ >+ boolean profilerApiEnabled = false; >+ boolean standaloneMode = false; >+ >+ if (ECWrapper::m_pCOptions != NULL) { >+ profilerApiEnabled = ECWrapper::m_pCOptions->isProfilerApiEnabled(); >+ standaloneMode = ECWrapper::m_pCOptions->isStandAlone(); >+ } >+ >+ boolean toTrace = (standaloneMode || ACTracingStarted) && (appTracingStarted || !profilerApiEnabled); >+ >+ if (!toTrace) return; >+ >+ start(); >+ tracingStarted = true; > } > >-API_EXPORT void ACC_CALL >-Start() >-{ >+static void start() { > LOG_TRACE("Start command!"); >+ >+ LOG_ASSERT(ECWrapper::m_pCPrint != 0); >+ ECWrapper::m_pCPrint->m_jvmtiAgent_suspendIO = false; >+ >+ if (!printingStarted) { >+ ECWrapper::m_pCPrint->PrintStartingFragments(); >+ printingStarted = true; >+ } >+ > LOG_ASSERT(ECWrapper::m_pCallbacks != 0); >+ > ECWrapper::m_pCallbacks->Start(); > } > >-API_EXPORT void ACC_CALL >-Stop() >-{ >- LOG_TRACE("Stop command!"); >- LOG_ASSERT(ECWrapper::m_pCallbacks != 0); >- ECWrapper::m_pCallbacks->Stop(); >+API_EXPORT void ACC_CALL ACStopTracing() { >+ LOG_TRACE("ACStop command!"); >+ if (!ACTracingStarted) return; >+ >+ ACTracingStarted = false; >+ stopTracing(); > } > >-API_EXPORT void ACC_CALL >-Resume() >-{ >- LOG_TRACE("Resume command!"); >- LOG_ASSERT(ECWrapper::m_pCallbacks != 0); >- LOG_ASSERT(ECWrapper::m_pCPrint != 0); >- ECWrapper::m_pCPrint->m_jvmtiAgent_suspendIO = false; >- ECWrapper::m_pCallbacks->Start(); >+extern "C" void appStopTracing() { >+ LOG_TRACE("appStop command!"); >+ if (!appTracingStarted) return; >+ >+ appTracingStarted = false; >+ stopTracing(); > } > >-API_EXPORT void ACC_CALL >-Pause() >-{ >- LOG_TRACE("Pause command!"); >+/** STOP_TRACING ************************************************************** >+* This is where a trace is stopped. >+*/ >+static void stopTracing() { >+ if (!tracingStarted) return; >+ >+ boolean profilerApiEnabled = false; >+ boolean standaloneMode = false; >+ >+ if (ECWrapper::m_pCOptions != NULL) { >+ profilerApiEnabled = ECWrapper::m_pCOptions->isProfilerApiEnabled(); >+ standaloneMode = ECWrapper::m_pCOptions->isStandAlone(); >+ } >+ >+ boolean toTrace = (standaloneMode || ACTracingStarted) && (appTracingStarted || !profilerApiEnabled); >+ if (toTrace) return; >+ >+ tracingStarted = false; >+ stop(); >+} >+ >+static void stop() { >+ LOG_TRACE("Stop command!"); >+ > LOG_ASSERT(ECWrapper::m_pCallbacks != 0); >- LOG_ASSERT(ECWrapper::m_pCPrint != 0); > ECWrapper::m_pCallbacks->Stop(); >+ LOG_ASSERT(ECWrapper::m_pCPrint != 0); > ECWrapper::m_pCPrint->m_jvmtiAgent_suspendIO = true; > } > >+extern "C" void printCustomElement(const char* str) { >+ LOG_ASSERT(ECWrapper::m_pCPrint != 0); >+ ECWrapper::m_pCPrint->printCustomElement(str); >+} >+ > API_EXPORT void ACC_CALL > Attach() > { >@@ -123,6 +181,15 @@ > LOG_TRACE("Detach command!"); > LOG_ASSERT(ECWrapper::m_pCallbacks != 0); > ECWrapper::m_pCallbacks->Detach(); >+ >+ LOG_ASSERT(ECWrapper::m_pCPrint != 0); >+ >+ if (printingStarted) { >+ ECWrapper::m_pCPrint->printTraceEndElement(); >+ printingStarted = false; >+ } >+ >+ ECWrapper::m_pCPrint->m_jvmtiAgent_suspendIO = true; > } > > API_EXPORT void ACC_CALL >@@ -164,7 +231,13 @@ > { > LOG_TRACE("RunGC command!"); > LOG_ASSERT(ECWrapper::m_pCallbacks != 0); >- ECWrapper::m_pCallbacks->CustomCommand(RUN_GC_COMMAND, 0); >+ if (ECWrapper::m_pCallbacks != NULL) { >+ ECWrapper::m_pCallbacks->CustomCommand(RUN_GC_COMMAND, 0); >+ } >+} >+ >+extern "C" void runGC() { >+ RunGC(); > } > > API_EXPORT void ACC_CALL >@@ -201,12 +274,9 @@ > ECWrapper::PrepareACCEnv() > { > static ACCFunctions_ functions; >- functions.StartTracing = &StartTracing; >- functions.StopTracing = &StopTracing; >- functions.Start = &Start; >- functions.Stop = &Stop; >- functions.Pause = &Pause; >- functions.Resume = &Resume; >+ functions.StartTracing = &ACStartTracing; >+ functions.StopTracing = &ACStopTracing; >+ > functions.Detach = &Detach; > functions.Attach = &Attach; > functions.AddFilter = &AddFilter; >@@ -223,10 +293,13 @@ > return &ac_env; > } > >+void ECWrapper::RegisterMartiniCallbacks(CEC_Callbacks* callbacks) { >+ m_pCallbacks = callbacks; >+} >+ > void >-ECWrapper::InitACCollector(CEC_Callbacks* callbacks) >+ECWrapper::InitACCollector() > { >- m_pCallbacks = callbacks; > ACC_ENV* ac_env = PrepareACCEnv(); > > Martini::OSA::ILibraryLoader* libraryLoader; >Index: src-native/src/JPIAgent/ECJvmtiAgent.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/ECJvmtiAgent.cpp,v >retrieving revision 1.11 >diff -u -r1.11 ECJvmtiAgent.cpp >--- src-native/src/JPIAgent/ECJvmtiAgent.cpp 18 Apr 2007 15:02:24 -0000 1.11 >+++ src-native/src/JPIAgent/ECJvmtiAgent.cpp 6 Feb 2008 16:11:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 - 2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -74,11 +74,20 @@ > bool static isInitACCollectorInvoked = false; > int res = m_Callbacks.RegisterMartiniCallback_(command, callback); > if (res == 1) { >- if ((command == CMD_START) && m_Options.isStandAlone()) { >+ if ((command == CMD_START) && m_Options.isStandAlone() && !m_Options.isProfilerApiEnabled()) { >+ m_Print.m_jvmtiAgent_suspendIO = false; >+ m_Print.PrintStartingFragments(); >+ > m_Callbacks.Start(); > } >- if (!isInitACCollectorInvoked && m_Callbacks.ProfCallbacksAvailable() && !m_Options.isStandAlone()) { >- m_ECWrapper.InitACCollector(&m_Callbacks); >+ >+ if (!isInitACCollectorInvoked && m_Callbacks.ProfCallbacksAvailable()) { >+ m_ECWrapper.RegisterMartiniCallbacks(&m_Callbacks); >+ >+ if (!m_Options.isStandAlone()) { >+ m_ECWrapper.InitACCollector(); >+ } >+ > isInitACCollectorInvoked = true; > } > } >Index: src-native/src/JPIAgent/Options.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/Options.cpp,v >retrieving revision 1.18 >diff -u -r1.18 Options.cpp >--- src-native/src/JPIAgent/Options.cpp 23 Aug 2007 21:32:13 -0000 1.18 >+++ src-native/src/JPIAgent/Options.cpp 6 Feb 2008 16:11:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 - 2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -57,7 +57,7 @@ > { > 1 /* Provide timestamps by default */ > ,0 /* Standalone mode */ >-// ,0 /* Application mode */ >+ ,0 /* profilerApiEnabled */ > ,1 /* Enabled mode */ > ,1 /* Filters */ > ,1 /* Options */ >@@ -115,26 +115,6 @@ > strcpy(m_jvmtiAgent_Options.workDir, DEFAULT_WORK_DIR); > } > >-int >-COptions::getToken(const char **src, char *buf, int buflen, char sep) >-{ >- int i; >- const char *p = *src; >- for (i = 0; i < buflen; i++) { >- if (p[i] == 0 || p[i] == sep) { >- buf[i] = 0; >- if (p[i] == sep) { >- i++; >- } >- *src += i; >- return i; >- } >- buf[i] = p[i]; >- } >- /* overflow */ >- return 0; >-} >- > /** PRINT_USAGE ********************************************************************** > * Print the command line useage of the program. > */ >@@ -155,6 +135,7 @@ > "\n" > "Supported option names and values:\n" > " server=standalone|enabled|controlled\n" >+ " api=true|false\tWhether to enable the Profiler API (true) or not (false). Default is false.\n" > " file=<file>\t\tOutput file (default is %s)\n" > " \t\t\tOnly applicable when server=standalone\n" > " filters=<file>\tFilter definition file (default is %s)\n" >@@ -434,130 +415,123 @@ > return rc; > } > >-/** PROCESS_INVOCATION_OPTIONS ******************************************* >-* Takes the command line parameters and populates the m_jvmtiAgent_Options >-* with the correct values based upon the options specified. >-* @param optionString - the command line args >-* @returns >-*/ >- >-int >-COptions::ProcessInvocationOptions(const char *str) >-{ >- char *buf = 0; >- int buflen; >- int outputSpecified = 0; >- if (str == 0) str = ""; >+int COptions::parseOptions(char* buf) { >+ int outputSpecified = 0; > >- /* if "help" is specified print out the useage */ >- if ((STRICOLL(str, "help")) == 0) { >- return -1; >- } >- >- while (*str) { >- buflen= strlen(str)+1; >- buf = (char *)malloc(buflen); >- if (!buf) { >- goto mem_error; >- } >+ char* pnext = buf; >+ while (pnext) { >+ char* pname = pnext; // current tag >+ >+ pnext = strchr(pnext, ','); >+ if (pnext != NULL) { >+ *pnext++ = '\0'; // next tag >+ } >+ >+ char* pvalue = strchr(pname, '='); >+ if (pvalue != NULL) { >+ *pvalue++ = '\0'; >+ } > >- /* All options contain an "=" */ >- if (!getToken(&str, buf, buflen, '=')) { >- goto bad_option; >- } > /* Specied output file */ >- if (STRICOLL(buf, "file") == 0) { >- if (outputSpecified || !getToken(&str, buf, buflen, ',')) { >- goto bad_option; >- } >- strcpyrealloc(&m_jvmtiAgent_Options.outputFileName, buf); >+ if (STRICOLL(pname, "file") == 0) { >+ if (outputSpecified || pvalue == NULL) return -1; >+ >+ strcpyrealloc(&m_jvmtiAgent_Options.outputFileName, pvalue); > outputSpecified = 1; >- } else if (STRICOLL(buf, "filters") == 0) { >- if (!getToken(&str, buf, buflen, ',')) { >- goto bad_option; >- } >- strcpyrealloc(&m_jvmtiAgent_Options.filterFileName,buf); >-// } else if (STRICOLL(buf, "debug") == 0) { >-// if (!getToken(&str, buf, buflen, ',')) { >-// goto bad_option; >-// } else { >-// goto bad_option; >-// } >+ } else if (STRICOLL(pname, "filters") == 0) { >+ if (pvalue == NULL) return -1; >+ >+ strcpyrealloc(&m_jvmtiAgent_Options.filterFileName, pvalue); > } > /* Mode of operation */ >- else if (STRICOLL(buf, "server") == 0) { >- if (!getToken(&str, buf, buflen, ',')) { >- goto bad_option; >- } >+ else if (STRICOLL(pname, "server") == 0) { >+ if (pvalue == NULL) return -1; >+ > /* If standalone */ >- if (STRICOLL(buf,"standalone") == 0) { >+ if (STRICOLL(pvalue,"standalone") == 0) { > m_jvmtiAgent_Options.standalone = 1; > m_jvmtiAgent_Options.enabled = 0; > } > /* If enabled */ >- else if (STRICOLL(buf, "enabled") == 0) { >+ else if (STRICOLL(pvalue, "enabled") == 0) { > m_jvmtiAgent_Options.standalone = 0; > m_jvmtiAgent_Options.enabled = 1; > } > /* If controlled */ >- else if (STRICOLL(buf, "controlled") == 0) { >+ else if (STRICOLL(pvalue, "controlled") == 0) { > m_jvmtiAgent_Options.standalone = 0; > m_jvmtiAgent_Options.enabled = 0; > } else { >- goto bad_option; >+ return -1; > } >- } else if (STRICOLL(buf, "workDir") == 0) { >- if (!getToken(&str, buf, buflen, ',')) { >- goto bad_option; >+ } else if (STRICOLL(pname, "api") == 0) { >+ if (pvalue == NULL) return -1; >+ >+ if (STRICOLL(pvalue, "true") == 0) { >+ m_jvmtiAgent_Options.profilerApiEnabled = 1; > } >- strcpyrealloc(&m_jvmtiAgent_Options.workDir, buf); >+ } else if (STRICOLL(pname, "workDir") == 0) { >+ if (pvalue == NULL) return -1; >+ >+ strcpyrealloc(&m_jvmtiAgent_Options.workDir, pvalue); > > /* create the directory */ > if (MKDIR(m_jvmtiAgent_Options.workDir) != 0 && errno != EEXIST) { > /* couldn't create the dir and it doesn't exists either */ > perror(m_jvmtiAgent_Options.workDir); >- goto bad_option; >+ return -1; > } > > /* end of workDir */ >- } else if (STRICOLL(buf, "profile") == 0) { >+ } else if (STRICOLL(pname, "profile") == 0) { > m_jvmtiAgent_Options.profileFile; >- if (!getToken(&str, buf, buflen, ',')) { >- goto bad_option; >- } >- strcpyrealloc(&m_jvmtiAgent_Options.profileFile, buf); >+ if (pvalue == NULL) return -1; >+ >+ strcpyrealloc(&m_jvmtiAgent_Options.profileFile, pvalue); > } else { >- char *buf2 = (char *)malloc(buflen); >- if (!getToken(&str, buf2, buflen, ',')) { >- free(buf2); >- return -1; >- } >- SetProfileOption(buf, buf2); >- free(buf2); >+ if (pvalue == NULL) return -1; >+ SetProfileOption(pname, pvalue); > } >-// } else { >-// /* unknown option */ >-// fprintf(stderr, "Unknown option \"%s\"\n", buf); >-// fflush(stderr); >-// goto bad_option; >-// } >- } >- if (buf) { >- free (buf); >+ } >+ >+ return 0; >+} >+ >+/** PROCESS_INVOCATION_OPTIONS ******************************************* >+* Takes the command line parameters and populates the m_jvmtiAgent_Options >+* with the correct values based upon the options specified. >+* @param optionString - the command line args >+* @returns >+*/ >+ >+int COptions::ProcessInvocationOptions(const char *str) { >+ char* buf; >+ >+ if (str == NULL) return 0; >+ >+ /* if "help" is specified print out the useage */ >+ if ((STRICOLL(str, "help")) == 0) { >+ return -1; > } >- return 0; > >-bad_option: >- if (buf) { >- free(buf); >+ buf = (char*) malloc(strlen(str) + 1); >+ if (buf == NULL) { >+ fprintf(stderr, "Memory allocation error\n"); >+ fflush(stderr); >+ return -1; >+ } >+ >+ strcpy(buf, str); >+ >+ int r = parseOptions(buf); >+ free(buf); >+ >+ if (r < 0) { >+ fprintf(stderr, "Illegal TIAgent option\n"); >+ fflush(stderr); > } >- fprintf(stderr, "Bad TIAgent option\n"); >- fflush(stderr); >- return -1; >-mem_error: >- fprintf(stderr, "Memory allocation error\n"); >- fflush(stderr); >- return -1; >+ >+ return r; > } > > /** CHECK_OPTIONS_CONSISTENCY ******************************************** >Index: src-native/src/JPIAgent/Options.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/Options.h,v >retrieving revision 1.14 >diff -u -r1.14 Options.h >--- src-native/src/JPIAgent/Options.h 28 Jun 2007 07:17:32 -0000 1.14 >+++ src-native/src/JPIAgent/Options.h 6 Feb 2008 16:11:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 - 2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2005 - 2008 IBM Corporation, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -36,7 +36,7 @@ > typedef struct { > unsigned int timestamp:1; /* Provide timestamps on all events (TRUE) */ > unsigned int standalone:1; /* Standalone mode (FALSE) */ >-// unsigned int application:1; /* Application mode (FALSE) */ >+ unsigned int profilerApiEnabled:1; /* isProfilerApiEnabled (FALSE) */ > unsigned int enabled:1; /* Enabled mode ie. attachable (TRUE) */ > unsigned int filters:1; /* Print FILTER Elements (TRUE) */ > unsigned int options:1; /* Print OPTIONS Elements (TRUE) */ >@@ -126,6 +126,10 @@ > return (m_jvmtiAgent_Options.enabled == 1) ; > } > >+ bool isProfilerApiEnabled() { >+ return (m_jvmtiAgent_Options.profilerApiEnabled == 1); >+ } >+ > // is CG pfofiler aggregated > bool isCGExecDetails() { > return (!isEnabled()) && (m_jvmtiAgent_Options.cgExecDetails == 1); //in enabled mode we support aggregated cg profiler only >@@ -154,7 +158,7 @@ > ***/ > void addUnknownOption(char *key, char *value); > >- int getToken(const char **src, char *buf, int buflen, char sep); >+ int parseOptions(char* buf); > > /* Get the absolute directory path for the optheap working dir*/ > void getWorkDir(char* buf); >Index: src-native/src/JPIAgent/PrintXML.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/PrintXML.cpp,v >retrieving revision 1.24 >diff -u -r1.24 PrintXML.cpp >--- src-native/src/JPIAgent/PrintXML.cpp 5 Jun 2007 16:08:26 -0000 1.24 >+++ src-native/src/JPIAgent/PrintXML.cpp 6 Feb 2008 16:11:06 -0000 >@@ -32,7 +32,7 @@ > CPrintXML::PrintStartingFragments() > { > /* If we are in standalone print the required additional elements */ >- if((m_pOptions->m_jvmtiAgent_Options.standalone/*||m_pOptions->m_jvmtiAgent_Options.application*/)) { >+ if((m_pOptions->m_jvmtiAgent_Options.standalone/*||m_pOptions->m_jvmtiAgent_Options.profilerApiEnabled*/)) { > printXMLStartElement(); > printStandaloneTraceTagOpen(); > } >Index: .classpath >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/.classpath,v >retrieving revision 1.2 >diff -u -r1.2 .classpath >--- .classpath 2 May 2007 15:30:26 -0000 1.2 >+++ .classpath 6 Feb 2008 16:11:05 -0000 >@@ -1,6 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="src" path="src.config"/> >+ <classpathentry kind="src" path="src"/> > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> > <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.tptp.platform.agentcontroller"/> > <classpathentry kind="output" path="bin"/> >Index: src-native/build/BuildJPIAgent32.mak >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/build/BuildJPIAgent32.mak,v >retrieving revision 1.5 >diff -u -r1.5 BuildJPIAgent32.mak >--- src-native/build/BuildJPIAgent32.mak 18 Sep 2006 12:36:20 -0000 1.5 >+++ src-native/build/BuildJPIAgent32.mak 6 Feb 2008 16:11:05 -0000 >@@ -48,6 +48,7 @@ > -@erase "$(INTDIR)\Options.obj" > -@erase "$(INTDIR)\Performance.obj" > -@erase "$(INTDIR)\Print.obj" >+ -@erase "$(INTDIR)\Profiler.obj" > -@erase "$(INTDIR)\PrintXML.obj" > -@erase "$(INTDIR)\utility.obj" > -@erase "$(INTDIR)\vc*.idb" >@@ -62,7 +63,7 @@ > "$(INTDIR)" : > if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" > >-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./../include/Martini" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c >+CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./../include/Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c > MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 > BSC32=bscmake.exe > BSC32_FLAGS=/nologo /o"$(OUTDIR)\BuildJPIAgent32.bsc" >@@ -79,6 +80,7 @@ > "$(INTDIR)\Performance.obj" \ > "$(INTDIR)\Print.obj" \ > "$(INTDIR)\PrintXML.obj" \ >+ "$(INTDIR)\Profiler.obj" \ > "$(INTDIR)\utility.obj" > > "$(OUTDIR)\JPIAgent.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) >@@ -106,6 +108,7 @@ > -@erase "$(INTDIR)\Performance.obj" > -@erase "$(INTDIR)\Print.obj" > -@erase "$(INTDIR)\PrintXML.obj" >+ -@erase "$(INTDIR)\Profiler.obj" > -@erase "$(INTDIR)\utility.obj" > -@erase "$(INTDIR)\vc*.idb" > -@erase "$(INTDIR)\vc*.pdb" >@@ -121,7 +124,7 @@ > "$(INTDIR)" : > if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" > >-CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./../include/JPIAgent" /I "./../include/Martini" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c >+CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./../include/JPIAgent" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "./../include/Martini" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent32.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c > MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 > BSC32=bscmake.exe > BSC32_FLAGS=/nologo /o"$(OUTDIR)\BuildJPIAgent32.bsc" >@@ -138,6 +141,7 @@ > "$(INTDIR)\Performance.obj" \ > "$(INTDIR)\Print.obj" \ > "$(INTDIR)\PrintXML.obj" \ >+ "$(INTDIR)\Profiler.obj" \ > "$(INTDIR)\utility.obj" > > "$(OUTDIR)\JPIAgent.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) >@@ -234,6 +238,11 @@ > "$(INTDIR)\PrintXML.obj" : $(SOURCE) "$(INTDIR)" > $(CPP) $(CPP_PROJ) $(SOURCE) > >+SOURCE=..\src\JPIAgent\Profiler.c >+ >+"$(INTDIR)\Profiler.obj" : $(SOURCE) "$(INTDIR)" >+ $(CPP) $(CPP_PROJ) $(SOURCE) >+ > SOURCE=..\src\JPIAgent\utility.c > > "$(INTDIR)\utility.obj" : $(SOURCE) "$(INTDIR)" >Index: src-native/build/BuildJPIAgentEM64T.mak >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/build/BuildJPIAgentEM64T.mak,v >retrieving revision 1.4 >diff -u -r1.4 BuildJPIAgentEM64T.mak >--- src-native/build/BuildJPIAgentEM64T.mak 18 Sep 2006 12:36:20 -0000 1.4 >+++ src-native/build/BuildJPIAgentEM64T.mak 6 Feb 2008 16:11:05 -0000 >@@ -46,6 +46,7 @@ > -@erase "$(INTDIR)\Performance.obj" > -@erase "$(INTDIR)\Print.obj" > -@erase "$(INTDIR)\PrintXML.obj" >+ -@erase "$(INTDIR)\Profiler.obj" > -@erase "$(INTDIR)\utility.obj" > -@erase "$(INTDIR)\vc*.idb" > -@erase "$(INTDIR)\BuildJPIAgent32.pch" >@@ -59,7 +60,7 @@ > "$(INTDIR)" : > if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" > >-CPP_PROJ=/nologo /MT /W3 /EHsc /O2 /I "./../include/Martini" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EM64T_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c >+CPP_PROJ=/nologo /MT /W3 /EHsc /O2 /I "./../include/Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EM64T_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c > > LINKEM64T=link.exe > LINKEM64T_FLAGS=Rpcrt4.lib bufferoverflowu.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib MartiniOSA.lib /nologo /dll /pdb:none /machine:amd64 /out:"$(OUTDIR)\JPIAgent.dll" /implib:"$(OUTDIR)\JPIAgent.lib" /libpath:"..\bin\windows\release\EM64T" /libpath:"..\windows\debug\EM64T" >@@ -72,6 +73,7 @@ > "$(INTDIR)\Performance.obj" \ > "$(INTDIR)\Print.obj" \ > "$(INTDIR)\PrintXML.obj" \ >+ "$(INTDIR)\Profiler.obj" \ > "$(INTDIR)\utility.obj" > > "$(OUTDIR)\JPIAgent.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINKEM64T_OBJS) >@@ -99,6 +101,7 @@ > -@erase "$(INTDIR)\Performance.obj" > -@erase "$(INTDIR)\Print.obj" > -@erase "$(INTDIR)\PrintXML.obj" >+ -@erase "$(INTDIR)\Profiler.obj" > -@erase "$(INTDIR)\utility.obj" > -@erase "$(INTDIR)\vc*.idb" > -@erase "$(INTDIR)\vc*.pdb" >@@ -114,7 +117,7 @@ > "$(INTDIR)" : > if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" > >-CPP_PROJ=/nologo /MTd /W3 /EHsc /Od /I "./../include/JPIAgent" /I "./../include/Martini" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EM64T_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgentEM64T.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c >+CPP_PROJ=/nologo /MTd /W3 /EHsc /Od /I "./../include/JPIAgent" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "./../include/Martini" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EM64T_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgentEM64T.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c > > LINKEM64T=link.exe > LINKEM64T_FLAGS=Rpcrt4.lib bufferoverflowu.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib MartiniOSA.lib /nologo /dll /pdb:none /debug /machine:amd64 /out:"$(OUTDIR)\JPIAgent.dll" /implib:"$(OUTDIR)\JPIAgent.lib" /libpath:"..\bin\windows\debug\EM64T" >@@ -126,6 +129,7 @@ > "$(INTDIR)\Options.obj" \ > "$(INTDIR)\Performance.obj" \ > "$(INTDIR)\Print.obj" \ >+ "$(INTDIR)\Profiler.obj" \ > "$(INTDIR)\PrintXML.obj" \ > "$(INTDIR)\utility.obj" > >@@ -224,6 +228,11 @@ > $(CPP) $(CPP_PROJ) $(SOURCE) > > >+SOURCE=..\src\JPIAgent\Profiler.c >+ >+"$(INTDIR)\Profiler.obj" : $(SOURCE) "$(INTDIR)" >+ $(CPP) $(CPP_PROJ) $(SOURCE) >+ > SOURCE=..\src\JPIAgent\utility.c > > "$(INTDIR)\utility.obj" : $(SOURCE) "$(INTDIR)" >Index: src-native/build/BuildJPIAgentIPF.mak >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/build/BuildJPIAgentIPF.mak,v >retrieving revision 1.5 >diff -u -r1.5 BuildJPIAgentIPF.mak >--- src-native/build/BuildJPIAgentIPF.mak 18 Sep 2006 12:36:20 -0000 1.5 >+++ src-native/build/BuildJPIAgentIPF.mak 6 Feb 2008 16:11:05 -0000 >@@ -46,6 +46,7 @@ > -@erase "$(INTDIR)\Performance.obj" > -@erase "$(INTDIR)\Print.obj" > -@erase "$(INTDIR)\PrintXML.obj" >+ -@erase "$(INTDIR)\Profiler.obj" > -@erase "$(INTDIR)\utility.obj" > -@erase "$(INTDIR)\vc*.idb" > -@erase "$(INTDIR)\BuildJPIAgent32.pch" >@@ -59,7 +60,7 @@ > "$(INTDIR)" : > if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" > >-CPP_PROJ=/nologo /MT /W3 /EHsc /O2 /I "./../include/Martini" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IPF_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c >+CPP_PROJ=/nologo /MT /W3 /EHsc /O2 /I "./../include/Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IPF_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgent.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c > > LINKIPF=link.exe > LINKIPF_FLAGS=Rpcrt4.lib bufferoverflowu.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib MartiniOSA.lib /nologo /dll /pdb:none /machine:ia64 /out:"$(OUTDIR)\JPIAgent.dll" /implib:"$(OUTDIR)\JPIAgent.lib" /libpath:"..\bin\windows\release\IPF" /libpath:"..\windows\debug\IPF" >@@ -71,6 +72,7 @@ > "$(INTDIR)\Options.obj" \ > "$(INTDIR)\Performance.obj" \ > "$(INTDIR)\Print.obj" \ >+ "$(INTDIR)\Profiler.obj" \ > "$(INTDIR)\PrintXML.obj" \ > "$(INTDIR)\utility.obj" > >@@ -99,6 +101,7 @@ > -@erase "$(INTDIR)\Performance.obj" > -@erase "$(INTDIR)\Print.obj" > -@erase "$(INTDIR)\PrintXML.obj" >+ -@erase "$(INTDIR)\Profiler.obj" > -@erase "$(INTDIR)\utility.obj" > -@erase "$(INTDIR)\vc*.idb" > -@erase "$(INTDIR)\vc*.pdb" >@@ -114,7 +117,7 @@ > "$(INTDIR)" : > if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" > >-CPP_PROJ=/nologo /MTd /W3 /EHsc /Od /I "./../include/JPIAgent" /I "./../include/Martini" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IPF_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgentIPF.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c >+CPP_PROJ=/nologo /MTd /W3 /EHsc /Od /I "./../include/JPIAgent" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "./../include/Martini" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IPF_ARCH" /D "ECWRAPPER_EXPORTS" /Fp"$(INTDIR)\BuildJPIAgentIPF.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c > > LINKIPF=link.exe > LINKIPF_FLAGS=Rpcrt4.lib bufferoverflowu.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib MartiniOSA.lib /nologo /dll /pdb:none /debug /machine:ia64 /out:"$(OUTDIR)\JPIAgent.dll" /implib:"$(OUTDIR)\JPIAgent.lib" /libpath:"..\bin\windows\debug\IPF" >@@ -126,6 +129,7 @@ > "$(INTDIR)\Options.obj" \ > "$(INTDIR)\Performance.obj" \ > "$(INTDIR)\Print.obj" \ >+ "$(INTDIR)\Profiler.obj" \ > "$(INTDIR)\PrintXML.obj" \ > "$(INTDIR)\utility.obj" > >@@ -224,6 +228,10 @@ > "$(INTDIR)\PrintXML.obj" : $(SOURCE) "$(INTDIR)" > $(CPP) $(CPP_PROJ) $(SOURCE) > >+SOURCE=..\src\JPIAgent\Profiler.cpp >+ >+"$(INTDIR)\Profiler.obj" : $(SOURCE) "$(INTDIR)" >+ $(CPP) $(CPP_PROJ) $(SOURCE) > > SOURCE=..\src\JPIAgent\utility.c > >Index: src-native/build/BuildJPIAgent32.dsp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/build/BuildJPIAgent32.dsp,v >retrieving revision 1.6 >diff -u -r1.6 BuildJPIAgent32.dsp >--- src-native/build/BuildJPIAgent32.dsp 23 Aug 2007 10:39:00 -0000 1.6 >+++ src-native/build/BuildJPIAgent32.dsp 6 Feb 2008 16:11:05 -0000 >@@ -43,7 +43,7 @@ > # PROP Ignore_Export_Lib 0 > # PROP Target_Dir "" > # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c >-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "./../include/Martini" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /D "EC_ENV_EXPORTS" /YX /FD /c >+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "./../include/Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "./../include/JPIAgent" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /D "EC_ENV_EXPORTS" /YX /FD /c > # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 > # ADD BASE RSC /l 0x409 /d "NDEBUG" >@@ -69,7 +69,7 @@ > # PROP Ignore_Export_Lib 0 > # PROP Target_Dir "" > # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c >-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "./../include/JPIAgent" /I "./../include/Martini" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /D "EC_ENV_EXPORTS" /YX /FD /GZ /c >+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "./../include/JPIAgent" /I "./../include/Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "IA32_ARCH" /D "ECWRAPPER_EXPORTS" /D "EC_ENV_EXPORTS" /YX /FD /GZ /c > # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 > # ADD BASE RSC /l 0x409 /d "_DEBUG" >@@ -125,6 +125,10 @@ > # End Source File > # Begin Source File > >+SOURCE=..\src\JPIAgent\Profiler.c >+# End Source File >+# Begin Source File >+ > SOURCE=..\src\JPIAgent\utility.c > # End Source File > # End Group >@@ -181,6 +185,10 @@ > # End Source File > # Begin Source File > >+SOURCE=..\src\JPIAgent\Profiler.h >+# End Source File >+# Begin Source File >+ > SOURCE=..\src\JPIAgent\strings.h > # End Source File > # Begin Source File >Index: src-native/src/ACCollector/ACCollector.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/ACCollector/ACCollector.cpp,v >retrieving revision 1.16 >diff -u -r1.16 ACCollector.cpp >--- src-native/src/ACCollector/ACCollector.cpp 24 Jan 2008 14:58:42 -0000 1.16 >+++ src-native/src/ACCollector/ACCollector.cpp 6 Feb 2008 16:11:05 -0000 >@@ -135,17 +135,15 @@ > } > > if (m_isEnabledDataCollection) { >- m_ACC_env->StartTracing(); > m_ACC_env->Attach(); > m_isWaiting = false; >- m_ACC_env->Start(); >+ m_ACC_env->StartTracing(); > m_isTracing = true; > } > else { > m_ACC_env->Attach(); > m_isWaiting = false; > m_isTracing = true; >- m_isFirstAfterStart = true; > } > // if (m_ACC_env->IsAgentInitialized()) { > // SendVMAgentInitializedCommand(); >@@ -163,7 +161,6 @@ > if (!isAgentInitialized(cmdBlock->getContextID())) { > return 0; > } >- m_ACC_env->Stop(); > m_ACC_env->Detach(); > m_ACC_env->StopTracing(); > m_isTracing = false; >@@ -178,17 +175,7 @@ > return 0; > } > >- >- if (m_isFirstAfterStart && !m_isEnabledDataCollection) { >- m_ACC_env->StartTracing(); >-// m_ACC_env->Start(); >- m_ACC_env->Resume(); >- m_isFirstAfterStart = false; >- } >- else { >- m_ACC_env->Resume(); >- } >- >+ m_ACC_env->StartTracing(); > > return BaseCollectorImpl::resume(cmdBlock); > } >@@ -203,7 +190,9 @@ > if (!isAgentInitialized(cmdBlock->getContextID())) { > return 0; > } >- m_ACC_env->Pause(); >+ >+ m_ACC_env->StopTracing(); >+ > return BaseCollectorImpl::pause(cmdBlock); > } > >Index: src-native/include/JPIAgent/ACC_Env.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/include/JPIAgent/ACC_Env.h,v >retrieving revision 1.9 >diff -u -r1.9 ACC_Env.h >--- src-native/include/JPIAgent/ACC_Env.h 24 Aug 2007 17:29:24 -0000 1.9 >+++ src-native/include/JPIAgent/ACC_Env.h 6 Feb 2008 16:11:05 -0000 >@@ -1,5 +1,5 @@ > /************************************************************************ >- * Copyright (c) 2005 - 2007 Intel Corporation. >+ * Copyright (c) 2005 - 2008 Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -38,10 +38,6 @@ > struct ACCFunctions_ { > void (ACC_CALL *StartTracing)(); > void (ACC_CALL *StopTracing)(); >- void (ACC_CALL *Start)(); >- void (ACC_CALL *Stop)(); >- void (ACC_CALL *Pause)(); >- void (ACC_CALL *Resume)(); > void (ACC_CALL *Detach)(); > void (ACC_CALL *Attach)(); > void (ACC_CALL *AddFilter)(char *iid, char *classPattern, char *methodPattern, char *filterMode);//strcmp("INCLUDE", mode) == 0 ? INCLUDE : EXCLUDE >@@ -66,22 +62,6 @@ > functions->StopTracing(); > } > >- void Start() { >- functions->Start(); >- } >- >- void Stop() { >- functions->Stop(); >- } >- >- void Pause() { >- functions->Pause(); >- } >- >- void Resume() { >- functions->Resume(); >- } >- > void Detach() { > functions->Detach(); > } >Index: src-native/src/JPIAgent/Profiler.c >=================================================================== >RCS file: src-native/src/JPIAgent/Profiler.c >diff -N src-native/src/JPIAgent/Profiler.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-native/src/JPIAgent/Profiler.c 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Intel Corporation. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * $Id: Profiler.c,v 1.0 2008/01/21 21:32:13 ialelekov Exp $ >+ ***********************************************************************/ >+ >+#include "Profiler.h" >+ >+extern void appStartTracing(); // defined in ECWrapper.cpp >+extern void appStopTracing(); >+extern int isProfilerApiEnabled(); >+extern int runGC(); >+extern void printCustomElement(const char* str); >+ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_initialize0 >+ (JNIEnv *env, jobject thisObj) { >+ >+ return isProfilerApiEnabled() ? 0 : -1; >+ } >+ >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: startProfiling0 >+ * Signature: ()I >+ */ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_startProfiling0 >+ (JNIEnv *env, jobject thisObj) { >+ >+ appStartTracing(); >+ >+ return 0; >+ } >+ >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: stopProfiling0 >+ * Signature: ()I >+ */ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_stopProfiling0 >+ (JNIEnv *env, jobject thisObj) { >+ >+ if (!isProfilerApiEnabled()) return -1; >+ >+ appStopTracing(); >+ >+ return 0; >+ } >+ >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: runGC0 >+ * Signature: ()I >+ */ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_runGC0 >+ (JNIEnv *env, jobject thisObj) { >+ >+ runGC(); >+ >+ return 0; >+ } >+ >+ JNIEXPORT void JNICALL Java_org_eclipse_tptp_profiler_Profiler_emitXMLFragment0 >+ (JNIEnv *env, jobject thisObj, jstring xmlFragment) { >+ >+ const char *native = (*env)->GetStringUTFChars(env, xmlFragment, NULL); >+ printCustomElement(native); >+ (*env)->ReleaseStringUTFChars(env, xmlFragment, native); >+ } >+ >Index: src/org/eclipse/tptp/profiler/Profiler.java >=================================================================== >RCS file: src/org/eclipse/tptp/profiler/Profiler.java >diff -N src/org/eclipse/tptp/profiler/Profiler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/profiler/Profiler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,145 @@ >+/************************************************************************ >+ * Copyright (c) 2008 Intel Corporation. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Intel Corporation - Initial API and implementation >+ * >+ * $Id: Profiler.java,v 1.0 2008/02/06 14:58:42 ialelekov Exp $ >+ ************************************************************************/ >+package org.eclipse.tptp.profiler; >+ >+/** >+ * Exposes an API for controlling the profiler. >+ * This class is a singleton and cannot be instantiated by the user. >+ * In order to access it an application must use {@link #getProfiler()}. >+ * >+ * @since TPTP 4.5 >+ */ >+ >+public class Profiler { >+ private final static String AGENT_NAME = "JPIAgent"; >+ private static Profiler instance = null; >+ private static boolean nativesAvailable = false; >+ >+ private boolean isProfiling = false; >+ private boolean isActive = false; >+ >+ static { >+ try { >+ System.loadLibrary(AGENT_NAME); >+ nativesAvailable = true; >+ } >+ catch(Throwable e) {} >+ } >+ >+ /** >+ * Native delegate to startup the profiler. Checks if profiling is possible. >+ */ >+ private native int initialize0(); >+ >+ private Profiler() { >+ isActive = initialize0() == 0; >+ } >+ >+ /** >+ * Returns the singleton Profiler's instance. >+ * >+ * @return Profiler >+ * @throws ProfilerAPINotAvailableException - If API is disabled >+ * @throws ProfilerNotAvailableException - If native library <code>JPIAgent</code> not found >+ */ >+ public static Profiler getProfiler() throws ProfilerNotAvailableException { >+ if (!nativesAvailable) throw new ProfilerNotAvailableException(); >+ >+ if (instance == null) instance = new Profiler(); >+ >+ if (!instance.isActive) throw new ProfilerAPINotAvailableException(); >+ >+ return instance; >+ } >+ >+ /** >+ * Native delegate of startProfiling(). >+ * @returns 0 - the profile session was created successfuly. >+ * >+ */ >+ private native int startProfiling0(); >+ >+ /** >+ * Starts data collection. >+ * >+ * @return <code>true</code> if data collection started; <code>false</code> otherwise >+ * @throws ProfilerAPINotAvailableException - If API is disabled >+ */ >+ public boolean startProfiling() throws ProfilerAPINotAvailableException { >+ if (!isActive) throw new ProfilerAPINotAvailableException(); >+ >+ synchronized(this) { >+ if (!isProfiling) { >+ isProfiling = startProfiling0() == 0; >+ } >+ } >+ >+ return isProfiling; >+ } >+ >+ /** >+ * Native delgate to stopProfiling. >+ */ >+ private native int stopProfiling0(); >+ >+ /** >+ * Stops data collection. >+ * >+ * @return <code>true</code> if data collection stopped; <code>false</code> otherwise >+ * @throws ProfilerAPINotAvailableException - If API is disabled >+ */ >+ public boolean stopProfiling() throws ProfilerAPINotAvailableException { >+ if (!isActive) throw new ProfilerAPINotAvailableException(); >+ >+ synchronized(this) { >+ if (isProfiling) { >+ isProfiling = !(stopProfiling0() == 0); >+ } >+ } >+ >+ return !isProfiling; >+ } >+ >+ /** >+ * Native delgate to runGC. >+ */ >+ private native int runGC0(); >+ >+ /** >+ * Runs the garbage collector. >+ * >+ * @throws ProfilerAPINotAvailableException - If API is disabled >+ */ >+ public void runGC() throws ProfilerAPINotAvailableException { >+ if (!isActive) throw new ProfilerAPINotAvailableException(); >+ >+ runGC0(); >+ } >+ >+ /** >+ * Native delgate to emitXMLFragment. >+ */ >+ private native void emitXMLFragment0(String xmlFragment); >+ >+ /** >+ * Saves the XML fragment to the output destination. >+ * >+ * @param xmlFragment - The XML fragment to save >+ * @throws ProfilerAPINotAvailableException - If API is disabled >+ */ >+ public void emitXMLFragment(String xmlFragment) throws ProfilerAPINotAvailableException { >+ if (!isActive) throw new ProfilerAPINotAvailableException(); >+ >+ emitXMLFragment0(xmlFragment); >+ } >+} >Index: src/org/eclipse/tptp/profiler/ProfilerNotAvailableException.java >=================================================================== >RCS file: src/org/eclipse/tptp/profiler/ProfilerNotAvailableException.java >diff -N src/org/eclipse/tptp/profiler/ProfilerNotAvailableException.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/profiler/ProfilerNotAvailableException.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,23 @@ >+/************************************************************************ >+ * Copyright (c) 2008 Intel Corporation. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Intel Corporation - Initial API and implementation >+ * >+ * $Id: ProfilerNotAvailableException.java,v 1.0 2008/02/06 14:58:42 ialelekov Exp $ >+ ************************************************************************/ >+package org.eclipse.tptp.profiler; >+ >+/** >+ * Thrown if required library <code>JPIAgent</code> can not be found. >+ * See the Profiler's documentation for details of the environment setting. >+ * >+ * @since TPTP 4.5 >+ */ >+public class ProfilerNotAvailableException extends Exception { >+ private static final long serialVersionUID = 1L; >+} >Index: src-native/src/JPIAgent/Profiler.h >=================================================================== >RCS file: src-native/src/JPIAgent/Profiler.h >diff -N src-native/src/JPIAgent/Profiler.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-native/src/JPIAgent/Profiler.h 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,63 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Intel Corporation. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * $Id: Profiler.h,v 1.0 2008/01/21 21:32:13 ialelekov Exp $ >+ ***********************************************************************/ >+ >+/* DO NOT EDIT THIS FILE - it is machine generated */ >+#include <jni.h> >+/* Header for class org_eclipse_tptp_platform_jvmti_runtime_profiler_Profiler */ >+ >+#ifndef _Included_org_eclipse_tptp_profiler_Profiler >+#define _Included_org_eclipse_tptp_profiler_Profiler >+#ifdef __cplusplus >+extern "C" { >+#endif >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: initialize0 >+ * Signature: ()I >+ */ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_initialize0 >+ (JNIEnv *, jobject); >+ >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: startProfiling0 >+ * Signature: ()I >+ */ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_startProfiling0 >+ (JNIEnv *, jobject); >+ >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: stopProfiling0 >+ * Signature: ()I >+ */ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_stopProfiling0 >+ (JNIEnv *, jobject); >+ >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: runGC0 >+ * Signature: ()I >+ */ >+JNIEXPORT jint JNICALL Java_org_eclipse_tptp_profiler_Profiler_runGC0 >+ (JNIEnv *, jobject); >+ >+/* >+ * Class: org_eclipse_tptp_profiler_Profiler >+ * Method: emitXMLFragment0 >+ * Signature: (Ljava/lang/String;)I >+ */ >+JNIEXPORT void JNICALL Java_org_eclipse_tptp_profiler_Profiler_emitXMLFragment0 >+ (JNIEnv *, jobject, jstring); >+ >+#ifdef __cplusplus >+} >+#endif >+#endif >Index: src/org/eclipse/tptp/profiler/ProfilerAPINotAvailableException.java >=================================================================== >RCS file: src/org/eclipse/tptp/profiler/ProfilerAPINotAvailableException.java >diff -N src/org/eclipse/tptp/profiler/ProfilerAPINotAvailableException.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/profiler/ProfilerAPINotAvailableException.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,23 @@ >+/************************************************************************ >+ * Copyright (c) 2008 Intel Corporation. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Intel Corporation - Initial API and implementation >+ * >+ * $Id: ProfilerAPINotAvailableException.java,v 1.0 2008/02/06 14:58:42 ialelekov Exp $ >+ ************************************************************************/ >+package org.eclipse.tptp.profiler; >+ >+/** >+ * Thrown when an application attempts to use disabled Profiler API. >+ * To enable API see the Profiler's documentation. >+ * >+ * @since TPTP 4.5 >+ */ >+public class ProfilerAPINotAvailableException extends ProfilerNotAvailableException { >+ private static final long serialVersionUID = 1L; >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 200251
:
81060
|
87048
|
87410
|
89022
|
89110