Revision: 2968
          http://vexi.svn.sourceforge.net/vexi/?rev=2968&view=rev
Author:   mkpg2
Date:     2008-07-18 09:55:00 +0000 (Fri, 18 Jul 2008)

Log Message:
-----------
Improved output from memory instrumentation.

Modified Paths:
--------------
    trunk/core/org.vexi.devl/src/org/vexi/instrument/memory/Memory.java

Modified: trunk/core/org.vexi.devl/src/org/vexi/instrument/memory/Memory.java
===================================================================
--- trunk/core/org.vexi.devl/src/org/vexi/instrument/memory/Memory.java 
2008-07-18 02:46:34 UTC (rev 2967)
+++ trunk/core/org.vexi.devl/src/org/vexi/instrument/memory/Memory.java 
2008-07-18 09:55:00 UTC (rev 2968)
@@ -14,7 +14,13 @@
 // FIXME - move devl js implementation out of here
 public class Memory extends JS.Immutable implements Instr.Memory {
        
-       static JS MARKER = new JS.Obj();
+       static int counter = 0;
+       
+       static class Marker extends JS.Obj{ 
+               final int id = counter++;
+               public void finalize(){ Log.uWarn(Memory.class, "*** 
MARKER("+id+" finalized ***"); }
+       }
+       static Marker MARKER = new Marker();
        static Reference MARKER_REF;
        
        public Memory() {
@@ -28,29 +34,32 @@
                if("MARKER".equals(key)){
                        if(MARKER == null) 
                                return null;
-                       JS r = MARKER;
+                       Marker r = MARKER;
                        MARKER_REF = new SoftReference(MARKER);
                        MARKER = null;
+                       Log.uWarn(Memory.class, "*** MARKER("+r.id+") set ***");
                        return r;
                }
                return null;
        }
 
        public void assertCollection(){
-               if(MARKER != null) Log.warn(Memory.class, "Marker has not been 
set yet");
+               if(MARKER != null) Log.uWarn(Memory.class, "MARKER has not been 
set yet");
                else{
                        try{
                                GCUtil.assertGC("MARKER not collected", 
MARKER_REF);
                        }finally{
-                               MARKER = new JS.Obj();
+                               MARKER = new Marker();
                        }
                }
        }
        
-       static private Integer ZERO = new Integer(0);
        public void dumpStacks(){
 
-               System.err.println("Object creation dump");
+               System.err.println();
+               System.err.println("*** Object creation report");
+               System.err.println("Unique stacks:" + stackToCount.size());
+               System.err.println("Top 15");
                List l = new ArrayList(stackToCount.keySet());
                Collections.sort(l, new Comparator(){
                        public int compare(Object sa, Object sb) {
@@ -185,10 +194,18 @@
                                }
                        });
                        
+                       JButton button5 = new JButton("Reset MARKER");
+                       button5.addActionListener(new ActionListener(){
+                               public void actionPerformed(ActionEvent e) {
+                                       MARKER=new Marker();
+                               }
+                       });
+                       
                        frame.add(button1);
                        frame.add(button2);
                        frame.add(button3);
                        frame.add(button4);
+                       frame.add(button5);
                        frame.setSize(100,200);
                        frame.setVisible(true);
                }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to