Author: tchemit Date: 2011-09-22 22:23:59 +0200 (Thu, 22 Sep 2011) New Revision: 2212 Url: http://nuiton.org/repositories/revision/nuiton-utils/2212 Log: fix nuiton-profiling documentation + make it dynamic Added: trunk/nuiton-profiling/src/site/apt/index.apt.vm Removed: trunk/nuiton-profiling/src/site/apt/index.apt Modified: trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java trunk/pom.xml Modified: trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java =================================================================== --- trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java 2011-09-22 17:27:23 UTC (rev 2211) +++ trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java 2011-09-22 20:23:59 UTC (rev 2212) @@ -333,17 +333,17 @@ protected static class Statistic { Method method; /** nombre d'appel */ - long call = 0; + long call; /** nombre d'appel vers une autre method depuis cette methode */ - long callNestMethod = 0; + long callNestMethod; /** temps mini d'execution de cette methode (sans le temps des autres methodes) */ - long timeMin = 0; + long timeMin; /** temps max d'execution de cette methode (sans le temps des autres methodes) */ - long timeMax = 0; + long timeMax; /** temps total d'execution de cette methode (sans le temps des autres methodes) */ - long timeTotal = 0; + long timeTotal; /** temps total d'execution de cette methode (avec le temps des autres methodes) */ - long timeTotalNestMethod = 0; + long timeTotalNestMethod; public Statistic(Method method) { this.method = method; Deleted: trunk/nuiton-profiling/src/site/apt/index.apt =================================================================== --- trunk/nuiton-profiling/src/site/apt/index.apt 2011-09-22 17:27:23 UTC (rev 2211) +++ trunk/nuiton-profiling/src/site/apt/index.apt 2011-09-22 20:23:59 UTC (rev 2212) @@ -1,106 +0,0 @@ -~~~ -~~ #%L -~~ Nuiton Utils :: Nuiton Profiling -~~ -~~ $Id$ -~~ $HeadURL$ -~~ %% -~~ Copyright (C) 2004 - 2010 CodeLutin -~~ %% -~~ This program 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 3 of the -~~ License, or (at your option) any later version. -~~ -~~ This program 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 General Lesser Public License for more details. -~~ -~~ You should have received a copy of the GNU General Lesser Public -~~ License along with this program. If not, see -~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. -~~ #L% -~~~ - ---- - Nuiton utils Extra - ---- - ---- - 2009-08-23 - ---- - -Présentation - - nuiton-profiling contient un ensemble de librairies pour aider à tester les - performance d'une application et voir ou le temps est perdu. - -NuitonTrace - - Permet de tracer le temps passé dans les méthodes au cours de l'éxecution. - Cette classe utilise l'AOP pour cela. Pour l'utiliser voir sa javadoc. - -NuitonTrace pour une application Web lancée avec Maven - - Il faut créer le fichier src/main/webapp/WEB-INF/classes/META-INF/aop.xml - pour indiquer les methodes que vous souhaitez surveiller, il contient par - exemple:: - - <!DOCTYPE aspectj PUBLIC - "-//AspectJ//DTD//EN" - "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"> - - <aspectj> - <aspects> - <concrete-aspect name="org.nuiton.profiling.NuitonTraceTestAspect" - extends="org.nuiton.profiling.NuitonTrace"> - <pointcut name="executeMethod" - expression=" - execution(* org.nuiton..*(..)) - || execution(* org.chorem..*(..)) - || execution(* org.apache.struts2..*(..)) - || execution(* com.opensymphony..*(..)) - || execution(* org.apache.velocity..*(..)) - || execution(* freemarker..*(..)) - || execution(* ognl..*(..))"/> - </concrete-aspect> - </aspects> - <weaver options="-verbose"> - </weaver> - </aspectj> - - - Il faut ajouter la dépendance dans votre projet:: - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-profiling</artifactId> - <version>2.3-SNAPSHOT</version> - </dependency> - - Il faut ajouter des options Maven:: - - export MAVEN_OPTS="$MAVEN_OPTS -javaagent:${maven_repo}/org/aspectj/aspectjweaver/1.6.11/aspectjweaver-1.6.11.jar" - - ensuite lancer:: - - mvn jetty:run - - Le plus simple pour sortir les statistiques lorsque vous en avez besoin est de - créer un lien sur votre page web vers une jsp qui contient:: - - <%@page import="org.nuiton.profiling.NuitonTrace"%> - <%@page contentType="text/csv" pageEncoding="UTF-8"%> - <%=NuitonTrace.getStatisticsCSVAndClear()%> - -Il ne vous reste plus qu'a analyser votre application - -NuitonTrace pour une application Web lancée dans un Tomcat - - Procéder de la même façon que pour maven, le seul changement est le nom - de la variable d'environnement qui est - - export JAVA_OPTS="$JAVA_OPTS -javaagent:${maven_repo}/org/aspectj/aspectjweaver/1.6.11/aspectjweaver-1.6.11.jar" - - Si vous avez des problèmes, reconstruire le war avec un clean avant et supprimer - le répertoire pour votre application qui a peut être créé par tomcat dans le - répertoire webapps. Copied: trunk/nuiton-profiling/src/site/apt/index.apt.vm (from rev 2211, trunk/nuiton-profiling/src/site/apt/index.apt) =================================================================== --- trunk/nuiton-profiling/src/site/apt/index.apt.vm (rev 0) +++ trunk/nuiton-profiling/src/site/apt/index.apt.vm 2011-09-22 20:23:59 UTC (rev 2212) @@ -0,0 +1,115 @@ +~~~ +~~ #%L +~~ Nuiton Utils :: Nuiton Profiling +~~ +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2004 - 2010 CodeLutin +~~ %% +~~ This program 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 3 of the +~~ License, or (at your option) any later version. +~~ +~~ This program 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 General Lesser Public License for more details. +~~ +~~ You should have received a copy of the GNU General Lesser Public +~~ License along with this program. If not, see +~~ <http://www.gnu.org/licenses/lgpl-3.0.html>. +~~ #L% +~~~ + ---- + Nuiton utils Extra + ---- + ---- + 2009-08-23 + ---- + +Présentation + + nuiton-profiling contient un ensemble de librairies pour aider à tester les + performance d'une application et voir ou le temps est perdu. + +NuitonTrace + + Permet de tracer le temps passé dans les méthodes au cours de l'éxecution. + Cette classe utilise l'AOP pour cela. Pour l'utiliser voir sa javadoc. + +NuitonTrace pour une application Web lancée avec Maven + + Il faut créer le fichier src/main/webapp/WEB-INF/classes/META-INF/aop.xml + pour indiquer les methodes que vous souhaitez surveiller, il contient par + exemple + +-------------------------------------------------------------------------------- +<!DOCTYPE aspectj PUBLIC + "-//AspectJ//DTD//EN" + "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"> +<aspectj> + <weaver options="-verbose"/> + <aspects> + <concrete-aspect name="org.nuiton.profiling.NuitonTraceTestAspect" + extends="org.nuiton.profiling.NuitonTrace"> + <pointcut name="executeMethod" + expression=" + execution(* org.nuiton..*(..)) + || execution(* org.chorem..*(..)) + || execution(* org.apache.struts2..*(..)) + || execution(* com.opensymphony..*(..)) + || execution(* org.apache.velocity..*(..)) + || execution(* freemarker..*(..)) + || execution(* ognl..*(..))"/> + </concrete-aspect> + </aspects> +</aspectj> +-------------------------------------------------------------------------------- + + Il faut ajouter la dépendance dans votre projet + +-------------------------------------------------------------------------------- + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-profiling</artifactId> + <version>${project.version}</version> + </dependency> +-------------------------------------------------------------------------------- + + Il faut ajouter des options Maven + +-------------------------------------------------------------------------------- + export MAVEN_OPTS="$MAVEN_OPTS -javaagent:\${maven_repo}/org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar" +-------------------------------------------------------------------------------- + + ensuite lancer + +-------------------------------------------------------------------------------- + mvn jetty:run +-------------------------------------------------------------------------------- + + Le plus simple pour sortir les statistiques lorsque vous en avez besoin est de + créer un lien sur votre page web vers une jsp qui contient + +-------------------------------------------------------------------------------- + <%@page import="org.nuiton.profiling.NuitonTrace"%> + <%@page contentType="text/csv" pageEncoding="UTF-8"%> + <%=NuitonTrace.getStatisticsCSVAndClear()%> +-------------------------------------------------------------------------------- + +Il ne vous reste plus qu'a analyser votre application + +NuitonTrace pour une application Web lancée dans un Tomcat + + Procéder de la même façon que pour maven, le seul changement est le nom + de la variable d'environnement qui est + +-------------------------------------------------------------------------------- + export JAVA_OPTS="$JAVA_OPTS -javaagent:${maven_repo}/org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar" +-------------------------------------------------------------------------------- + + Si vous avez des problèmes, reconstruire le war avec un clean avant et supprimer + le répertoire pour votre application qui a peut être créé par tomcat dans le + répertoire webapps. Property changes on: trunk/nuiton-profiling/src/site/apt/index.apt.vm ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-09-22 17:27:23 UTC (rev 2211) +++ trunk/pom.xml 2011-09-22 20:23:59 UTC (rev 2212) @@ -74,13 +74,13 @@ <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> - <version>${aspectj.version}</version> + <version>${aspectjVersion}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> - <version>${aspectj.version}</version> + <version>${aspectjVersion}</version> <scope>runtime</scope> </dependency> @@ -177,7 +177,7 @@ <projectId>nuiton-utils</projectId> <nuitonI18nVersion>2.4.1</nuitonI18nVersion> - <aspectj.version>1.6.11</aspectj.version> + <aspectjVersion>1.6.11</aspectjVersion> <xworkVersion>2.2.3.1</xworkVersion> <!-- i18n configuration -->