[jboss-cvs] JBoss Profiler SVN: r463 - in branches/JBossProfiler2: lib and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Aug 16 04:18:42 EDT 2008
Author: jesper.pedersen
Date: 2008-08-16 04:18:42 -0400 (Sat, 16 Aug 2008)
New Revision: 463
Removed:
branches/JBossProfiler2/doc/asm.txt
branches/JBossProfiler2/lib/asm.jar
branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledClass.java
branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledMethod.java
branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMTransformer.java
Modified:
branches/JBossProfiler2/doc/README.txt
branches/JBossProfiler2/src/etc/jboss-profiler.properties
branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
Log:
Remove support for ASM - it is too slow compared with Javassist
Modified: branches/JBossProfiler2/doc/README.txt
===================================================================
--- branches/JBossProfiler2/doc/README.txt 2008-08-16 08:13:41 UTC (rev 462)
+++ branches/JBossProfiler2/doc/README.txt 2008-08-16 08:18:42 UTC (rev 463)
@@ -104,9 +104,6 @@
jboss-profiler.properties:
--------------------------
-core Specify the core framework to use
- [javassist|asm] default: javassist
-
enable Enable / disable profiler
[yes|no] default: yes
@@ -249,8 +246,6 @@
Core libraries:
---------------
-The ASM library should be placed in jbossas/bin.
-
The Javassist library should only be copied to jbossas/bin when running the profiler in
JBoss Application Server 4.2 release series.
@@ -354,7 +349,6 @@
----------------------
The following libraries are needed
- x asm.jar (ASM 3.1)
x concurrent.jar (Oswego Concurrent)
x ejb3-persistence.jar (EJB3 Persistence API (test))
x javassist.jar (Javassist 3.7)
Deleted: branches/JBossProfiler2/doc/asm.txt
===================================================================
--- branches/JBossProfiler2/doc/asm.txt 2008-08-16 08:13:41 UTC (rev 462)
+++ branches/JBossProfiler2/doc/asm.txt 2008-08-16 08:18:42 UTC (rev 463)
@@ -1,29 +0,0 @@
-Copyright (c) 2000-2005 INRIA, France Telecom
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
Deleted: branches/JBossProfiler2/lib/asm.jar
===================================================================
(Binary files differ)
Modified: branches/JBossProfiler2/src/etc/jboss-profiler.properties
===================================================================
--- branches/JBossProfiler2/src/etc/jboss-profiler.properties 2008-08-16 08:13:41 UTC (rev 462)
+++ branches/JBossProfiler2/src/etc/jboss-profiler.properties 2008-08-16 08:18:42 UTC (rev 463)
@@ -1,4 +1,3 @@
-core=javassist
enable=yes
cpu=yes
memory=yes
Deleted: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledClass.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledClass.java 2008-08-16 08:13:41 UTC (rev 462)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledClass.java 2008-08-16 08:18:42 UTC (rev 463)
@@ -1,103 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profiler.agent;
-
-import org.jboss.profiler.shared.Visibility;
-
-import org.objectweb.asm.ClassAdapter;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-
-/**
- * Wraps a profiled class
- * @author Jesper Pedersen <jesper.pedersen at jboss.org>
- */
-public class ASMProfiledClass extends ClassAdapter {
- /** The class name */
- private String className;
-
- /**
- * Constructor
- * @param visitor The class visitor
- * @param className The class name
- */
- public ASMProfiledClass(ClassVisitor visitor, String className) {
- super(visitor);
- this.className = className;
- }
-
- /**
- * Visit method
- * @param access The access
- * @param name The name
- * @param descriptor The descriptor
- * @param signature The signature
- * @param exceptions The exceptions
- * @return The method visitor
- */
- public MethodVisitor visitMethod(int access,
- String name,
- String descriptor,
- String signature,
- String[] exceptions) {
-
- MethodVisitor mv = super.visitMethod(access,
- name,
- descriptor,
- signature,
- exceptions);
-
- boolean include = true;
-
- if ((access & Opcodes.ACC_PRIVATE) != 0) {
- Visibility v = Agent.getVisibility(className);
- if (v == Visibility.PROTECTED ||
- v == Visibility.PACKAGE ||
- v == Visibility.PUBLIC) {
- include = false;
- }
- } else if ((access & Opcodes.ACC_PROTECTED) != 0) {
- Visibility v = Agent.getVisibility(className);
- if (v == Visibility.PACKAGE ||
- v == Visibility.PUBLIC) {
- include = false;
- }
- } else if (access == 0) { // Package
- Visibility v = Agent.getVisibility(className);
- if (v == Visibility.PUBLIC) {
- include = false;
- }
- }
- // Opcodes.ACC_PUBLIC -- no need to check for method visibility
-
- if (include) {
- if (descriptor != null) {
- return new ASMProfiledMethod(mv, className, name + descriptor);
- } else {
- return new ASMProfiledMethod(mv, className, name);
- }
- }
-
- return mv;
- }
-}
Deleted: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledMethod.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledMethod.java 2008-08-16 08:13:41 UTC (rev 462)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMProfiledMethod.java 2008-08-16 08:18:42 UTC (rev 463)
@@ -1,257 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profiler.agent;
-
-import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodAdapter;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-
-/**
- * Wraps a profiled method
- * @author Jesper Pedersen <jesper.pedersen at jboss.org>
- */
-public class ASMProfiledMethod extends MethodAdapter {
-
- /** The class name */
- private String className;
-
- /** The method name */
- private String methodName;
-
- /** CINIT call */
- private boolean clinit = false;
-
- /** INIT call */
- private boolean init = false;
-
- /**
- * Constructor
- * @param visitor The visitor
- * @param className The class name
- * @param methodName The method name
- */
- public ASMProfiledMethod(MethodVisitor visitor,
- String className,
- String methodName) {
- super(visitor);
- this.className = className;
- this.methodName = methodName;
-
- if ("<clinit>".equals(methodName)) {
- this.clinit = true;
- } else if (methodName.startsWith("<init>")) {
- this.init = true;
- }
- }
-
- /**
- * Visit: Code
- */
- public void visitCode() {
- if (clinit) {
- super.visitCode();
- return;
- }
-
- if (init) {
- this.visitLdcInsn(className);
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "allocation",
- "(Ljava/lang/String;)V");
- }
-
- this.visitLdcInsn(className);
- this.visitLdcInsn(methodName);
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "start",
- "(Ljava/lang/String;Ljava/lang/String;)V");
-
- super.visitCode();
- }
-
- /**
- * Visit: Insn
- * @param inst The instruction
- */
- public void visitInsn(int inst) {
- if (clinit) {
- super.visitInsn(inst);
- return;
- }
-
- switch (inst) {
- case Opcodes.ARETURN:
- case Opcodes.DRETURN:
- case Opcodes.FRETURN:
- case Opcodes.IRETURN:
- case Opcodes.LRETURN:
- case Opcodes.RETURN:
- case Opcodes.ATHROW:
-
- this.visitLdcInsn(className);
- this.visitLdcInsn(methodName);
-
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "end",
- "(Ljava/lang/String;Ljava/lang/String;)V");
- break;
-
- default:
- break;
- }
-
- if (Opcodes.MONITORENTER == inst) {
- this.visitLdcInsn(className);
- this.visitLdcInsn(methodName);
-
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "beginWait",
- "(Ljava/lang/String;Ljava/lang/String;)V");
-
- super.visitInsn(inst);
-
- this.visitLdcInsn(className);
- this.visitLdcInsn(methodName);
-
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "endWait",
- "(Ljava/lang/String;Ljava/lang/String;)V");
- } else {
- super.visitInsn(inst);
- }
- }
-
- /**
- * Visit: Method inst
- * @param opcode The opcode
- * @param owner The owner
- * @param name The name
- * @param desc The description
- */
- @Override
- public void visitMethodInsn(int opcode, String owner, String name, String desc) {
- if (isWaitInsn(opcode, owner, name, desc)) {
-
- this.visitLdcInsn(className);
- this.visitLdcInsn(methodName);
-
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "beginWait",
- "(Ljava/lang/String;Ljava/lang/String;)V");
-
- super.visitMethodInsn(opcode, owner, name, desc);
-
- this.visitLdcInsn(className);
- this.visitLdcInsn(methodName);
-
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "endWait",
- "(Ljava/lang/String;Ljava/lang/String;)V");
- } else {
- super.visitMethodInsn(opcode, owner, name, desc);
- }
- }
-
- /**
- * Visit: Try / catch
- * @param start The start label
- * @param end The end label
- * @param handler The handler label
- * @param type The type
- */
- @Override
- public void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
- super.visitTryCatchBlock(start, end, handler, type);
-
- if (type != null && !clinit) {
- handler.info = new ExceptionInfo(type);
- }
- }
-
- /**
- * Visit: Label
- * @param label The label
- */
- @Override
- public void visitLabel(Label label) {
- super.visitLabel(label);
-
- if (label.info instanceof ExceptionInfo) {
- this.visitLdcInsn(className);
- this.visitLdcInsn(methodName);
- this.visitLdcInsn(((ExceptionInfo)label.info).getType());
-
- this.visitMethodInsn(Opcodes.INVOKESTATIC,
- Profiler.CLASSNAME,
- "unwind",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
- }
- }
-
- /**
- * Method: Waiting
- * @param opcode The opcode
- * @param owner The owner
- * @param name The name
- * @param desc The description
- */
- private static boolean isWaitInsn(int opcode, String owner, String name, String desc) {
- boolean isWait = (opcode == Opcodes.INVOKEVIRTUAL
- && "java/lang/Object".equals(owner)
- && "wait".equals(name)
- && ("()V".equals(desc) || "(J)V".equals(desc) || "(JI)V".equals(desc)));
- if (isWait) {
- return true;
- }
-
- isWait = (opcode == Opcodes.INVOKEVIRTUAL
- && "java/lang/Thread".equals(owner)
- && "join".equals(name)
- && ("()V".equals(desc) || "(J)V".equals(desc) || "(JI)V".equals(desc)));
- if (isWait) {
- return true;
- }
-
- isWait = (opcode == Opcodes.INVOKESTATIC
- && "java/lang/Thread".equals(owner)
- && "sleep".equals(name)
- && ("(J)V".equals(desc) || "(JI)V".equals(desc)));
- if (isWait) {
- return true;
- }
-
- isWait = (opcode == Opcodes.INVOKESTATIC
- && "java/lang/Thread".equals(owner)
- && "yield".equals(name)
- && "()V".equals(desc));
-
- return isWait;
- }
-}
Deleted: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMTransformer.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMTransformer.java 2008-08-16 08:13:41 UTC (rev 462)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ASMTransformer.java 2008-08-16 08:18:42 UTC (rev 463)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.profiler.agent;
-
-import java.io.IOException;
-
-import org.objectweb.asm.ClassAdapter;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassWriter;
-
-/**
- * Implements the ASM based transformer
- * @author Jesper Pedersen <jesper.pedersen at jboss.org>
- */
-public class ASMTransformer extends AbstractTransformer {
-
- /**
- * Constructor
- */
- public ASMTransformer() {
- }
-
- /**
- * Generate instrumented class
- * @param className The class name
- * @param ob The original bytes
- * @return The instrumented bytes
- * @exception IOException If an error occurs
- */
- protected byte[] generateInstrumented(String className, byte[] ob) throws IOException {
- ClassReader reader = new ClassReader(ob);
- ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
- ClassAdapter adapter = new ASMProfiledClass(writer, className);
- reader.accept(adapter, ClassReader.SKIP_DEBUG);
-
- return writer.toByteArray();
- }
-}
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java 2008-08-16 08:13:41 UTC (rev 462)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java 2008-08-16 08:18:42 UTC (rev 463)
@@ -54,9 +54,6 @@
*/
public class Agent {
- /** Use Javassist */
- private static boolean useJavassist;
-
/** Transformer */
private static Transformer transformer;
@@ -191,8 +188,6 @@
visibility = parseVisibility(vs);
visibilityTree = new TreeMap(new SizeComparator());
- useJavassist = parseCore(properties.getProperty("core"), true);
-
ejb = parseBoolean(properties.getProperty("ejb"), true);
servlet = parseBoolean(properties.getProperty("servlet"), true);
jsf = parseBoolean(properties.getProperty("jsf"), true);
@@ -264,25 +259,6 @@
}
/**
- * Parse core property (Javassist or ASM library)
- * @param p The property value
- * @param def The default value
- * @return True or false
- */
- private static boolean parseCore(String p, boolean def) {
- if (p != null) {
- p = p.trim();
- if ("ASM".equalsIgnoreCase(p)) {
- return false;
- } else {
- return true;
- }
- }
-
- return def;
- }
-
- /**
* Parse include / exclude lists
* @param include The include input
* @param exclude The exclude input
@@ -540,7 +516,7 @@
*/
private static boolean approve(String className) {
// We can't profile the profiler, Java / Sun classes
- // nor ASM and Javassist whichever is used
+ // nor Javassist
if (className.startsWith("org/jboss/profiler/agent/") ||
className.startsWith("org/jboss/profiler/as/") ||
className.startsWith("org/jboss/profiler/client/") ||
@@ -551,8 +527,7 @@
className.startsWith("javax/") ||
className.startsWith("sun/") ||
className.startsWith("com/sun/") ||
- (!useJavassist && className.startsWith("org/objectweb/asm/")) ||
- (useJavassist && className.startsWith("javassist/"))) {
+ className.startsWith("javassist/")) {
return false;
}
@@ -826,20 +801,11 @@
* @return True if detection went ok; otherwise false
*/
private static boolean checkInstrumentation() {
- if (useJavassist) {
- try {
- Class c = Class.forName("javassist.ClassPool");
- } catch (Throwable t) {
- System.out.println("WARNING: Javassist not detected - the profiler will not be enabled");
- return false;
- }
- } else {
- try {
- Class c = Class.forName("org.objectweb.asm.ClassAdapter");
- } catch (Throwable t) {
- System.out.println("WARNING: ASM not detected - the profiler will not be enabled");
- return false;
- }
+ try {
+ Class c = Class.forName("javassist.ClassPool");
+ } catch (Throwable t) {
+ System.out.println("WARNING: Javassist not detected - the profiler will not be enabled");
+ return false;
}
return true;
}
@@ -887,9 +853,6 @@
if ("quite".equalsIgnoreCase(key)) {
quite = parseBoolean(value, quite);
}
- if ("core".equalsIgnoreCase(key)) {
- useJavassist = parseCore(value, useJavassist);
- }
}
}
@@ -903,11 +866,7 @@
}
checkInstrumentation();
- if (useJavassist) {
- transformer = new JavassistTransformer();
- } else {
- transformer = new ASMTransformer();
- }
+ transformer = new JavassistTransformer();
instrumentation = inst;
instrumentation.addTransformer(transformer);
More information about the jboss-cvs-commits
mailing list