incubator-kato-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Poole <spoole...@googlemail.com>
Subject Pure Java Dump concept
Date Mon, 04 Jan 2010 12:10:39 GMT
Over the holidays I've been working on a prototype of a 100% Java dump
generator and reader.   I wanted to have an easy way
for us to explore the Snapshot API concept.

The idea is that by doing this in Java it will be much easier for us to
prototype (rather than doing this in C) and for others to use immediately.

My prototype consists of code that utilises the xstream  project (
http://xstream.codehaus.org)  as a quick means of serialising and
deserialising a bunch of java objects.  XStream serialises to XML. Its human
readable and Xstream also deals with object references so that you get back
a properly formed graph of objects.

I added in  info from the JMX beans etc and that gave me something like that
included below  (this is a flavor rather than a full  dump)  A lot of the
data comes for free just by telling Xstream to serialise an object - but in
some cases to remove the implementation specific nature of serialisation I
created a neutral version that was serialised instead.

As you can see this is easy to read and is not as fragile as normal
serialisation.   At the bottom of the example is a <datahanger> tag which is
where I've added a trivial serialisation of a JavaRuntime from the CJVMTI
project.    The reader side just deserialises the model and its ready for
use.

With this sort of approach we can focus on discussing and prototyping the
Snapshot API -  how we determine what information goes into the model and
how its described.

Comments?



<org.apache.kato.jdump.JDump id="1">
  <header id="2">
    <date id="3">2010-01-04 11:45:29.718 GMT</date>
  </header>
  <os id="4">
    <arch>x86</arch>
    <availableProcessors>2</availableProcessors>
    <name>Linux</name>
    <systemLoadAverage>0.22</systemLoadAverage>
    <version>2.6.31-16-generic</version>
  </os>
  <runtime id="5">
    <bootClassPath id="6">
      <string>/usr/lib/j2sdk1.6-ibm/jre/lib/vm.jar</string>
      <string>/usr/lib/j2sdk1.6-ibm/jre/lib/javascript.jar</string>
    </bootClassPath>
    <classPath id="7">
      <string>/home/spoole/workspace/code/target/classes</string>
    </classPath>
    <inputArguments id="8">
      <string>-Xdump</string>
      <string>-Djava.class.path=.</string>
      <string>-Dfile.encoding=UTF-8</string>
    </inputArguments>
    <LibraryPath id="9">
      <string>/usr/lib</string>
    </LibraryPath>
    <managementSpecVersion>1.0</managementSpecVersion>
    <name>6728@jazzette</name>
    <specName>Java Virtual Machine Specification</specName>
    <specVendor>Sun Microsystems Inc.</specVendor>
    <specVersion>1.0</specVersion>
    <startTime>1262605529447</startTime>
    <systemProperties id="10">
      <entry>
        <string>file.encoding</string>
        <string>UTF-8</string>
      </entry>
      <entry>
        <string>user.home</string>
        <string>/home/spoole</string>
      </entry>
    </systemProperties>
    <uptime>341</uptime>
    <vmName>IBM J9 VM</vmName>
    <vmVendor>IBM Corporation</vmVendor>
    <vmVersion>2.4</vmVersion>
    <bootClassPathSupported>true</bootClassPathSupported>
    <envvars class="tree-map" id="11">
      <no-comparator/>
       <entry>
        <string>DISPLAY</string>
        <string>:0.0</string>
      </entry>
    </envvars>
  </runtime>
  <threads id="12">
    <peakThreadCount>6</peakThreadCount>
    <threadCount>5</threadCount>
    <daemonthreadCount>4</daemonthreadCount>
    <currentThreadUserTime>297018627</currentThreadUserTime>
    <currentThreadCpuTime>296990135</currentThreadCpuTime>
    <threads id="13">
      <threadinfo id="14">
        <threadId>1</threadId>
        <threadName>main</threadName>
        <threadState>RUNNABLE</threadState>
        <suspended>false</suspended>
        <inNative>true</inNative>
        <blockedCount>0</blockedCount>
        <blockedTime>-1</blockedTime>
        <waitedCount>0</waitedCount>
        <waitedTime>-1</waitedTime>
        <lockOwnerId>-1</lockOwnerId>
        <stackTraces id="15">
          <trace
id="16">com.ibm.lang.management.ThreadMXBeanImpl.dumpAllThreadsImpl(Native
Method)</trace>
          <trace
id="17">com.ibm.lang.management.ThreadMXBeanImpl.dumpAllThreads(ThreadMXBeanImpl.java:680)</trace>
          <trace
id="18">org.apache.kato.jdump.builder.ThreadTemplateBuilder.buildTemplate(ThreadTemplateBuilder.java:20)</trace>
          <trace
id="19">org.apache.kato.jdump.builder.ThreadTemplateBuilder.buildTemplate(ThreadTemplateBuilder.java:25)</trace>
          <trace
id="20">org.apache.kato.jdump.builder.DumpBuilder.buildDump(DumpBuilder.java:15)</trace>
          <trace
id="21">org.apache.kato.jdump.CreateDump.main(CreateDump.java:25)</trace>
        </stackTraces>
        <lockedSynchronizers id="22"/>
        <lockedMonitors id="23"/>
      </threadinfo>
      <threadinfo id="24">
        <threadId>9</threadId>
        <threadName>JIT Compilation Thread</threadName>
        <threadState>RUNNABLE</threadState>
        <suspended>false</suspended>
        <inNative>false</inNative>
        <blockedCount>0</blockedCount>
        <blockedTime>-1</blockedTime>
        <waitedCount>0</waitedCount>
        <waitedTime>-1</waitedTime>
        <lockOwnerId>-1</lockOwnerId>
        <stackTraces id="25"/>
        <lockedSynchronizers id="26"/>
        <lockedMonitors id="27"/>
      </threadinfo>
   </threads>
  </threads>
  <gcinfo id="46">
    <gc id="47">
      <collectionCount>0</collectionCount>
      <collectionTime>0</collectionTime>
      <memoryPoolNames id="48">
        <string>Java heap</string>
      </memoryPoolNames>
      <name>J9 GC</name>
      <valid>true</valid>
    </gc>
  </gcinfo>
  <classinfo id="49">
    <loadedClassCount>609</loadedClassCount>
    <totalLoadedClassCount>609</totalLoadedClassCount>
    <unloadedClassCount>0</unloadedClassCount>
  </classinfo>
  <compilerinfo id="50">
    <name>j9jit24</name>
    <totalCompilationTime>298</totalCompilationTime>

<isCompilationTimeMonitoringSupported>true</isCompilationTimeMonitoringSupported>
  </compilerinfo>
  <dataHanger id="51">
    <runtime id="52">
      <model id="53">
        <threadMap id="54">
          <map id="55">
            <entry>
              <long>1</long>
              <org.apache.kato.jvmti.javaruntime.model.JThread id="56">
                <id>1</id>
                <priority>5</priority>
                <daemon>0</daemon>
                <groupID>0</groupID>
                <threadName>main</threadName>
                <state>0</state>
                <frames class="linked-list" id="57"/>
              </org.apache.kato.jvmti.javaruntime.model.JThread>
            </entry>
          </map>
          <list id="58">
            <org.apache.kato.jvmti.javaruntime.model.JThread
reference="56"/>
          </list>
        </threadMap>
        <classMap id="59"/>
        <loadersMap id="60">
          <map id="61"/>
          <list id="62"/>
        </loadersMap>
        <monitorsMap id="63">
          <map id="64"/>
          <list id="65"/>
        </monitorsMap>
        <methodMap id="66">
          <map id="67"/>
          <list id="68"/>
        </methodMap>
        <objectMap id="69">
          <map id="70"/>
          <list id="71"/>
        </objectMap>
        <systemClassLoader id="72">
          <cachedClasses class="linked-list" id="73"/>
        </systemClassLoader>
      </model>
    </runtime>
  </dataHanger>
</org.apache.kato.jdump.JDump>


-- 
Steve

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message