[jboss-svn-commits] JBL Code SVN: r32612 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler: implementation and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Apr 23 13:48:22 EDT 2010
Author: whitingjr
Date: 2010-04-23 13:48:22 -0400 (Fri, 23 Apr 2010)
New Revision: 32612
Added:
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/NoOpProfiler.java
Modified:
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/Profiler.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JavaInteractiveProfiler.java
Log:
Added a noop profiler configuration.
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java 2010-04-23 16:22:22 UTC (rev 32611)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java 2010-04-23 17:48:22 UTC (rev 32612)
@@ -31,16 +31,20 @@
{
private static final Logger logger = Logger.getLogger(AbstractProfiler.class);
protected Object profilerInstance;
+ @SuppressWarnings("unchecked")
protected Class profilerClass;
protected AbstractProfiler(String fqcn)
{
try
{
- if (null != fqcn && !StringUtils.equals("", fqcn.trim()) && !usesStaticMethods())
+ if (StringUtils.isNotBlank( fqcn) )
{
this.profilerClass = Class.forName(fqcn);
- this.profilerInstance = profilerClass.newInstance();
+ if (!usesStaticMethods())
+ {
+ this.profilerInstance = profilerClass.newInstance();
+ }
}
}
catch (ClassNotFoundException cnfe)
@@ -86,6 +90,12 @@
invoke(getClearMethodName());
}
+ @Override
+ public void startCPURecording() throws Exception
+ {
+ invoke(getStartCPURecordingMethodName());
+ }
+
/**
* Attempt to invoke the method of the concrete profiling API. Try and handle
* static methods.
@@ -93,11 +103,15 @@
* @param name
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
private void invoke(String name)
throws Exception
{
- Method profilerMethod = this.profilerClass.getMethod(name);
- profilerMethod.invoke(getInstance()); // static methods ignore the instance reference
+ if (StringUtils.isNotBlank(name))
+ {
+ Method profilerMethod = this.profilerClass.getMethod(name);
+ profilerMethod.invoke(getInstance()); // static methods ignore the instance reference
+ }
}
protected Object getInstance()
@@ -110,6 +124,7 @@
protected abstract String getSuspendMethodName();
protected abstract String getShutDownMethodName();
protected abstract String getClearMethodName();
+ protected abstract String getStartCPURecordingMethodName();
protected abstract boolean usesStaticMethods();
}
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/Profiler.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/Profiler.java 2010-04-23 16:22:22 UTC (rev 32611)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/Profiler.java 2010-04-23 17:48:22 UTC (rev 32612)
@@ -29,4 +29,5 @@
public void stop() throws Exception;
public void clear() throws Exception;
public void shutDown() throws Exception;
+ public void startCPURecording() throws Exception;
}
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler.java 2010-04-23 16:22:22 UTC (rev 32611)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler.java 2010-04-23 17:48:22 UTC (rev 32612)
@@ -22,6 +22,10 @@
package org.jboss.jbossts.performance.profiler.implementation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.commons.lang.StringUtils;
import org.jboss.jbossts.performance.profiler.AbstractProfiler;
public class JProfiler extends AbstractProfiler
@@ -61,4 +65,26 @@
{
return true;
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected String getStartCPURecordingMethodName()
+ {
+ try
+ {
+ Method profilerMethod = this.profilerClass.getMethod("startCPURecording", Boolean.class);
+ profilerMethod.invoke(getInstance(), true); // static methods ignore the instance reference
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ }
+ catch (InvocationTargetException ite) {
+
+ }
+ catch (IllegalAccessException e) {
+
+ }
+
+ return StringUtils.EMPTY;
+ }
}
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JavaInteractiveProfiler.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JavaInteractiveProfiler.java 2010-04-23 16:22:22 UTC (rev 32611)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JavaInteractiveProfiler.java 2010-04-23 17:48:22 UTC (rev 32612)
@@ -64,8 +64,12 @@
{
return false;
}
+ @Override
+ protected String getStartCPURecordingMethodName()
+ {
+ return null;
+ }
-
public JavaInteractiveProfiler()
{
super("com.mentorgen.tools.profile.runtime.Profile");
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/NoOpProfiler.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/NoOpProfiler.java (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/NoOpProfiler.java 2010-04-23 17:48:22 UTC (rev 32612)
@@ -0,0 +1,83 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbossts.performance.profiler.implementation;
+
+import org.jboss.jbossts.performance.profiler.AbstractProfiler;
+
+public class NoOpProfiler extends AbstractProfiler
+{
+ public NoOpProfiler()
+ {
+ super("");
+ }
+
+ @Override
+ protected String getClearMethodName()
+ {
+ // FIXME getClearMethodName
+ return null;
+ }
+
+ @Override
+ protected String getShutDownMethodName()
+ {
+ // FIXME getShutDownMethodName
+ return null;
+ }
+
+ @Override
+ protected String getStartCPURecordingMethodName()
+ {
+ // FIXME getStartCPURecordingMethodName
+ return null;
+ }
+
+ @Override
+ protected String getStartMethodName()
+ {
+ // FIXME getStartMethodName
+ return null;
+ }
+
+ @Override
+ protected String getStopMethodName()
+ {
+ // FIXME getStopMethodName
+ return null;
+ }
+
+ @Override
+ protected String getSuspendMethodName()
+ {
+ // FIXME getSuspendMethodName
+ return null;
+ }
+
+ @Override
+ protected boolean usesStaticMethods()
+ {
+ // FIXME usesStaticMethods
+ return false;
+ }
+
+}
More information about the jboss-svn-commits
mailing list