[jboss-cvs] JBoss Profiler SVN: r483 - in branches/JBossProfiler2: src/main/org/jboss/profiler/agent and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 20 16:58:24 EDT 2008


Author: jesper.pedersen
Date: 2008-10-20 16:58:24 -0400 (Mon, 20 Oct 2008)
New Revision: 483

Modified:
   branches/JBossProfiler2/doc/README.txt
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java
   branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java
Log:
Reverting to rev481

Modified: branches/JBossProfiler2/doc/README.txt
===================================================================
--- branches/JBossProfiler2/doc/README.txt	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/doc/README.txt	2008-10-20 20:58:24 UTC (rev 483)
@@ -76,7 +76,6 @@
        diff           : Compare snapshots
        add            : Add classes (public|package|protected|private)
        remove         : Remove classes
-       list           : List classes
 
 Host defaults to 'localhost'.
 Port defaults to '5400'.
@@ -101,8 +100,8 @@
 Client diff oldsnapshot.jps newsnapshot.jps
 Client add org.jboss.profiler.test.* public
 Client remove org.jboss.profiler.test.*
-Client list
 
+
 jboss-profiler.properties:
 --------------------------
 enable                  Enable / disable profiler

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/AbstractTransformer.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -50,7 +50,7 @@
                           byte[] classfileBuffer) throws IllegalClassFormatException {
 
     byte[] result = null;
-
+    
     if (Agent.isEnabled() && Agent.accept(className)) {
       try {
         if (Agent.isRepository() && !ClassRepository.exists(className, loader)) {

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -755,26 +755,6 @@
   }
     
   /**
-   * List classes
-   * @return The classes
-   */
-  public static String[] listClasses() {
-    String[] result = new String[includeList.size()];
-    for (int i = 0; i < includeList.size(); i++) {
-      String s = includeList.get(i);
-
-      if (s.endsWith("/")) {
-        s = s.substring(0, s.length() - 1) + ".*";
-      }
-
-      s = s.replace('/', '.');
-
-      result[i] = s;
-    }
-    return result;
-  }
-
-  /**
    * Redefine
    * @param clz The classes
    * @param instrument Should the classes be instrumented ?

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/JavassistTransformer.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -32,9 +32,6 @@
 import javassist.CtConstructor;
 import javassist.CtMethod;
 import javassist.Modifier;
-import javassist.CodeConverter;
-import javassist.expr.ExprEditor;
-import javassist.expr.MethodCall;
 
 /**
  * Implements the Javssist based transformer
@@ -50,8 +47,6 @@
    */
   public JavassistTransformer() {
     pool = ClassPool.getDefault();
-
-    setup();
   }
 
   /**
@@ -189,53 +184,4 @@
       java.lang.Thread#yield()
     */
   }
-
-  /**
-   *
-   */
-  private void setup() {
-    try {
-      CtClass cProfiler = pool.get("org.jboss.profiler.agent.Profiler");
-      CtMethod mBeginWait = cProfiler.getDeclaredMethod("beginWait");
-      CtMethod mEndWait = cProfiler.getDeclaredMethod("endWait");
-
-      CtClass cThread = pool.get("java.lang.Thread");
-      CtMethod mSleep1 = cThread.getDeclaredMethod("sleep", new CtClass[] { CtClass.longType });
-      CtMethod mSleep2 = cThread.getDeclaredMethod("sleep", new CtClass[] { CtClass.longType, CtClass.intType });
-
-      CodeConverter codeConverter = new CodeConverter();
-
-      codeConverter.insertBeforeMethod(mSleep1, mBeginWait);
-      codeConverter.insertAfterMethod(mSleep1, mEndWait);
-
-      /*
-      codeConverter.insertBeforeMethod(mSleep2, mBeginWait);
-      codeConverter.insertAfterMethod(mSleep2, mEndWait);
-      */
-
-      cThread.instrument(codeConverter);
-
-
-      /*
-      method.instrument(new ExprEditor() {
-          public void edit(MethodCall m) throws CannotCompileException {
-            org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread()).beginWait();
-
-            org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread()).endWait();
-          }
-        });
-      */
-      /*
-      method.insertBefore("{ " +
-                          "org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread()).beginWait();" +
-                          " }");
-      
-      method.insertAfter("{ " +
-                         "org.jboss.profiler.agent.Profiler.getProfilerThread(Thread.currentThread()).endWait();" +
-                         " }", true);
-      */
-    } catch(Exception e) {
-      e.printStackTrace(System.err);
-    }
-  }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -317,22 +317,6 @@
   }
 
   /**
-   * Register start wait time for a method
-   */
-  public static void beginWait(Thread t, long l) {
-    System.out.print("BeginWait called");
-    getProfilerThread(Thread.currentThread()).beginWait();
-  }
-  
-  /**
-   * Register end wait time for a method
-   */
-  public static void endWait(Thread t, long l) {
-    System.out.print("EndWait called");
-    getProfilerThread(Thread.currentThread()).endWait();
-  }
-
-  /**
    * Get the root directory
    * @return The root directory
    */

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThread.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -43,13 +43,17 @@
   
   /**
    * Register start wait time for a method
+   * @param className The class name
+   * @param methodName The method name
    */
-  public void beginWait();
+  public void beginWait(String className, String methodName);
   
   /**
    * Register end wait time for a method
+   * @param className The class name
+   * @param methodName The method name
    */
-  public void endWait();
+  public void endWait(String className, String methodName);
   
   /**
    * Class allocation

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -175,13 +175,15 @@
   
   /**
    * Register start wait time for a method
+   * @param className The class name
+   * @param methodName The method name
    */
-  public void beginWait() {
+  public void beginWait(String className, String methodName) {
     if (!Agent.isEnabled() || !Agent.isCPU() || !Profiler.isRunning()) {
       return;
     }
 
-    FrameInfo fi = activeFrame;
+    FrameInfo fi = findFrame(className, methodName);
       
     if (fi == null) {
       return;
@@ -192,15 +194,17 @@
   
   /**
    * Register end wait time for a method
+   * @param className The class name
+   * @param methodName The method name
    */
-  public void endWait() {
+  public void endWait(String className, String methodName) {
     long start = System.nanoTime();
     
     if (!Agent.isEnabled() || !Agent.isCPU() || !Profiler.isRunning()) {
       return;
     }
 
-    FrameInfo fi = activeFrame;
+    FrameInfo fi = findFrame(className, methodName);
       
     if (fi == null) {
       return;

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/SnapshotUtil.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -632,7 +632,7 @@
     DecimalFormat df = new DecimalFormat("#0.00");
     
     bw.write("Total time: " + df.format(tci.getTotalTime()) + " ms" + NEW_LINE);
-    bw.write(" Wait time: " + df.format(tci.getWaitTime()) + " ms" + NEW_LINE);
+    //bw.write(" Wait time: " + df.format(tci.getWaitTime()) + " ms" + NEW_LINE);
 
     if (allocs != null && allocs.size() > 0) {
       long alloc = 0;

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -73,7 +73,6 @@
     System.out.println("       diff           : Difference between snapshots");
     System.out.println("       add            : Add classes (repository must be enabled)");
     System.out.println("       remove         : Remove classes (repository must be enabled)");
-    System.out.println("       list           : List classes");
   }
 
   /**
@@ -232,8 +231,6 @@
             cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] { args[i] } );
             i++;
           }
-        } else if (cmdStr.equalsIgnoreCase("list")) {
-          cmd = new Command(CommandType.LIST_CLASSES);
         } else {
           usage();
           return;
@@ -263,8 +260,7 @@
               SnapshotUtil su = new SnapshotUtil(threshold);
               su.dump(snapshot, f);
             }
-          } else if (cmd.getCommand() == CommandType.LIST_SNAPSHOTS ||
-                     cmd.getCommand() == CommandType.LIST_CLASSES) {
+          } else if (cmd.getCommand() == CommandType.LIST_SNAPSHOTS) {
             String[] result = (String[])remotingClient.invoke(cmd);
             if (result != null) {
               for (int j = 0; j < result.length; j++) {

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/connectors/AbstractHandler.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -69,8 +69,6 @@
       Agent.addClasses((String)cmd.getArguments()[0], (Visibility)cmd.getArguments()[1]);
     } else if (cmd.getCommand() == CommandType.REMOVE_CLASSES && Agent.isRepository()) {
       Agent.removeClasses((String)cmd.getArguments()[0]);
-    } else if (cmd.getCommand() == CommandType.LIST_CLASSES) {
-      return Agent.listClasses();
     }
     return "";
   }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/CommandType.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -95,10 +95,5 @@
   /**
    * Remove classes
    */
-  REMOVE_CLASSES,
-
-  /**
-   * List classes
-   */
-  LIST_CLASSES
+  REMOVE_CLASSES
 }

Modified: branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java
===================================================================
--- branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java	2008-10-20 20:50:52 UTC (rev 482)
+++ branches/JBossProfiler2/src/test/java/org/jboss/profiler/test/Test.java	2008-10-20 20:58:24 UTC (rev 483)
@@ -104,10 +104,6 @@
    * Method: F
    */
   void f() {
-    try {
-      Thread.sleep(100L);
-    } catch (Exception e) {
-    }
   }
  
   /**




More information about the jboss-cvs-commits mailing list