incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r773170 - in /incubator/kato/branches/experimental/PyJVMTI: ./ .project .pydevproject jvmti.py kato/Dump.py kato/JThread.py load.py run.sh
Date Sat, 09 May 2009 06:20:29 GMT
Author: spoole
Date: Sat May  9 06:20:28 2009
New Revision: 773170

URL: http://svn.apache.org/viewvc?rev=773170&view=rev
Log:
added save option to Dump in pyjvmti 

Added:
    incubator/kato/branches/experimental/PyJVMTI/.pydevproject
    incubator/kato/branches/experimental/PyJVMTI/jvmti.py   (with props)
    incubator/kato/branches/experimental/PyJVMTI/load.py   (with props)
Modified:
    incubator/kato/branches/experimental/PyJVMTI/   (props changed)
    incubator/kato/branches/experimental/PyJVMTI/.project
    incubator/kato/branches/experimental/PyJVMTI/kato/Dump.py
    incubator/kato/branches/experimental/PyJVMTI/kato/JThread.py
    incubator/kato/branches/experimental/PyJVMTI/run.sh

Propchange: incubator/kato/branches/experimental/PyJVMTI/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May  9 06:20:28 2009
@@ -0,0 +1 @@
+build

Modified: incubator/kato/branches/experimental/PyJVMTI/.project
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/PyJVMTI/.project?rev=773170&r1=773169&r2=773170&view=diff
==============================================================================
--- incubator/kato/branches/experimental/PyJVMTI/.project (original)
+++ incubator/kato/branches/experimental/PyJVMTI/.project Sat May  9 06:20:28 2009
@@ -5,7 +5,13 @@
 	<projects>
 	</projects>
 	<buildSpec>
+		<buildCommand>
+			<name>org.python.pydev.PyDevBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
+		<nature>org.python.pydev.pythonNature</nature>
 	</natures>
 </projectDescription>

Added: incubator/kato/branches/experimental/PyJVMTI/.pydevproject
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/PyJVMTI/.pydevproject?rev=773170&view=auto
==============================================================================
--- incubator/kato/branches/experimental/PyJVMTI/.pydevproject (added)
+++ incubator/kato/branches/experimental/PyJVMTI/.pydevproject Sat May  9 06:20:28 2009
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse-pydev version="1.0"?>
+
+<pydev_project>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
+</pydev_project>

Added: incubator/kato/branches/experimental/PyJVMTI/jvmti.py
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/PyJVMTI/jvmti.py?rev=773170&view=auto
==============================================================================
--- incubator/kato/branches/experimental/PyJVMTI/jvmti.py (added)
+++ incubator/kato/branches/experimental/PyJVMTI/jvmti.py Sat May  9 06:20:28 2009
@@ -0,0 +1 @@
+print "loaded jvmti"
\ No newline at end of file

Propchange: incubator/kato/branches/experimental/PyJVMTI/jvmti.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/kato/branches/experimental/PyJVMTI/kato/Dump.py
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/PyJVMTI/kato/Dump.py?rev=773170&r1=773169&r2=773170&view=diff
==============================================================================
--- incubator/kato/branches/experimental/PyJVMTI/kato/Dump.py (original)
+++ incubator/kato/branches/experimental/PyJVMTI/kato/Dump.py Sat May  9 06:20:28 2009
@@ -20,12 +20,22 @@
 '''
 import jvmti
 import kato.JThread as JThread
+import cPickle as pickle
 
 class Dump(object):
     '''
     classdocs
     '''
+    results=None
     
+    def __getstate__(self):
+       """Return state values to be pickled."""
+       return self.getThreads()
+       
+
+    def __setstate__(self, state):
+        """Restore state from the unpickled state values."""
+        self.results=state
 
     def __init__(selfparams):
         '''
@@ -37,14 +47,13 @@
         '''
         List Threads
         '''  
-        
-        results=[ ]
-        
-        for t in jvmti.getAllThreads() :
-            q=JThread.JThread(t)
-            results.append(q) 
+        if self.results==None:
+            self.results=[] 
+            for t in jvmti.getAllThreads() :
+                 q=JThread.JThread(t)
+                 self.results.append(q) 
             
-        return results
+        return self.results
     
     def properties(self):
         '''
@@ -64,5 +73,9 @@
             print k ,  jvmti.getThread(k)
     
         
+    def save(self):
         
-        
\ No newline at end of file
+            output=open("kato.dump","w")
+            pickle.dump(self,output)
+            output.close()
+            
\ No newline at end of file

Modified: incubator/kato/branches/experimental/PyJVMTI/kato/JThread.py
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/PyJVMTI/kato/JThread.py?rev=773170&r1=773169&r2=773170&view=diff
==============================================================================
--- incubator/kato/branches/experimental/PyJVMTI/kato/JThread.py (original)
+++ incubator/kato/branches/experimental/PyJVMTI/kato/JThread.py Sat May  9 06:20:28 2009
@@ -60,8 +60,17 @@
         if self.info[4]==None:
             return None
         
-        return JClassLoader(self.info[4])                         
-    
+        return JClassLoader(self.info[4])
+                             
+    def __getstate__(self):
+      """Return state values to be pickled."""
+      self.fill()
+      return self.info
+
+    def __setstate__(self, state):
+       """Restore state from the unpickled state values."""
+       self.info = state
+
     def __repr__(self):
         return "JThread id=%i name=%s" % (self.threadid , self.name)
         
\ No newline at end of file

Added: incubator/kato/branches/experimental/PyJVMTI/load.py
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/PyJVMTI/load.py?rev=773170&view=auto
==============================================================================
--- incubator/kato/branches/experimental/PyJVMTI/load.py (added)
+++ incubator/kato/branches/experimental/PyJVMTI/load.py Sat May  9 06:20:28 2009
@@ -0,0 +1,13 @@
+import kato.Dump as Dump
+import pickle
+
+f=open('kato.dump','r')
+
+d=pickle.load(f)
+
+f.close()
+
+print d
+print "loaded"
+print d.getThreads()
+

Propchange: incubator/kato/branches/experimental/PyJVMTI/load.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/kato/branches/experimental/PyJVMTI/run.sh
URL: http://svn.apache.org/viewvc/incubator/kato/branches/experimental/PyJVMTI/run.sh?rev=773170&r1=773169&r2=773170&view=diff
==============================================================================
--- incubator/kato/branches/experimental/PyJVMTI/run.sh (original)
+++ incubator/kato/branches/experimental/PyJVMTI/run.sh Sat May  9 06:20:28 2009
@@ -1,5 +1,5 @@
 export LD_PRELOAD=/usr/lib/python2.6/config/libpython2.6.so
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./build/lib.linux-i686-2.6:/usr/lib/python2.6:/usr/lib/python2.6/config
-export PYTHONSTARTUP=./build/lib.linux-i686-2.6/kato/Dump.py
+#export PYTHONSTARTUP=./build/lib.linux-i686-2.6/kato/Dump.py
 export PYTHONPATH=$PYTHONPATH:.
 /home/spoole/javasdks/sun/jdk1.6.0_12/bin/java  -agentlib:pyjvmti  -cp .  kato.PauseJVM



Mime
View raw message