[jboss-svn-commits] JBL Code SVN: r30856 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance: profiler and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 29 12:01:18 EST 2009
Author: whitingjr
Date: 2009-12-29 12:01:17 -0500 (Tue, 29 Dec 2009)
New Revision: 30856
Added:
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/
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/
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler5.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JavaInteractiveProfiler.java
Log:
Added profiler implementation support.
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java 2009-12-29 17:01:17 UTC (rev 30856)
@@ -0,0 +1,105 @@
+ /*
+ * 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;
+
+import java.lang.reflect.Method;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+public abstract class AbstractProfiler implements Profiler
+{
+ private static final Logger logger = Logger.getLogger(AbstractProfiler.class);
+ protected Object profilerInstance;
+
+ protected AbstractProfiler(String fqcn)
+ {
+ try
+ {
+ if (null != fqcn && !StringUtils.equals("", fqcn.trim()))
+ {
+ Class profilerClass = Class.forName(fqcn);
+ profilerInstance = profilerClass.newInstance();
+ }
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ logger.error(cnfe.getMessage(), cnfe);
+ }
+ catch (IllegalAccessException iae)
+ {
+ logger.error(iae.getMessage(), iae);
+ }
+ catch (InstantiationException ie)
+ {
+ logger.error(ie.getMessage(), ie);
+ }
+ }
+
+ @Override
+ public void start()
+ throws Exception
+ {
+ /* You will need to override this implementation if the profiler has
+ method parameters */
+ invoke(getStartMethodName());
+ }
+ @Override
+ public void stop() throws Exception
+ {
+ invoke(getStopMethodName());
+ }
+ @Override
+ public void suspend() throws Exception
+ {
+ invoke(getSuspendMethodName());
+ }
+ @Override
+ public void shutDown() throws Exception
+ {
+ invoke(getShutDownMethodName());
+ }
+ @Override
+ public void clear() throws Exception
+ {
+ invoke(getClearMethodName());
+ }
+
+ private void invoke(String name)
+ throws Exception
+ {
+ Method profilerMethod = getInstance().getClass().getMethod(name);
+ profilerMethod.invoke(getInstance());
+ }
+
+ protected Object getInstance()
+ {
+ return this.profilerInstance;
+ }
+
+ protected abstract String getStartMethodName();
+ protected abstract String getStopMethodName();
+ protected abstract String getSuspendMethodName();
+ protected abstract String getShutDownMethodName();
+ protected abstract String getClearMethodName();
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/Profiler.java 2009-12-29 17:01:17 UTC (rev 30856)
@@ -0,0 +1,32 @@
+ /*
+ * 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;
+
+public interface Profiler
+{
+ public void start() throws Exception;
+ public void suspend() throws Exception;
+ public void stop() throws Exception;
+ public void clear() throws Exception;
+ public void shutDown() throws Exception;
+}
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler5.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler5.java (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JProfiler5.java 2009-12-29 17:01:17 UTC (rev 30856)
@@ -0,0 +1,59 @@
+ /*
+ * 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 JProfiler5 extends AbstractProfiler
+{
+ @Override
+ protected String getStopMethodName()
+ {
+ return "stopMethodStatsRecording";
+ }
+ @Override
+ protected String getSuspendMethodName()
+ {
+ return "stopMethodStatsRecording";
+ }
+ @Override
+ protected String getStartMethodName()
+ {
+ return "startMethodStatsRecording";
+ }
+ @Override
+ protected String getShutDownMethodName()
+ {
+ return "";
+ }
+ @Override
+ protected String getClearMethodName()
+ {
+ return "";
+ }
+ public JProfiler5()
+ {
+ super("com.jprofiler.api.agent.Controller");
+ }
+
+}
Added: 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 (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/implementation/JavaInteractiveProfiler.java 2009-12-29 17:01:17 UTC (rev 30856)
@@ -0,0 +1,68 @@
+ /*
+ * 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 JavaInteractiveProfiler extends AbstractProfiler
+{
+ @Override
+ public void stop()
+ throws Exception
+ {
+ super.stop();
+ super.stop();
+ }
+
+ @Override
+ protected String getStopMethodName()
+ {
+ return "stop";
+ }
+ @Override
+ protected String getSuspendMethodName()
+ {
+ return "stop";
+ }
+ @Override
+ protected String getStartMethodName()
+ {
+ return "start";
+ }
+ @Override
+ protected String getShutDownMethodName()
+ {
+ return "shutDown";
+ }
+ @Override
+ protected String getClearMethodName()
+ {
+ return "clear";
+ }
+
+
+ public JavaInteractiveProfiler()
+ {
+ super("com.mentorgen.tools.profile.runtime.Profile");
+ }
+}
More information about the jboss-svn-commits
mailing list