[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.hyades] Re: api for parsing trcxml file

Hi,

Some other questions:


How to get informations about threads, GC cpu time, GC/FullGC invocation count ... and other vm system info through the emf model?


In TRCFullMethodInvocation class the method getCPUTime returns 0, I suppose there is a flag in piAgent to set. Is correct? You know which one?

thanks,

Luca

Marius Slavescu wrote:
Hi Luca,

Please try the attached standalone trace model test.

Import in your workspace ModelTests project,
org.eclipse.hyades.models.hierarchy and org.eclipse.hyades.models.trace,
modify WORKSPACE_PATH and FILE_SEPARATOR then run it. Place myTrace.trcxml
in your / folder or C: drive.

To check if the model was created correctly just pass one argument: "-load"
to the program.

If you want to run it outside Eclipse then you need to add all the required
runtime JARs (from required plugins: hierarchy, trace, emf, etc and the
plugin.xml files from hierarchy and trace) to the classpath.

Please let me know if you need more info.

Thanks,
Marius

"Luca Di Stefano" <luca.distefano@xxxxxxxxxxxxxxxxxx> wrote in message
news:cmfsrr$81k$1@xxxxxxxxxxxxxx

Hi Marius,

thanks for your hint!

I have copied the code you suggested and removed any reference to ui.
In my class remains only the run importFile and loadLine methods.
There are some problems

using
       //create destination container
        IContainer res = PDCoreUtil.createContainer(new
Path("/phxrepository/eclipse-workspace/ProfileProject/"));

//        //create monitor
        fMonitor = PDCoreUtil.createMonitor(res, "DefaultMonitor");
seems to have dependency with workbench and ui.plugin

replacing them with
        HierarchyPackageImpl.init();
        HierarchyResourceSetImpl set =
HierarchyResourceSetImpl.getInstance();
        HierarchyFactory factory = new HierarchyFactoryImpl();

        fMonitor = factory.createTRCMonitor();
        fMonitor.setName("DefaultMonitor");

I get
Thread[main,5,main] - org.xml.sax.SAXParseException: The markup in the
document preceding the root element must be well-formed.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at


org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unkn own

Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at


com.wuerth.phoenix.profile.hyades.SAXFragmentHandler.parse(SAXFragmentHandle r.java:265)

at


com.wuerth.phoenix.profile.hyades.SAXFragmentHandler$1.run(SAXFragmentHandle r.java:74)


replacing the function importFile() with the following private void importFileSimple(XMLLoader processor, InputStream readStream) { BufferedReader reader = new BufferedReader(new InputStreamReader(readStream)); try { while (true) { String line = reader.readLine(); if (line == null) break; System.out.println("LINE: " + line); processor.loadEvent(line.getBytes(), line.length(),

true);

            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                reader.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            processor.cleanUp();
        }
    }

parsing is going well but Hierarchy seems to be empty:
context.getAgent() == null
context.getGlobalForwardReferences().size()==0

I tried to add System.setProperty("XMLLoader.debug", "true") to see what
is going wrong
 but in XMLLoader.writeToTextOutputFile the log filename is hardcoded
String fileName = "c:/log_" + (new java.util.Date()).getTime() + ".xml";
and on a linux box not works.

Sorry for the confusion.. :-)

thanks,

Luca



Marius Slavescu wrote:

Hi Luca,

The parsing/loading of trcxml file is done at import profiling file time
using the event (fragment) loader infrastructure. The resulting model is

the

EMF based Hyades model (in this case Hierarchy/Trace package are used,

see

http://dev.eclipse.org/viewcvs/indextools.cgi/~checkout~/hyades-home/docs/components/data_models/data_models.html).

The loader infrastructure is:
   - in org.eclipse.hyades.models.hierarchy plugin
       - XMLLoader is the controller (parses the fragments, discovers

and

employs the loaders), after initialization loadEvent methods are called

with

each event, the same approach is used in both live or off-line

scenarios.

- other services required in the loading process are available

in

this plugin
   - in each model plugin there are loaders registered for specific

events,

for example in the org.eclipse.hyades.models.trace plugin you'll find

all

the loaders for events found in trcxml files.

To name of the loaders follows this pattern:
XMLfragmentRootElementNameLoader where fragmentRootElementName is the

root

element name in the fragment (usually the fragment has only one

element).

In Hyades workbench you could use the Import->Profiling File wizard to
import the trace files in workspaces then in your own plugin you can
manipulate/view the persisted Trace models (resulted from import).

If you want to have this function in headless mode then you'll need to

write

the import code (look at
org.eclipse.hyades.trace.ui.internal.wizard.ImportTracePage1.run method)
then you could build the graphs that you need on top of the resulting

Trace

model.

Please let me know if you need more info.

Thanks,
Marius

"Luca Di Stefano" <luca.distefano@xxxxxxxxxxxxxxxxxx> wrote in message
news:clqsfl$v5e$1@xxxxxxxxxxxxxx


Hi,

I need to parse several trcxm files to join the data and build some

graphs.


There are hyades API for parse trcxm files and get the data?

Thanks,

Luca







----------------------------------------------------------------------------
----



<?xml version="1.0"?>
<TRACE>
<node nodeId="" hostname="phxl0007" ipaddress="127.0.0.1,127.0.0.1"

timezone="-60" time="1099651312.827835083"/>

<processCreate processId="" pid="14906" nodeIdRef=""

time="1099651312.827835083"/>

<agentCreate agentId="UUID-1099651312-872530-997682102-1023616539"

version="1.000" processIdRef="" agentName="Java Profiling Agent" agentType="Profiler" agentParameters="server=standalone,filters=config/myfilters.txt,file=mytest. trcxml,profile=config/jvmpi.pro" time="1099651312.827835083"/>

<traceStart traceId="UUID-1099651312-896434-296081298-987511110"

agentIdRef="UUID-1099651312-872530-997682102-1023616539" time="1099651312.896468400"/>

<filter pattern="#profile" mode="INCLUDE" genericPattern="SUFFIX"

methodPattern="setUp" methodMode="EXCLUDE" methodGenericPattern="NONE"/>

<filter pattern="#profile" mode="INCLUDE" genericPattern="SUFFIX"

methodPattern="tearDown" methodMode="EXCLUDE" methodGenericPattern="NONE"/>

<filter pattern="profile" mode="INCLUDE" genericPattern="SUFFIX"

methodPattern="test" methodMode="INCLUDE" methodGenericPattern="SUFFIX"/>

<filter pattern="" mode="EXCLUDE" genericPattern="PREFIX" methodPattern=""

methodMode="EXCLUDE" methodGenericPattern="PREFIX"/>

<option key="CLASS_LOAD_DETAILS" value="false"/>
<option key="METHOD_DETAILS" value="false"/>
<option key="COLLATION_VALUES" value="false"/>
<option key="CONTEXT_FLOW" value="false"/>
<option key="FILTERS" value="true"/>
<option key="TRACK_GC_EVENT_TYPES" value="none"/>
<option key="ID_STYLE" value="static"/>
<option key="OBJ_REF_MODE" value="filterOwner"/>
<option key="METHOD_COUNTS" value="true"/>
<option key="OBJ_ALLOC_IS_ARRAY" value="true"/>
<option key="OPTIONS" value="true"/>
<option key="STACK_INFORMATION" value="normal"/>
<option key="TRACE_MODE" value="full"/>
<option key="TICKET" value="true"/>
<option key="TIMESTAMPS" value="true"/>
<option key="TRACE_IDREFS" value="false"/>
<option key="UNREFERENCED_SYMBOLS" value="false"/>
<option key="THREAD_CPU_TIME" value="false"/>
<option key="LLDATA_ENABLED" value="false"/>
<option key="HEAP_INFO_FILE_PREFIX" value="optHeap"/>
<option key="MONITOR_MODE" value="none"/>
<option key="EXTENSION_LIBRARY" value=""/>
<threadStart threadId="2" time="1099651312.904853343" threadName="main"

groupName="main" parentName="system" objIdRef="0"/>

<runtimeInitDone threadIdRef="2" time="1099651312.944803237"/>
<classDef threadIdRef="4" name="java.lang.Class" sourceName="Class.java"

classId="124" time="1099651312.912096500"/>

<objAlloc threadIdRef="4" time="1099651312.945412874" objId="617"

classIdRef="124" isArray="0" size="88"/>

<classDef threadIdRef="4" name="java.lang.Thread" sourceName="Thread.java"

classId="616" objIdRef="617" time="1099651312.934934854"/>

<objAlloc threadIdRef="4" time="1099651312.945412397" objId="3658"

classIdRef="616" isArray="0" size="96"/>

<threadStart threadId="4" time="1099651312.945411205" threadName="Signal

Dispatcher" groupName="system" parentName="" objIdRef="3658"/>

<objAlloc threadIdRef="5" time="1099651313.502094030" objId="9440"

classIdRef="124" isArray="0" size="88"/>

<classDef threadIdRef="5"

name="org.eclipse.jdt.internal.junit.runner.RemoteTestRunner$ReaderThread" sourceName="RemoteTestRunner.java" classId="9439" objIdRef="9440" time="1099651313.496024847"/>

<objAlloc threadIdRef="5" time="1099651313.502093315" objId="9441"

classIdRef="9439" isArray="0" size="96"/>

<threadStart threadId="5" time="1099651313.502091884"

threadName="ReaderThread" groupName="main" parentName="system" objIdRef="9441"/>

<objAlloc threadIdRef="2" time="1099651315.600643634" objId="9708"

classIdRef="124" isArray="0" size="88"/>

<classDef threadIdRef="2" name="profile.test.MyTest"

sourceName="MyTest.java" classId="9843" objIdRef="9708" time="1099651313.559551715"/>

<methodDef name="test1" signature="()V" startLineNumber="45"

endLineNumber="46" methodId="9838" classIdRef="9843"/>

<objAlloc threadIdRef="2" time="1099651315.600725889" objId="9844"

classIdRef="9843" isArray="0" size="16"/>

<methodEntry threadIdRef="2" time="1099651315.600641727"

methodIdRef="9838" objIdRef="9844" classIdRef="9843" ticket="171027" stackDepth="16"/>

<methodExit threadIdRef="2" methodIdRef="9838" objIdRef="9844"

classIdRef="9843" ticket="171027" time="1099651317.602828502" overhead="0.000169382"/>

<methodDef name="test2" signature="()V" startLineNumber="48"

endLineNumber="49" methodId="9837" classIdRef="9843"/>

<objAlloc threadIdRef="2" time="1099651317.604080438" objId="9902"

classIdRef="9843" isArray="0" size="16"/>

<methodEntry threadIdRef="2" time="1099651317.604057073"

methodIdRef="9837" objIdRef="9902" classIdRef="9843" ticket="171441" stackDepth="16"/>

<methodExit threadIdRef="2" methodIdRef="9837" objIdRef="9902"

classIdRef="9843" ticket="171441" time="1099651317.604611873" overhead="0.000056719"/>

<threadEnd threadIdRef="5" time="1099651317.606651782"/>
<threadEnd threadIdRef="2" time="1099651317.636883735"/>
<runtimeShutdown threadIdRef="1" time="1099651317.636932611"/>
<traceEnd time="1099651317.638990163"/>
<agentDestroy agentIdRef="UUID-1099651312-872530-997682102-1023616539"

time="1099651317.639014959"/>

</TRACE>