public abstract class NuitonTrace extends Object
$lt;dependency$gt;
$lt;groupId$gt;org.nuiton$lt;/groupId$gt;
$lt;artifactId$gt;nuiton-profiling$lt;/artifactId$gt;
$lt;version$gt;2.7$lt;/version$gt;
$lt;/dependency$gt;
Pour l'utiliser il faut définir un fichier XML aop.xml dans le repertoire
META-INF ou WEB-INF qui intercepte les methodes souhaiter.
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"$gt;
$lt;aspectj$gt;
$lt;weaver options="-verbose"$gt;
$lt;exclude within="fr.insee..*CGLIB*"/$gt;
$lt;/weaver$gt;
$lt;aspects$gt;
$lt;concrete-aspect name="org.nuiton.profiling.NuitonTraceAppAspect"
extends="org.nuiton.profiling.NuitonTrace"$gt;
$lt;pointcut name="executeMethod"
expression="
execution(* org.nuiton..*(..))
|| execution(* org.chorem..*(..))
|| execution(* org.apache..*(..))
|| execution(* ognl..*(..))"/$gt;
$lt;/concrete-aspect$gt;
$lt;/aspects$gt;
$lt;/aspectj$gt;
Ensuite il faut lancer la JVM avec l'option
-javaagent:path/to/aspectjweaver-1.7.1.jarnormalement il se trouve dans le repo maven dans le repertoire
AUTO_SAVE_FILENAME_OPTION. Dans ce cas lors de l'arrêt de la JVM
les statistiques sont ecrites dans ce fichier.
PORT_OPTION
\@Expression( "execution(* fr.ifremer.isisfish.datastore.ResultStorage.*(..))" + "|| execution(* fr.ifremer.isisfish.aspect.Cache.*(..))" + "|| execution(* fr.ifremer.isisfish.aspect.Trace.*(..))" + "|| execution(* org.nuiton.topia..*(..))" + "|| execution(* org.nuiton.math.matrix..*(..))" + "|| execution(* fr.ifremer.isisfish.types..*(..))" + "|| execution(* org.apache.commons.collections..*(..))" ) Pointcut executeMethod;
| Modifier and Type | Class and Description |
|---|---|
protected static class |
NuitonTrace.Call
Represente un call de methode
|
protected static class |
NuitonTrace.Caller<E>
Classe qui permet d'ajouter un element et compte le nombre de fois
que l'on a ajoute cet element.
|
protected static class |
NuitonTrace.Statistic
Statistique sur un appele de methode
|
| Modifier and Type | Field and Description |
|---|---|
static String |
AUTO_SAVE_FILENAME_OPTION
constante determinant le nom de la variable d'environnement a lire
pour connaitre le nom du fichier de sauvegarde a la sortie de la JVM
|
protected Map<Method,NuitonTrace.Caller<Method>> |
callers |
protected static ThreadLocal<Stack<NuitonTrace.Call>> |
callStack
array : [nest method call, start time, start time with child]
On ne melange pas les stack entre les threads, sinon les resultats
ne veulent plus rien dire car toutes les methodes des threads sont
melangees
|
protected static boolean |
initilized
Indique si nuiton trace a deja ete initialise ou non
|
static String |
PORT_OPTION
constante determinant le nom de la variable d'environnement a lire
pour connaitre le port a utiliser pour le serveur web
|
protected Map<Method,NuitonTrace.Statistic> |
statistics
array : [call's numbers, call do, min time, max time, total time, total time with child]
|
| Constructor and Description |
|---|
NuitonTrace() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearStatistics() |
NuitonTrace.Caller<Method> |
getCallers(Method method)
Retourne la liste des appelant pour la methode passee en parametre
|
static Method[] |
getKeys(Map<Method,NuitonTrace.Statistic> statistics)
Method used to get all keys and prevent java.util.ConcurrentModificationException
|
protected static String |
getOption(String optionName)
Permet de lire les options de la ligne de commande Java (-D) et si non
trouver de rechercher dans les variables d'environnement
|
NuitonTrace.Statistic |
getStatistics(Method method)
Retourne les statistiques d'appele pour la methode passee en parametre
|
static String |
getStatisticsAndClear() |
static String |
getStatisticsCSVAndClear() |
static String |
getStatisticsJson() |
protected static void |
init()
Recherche la configuration dans les variables d'environnement et les
utilise pour mettre en place ce qui est demande par l'utilisateur
|
static void |
main(String... args)
Force le lancement du serveur web, permet d'avoir le serveur sur une
machine pour monitorer une application qui est sur une autre.
|
static void |
printStatisticsAndClear() |
static void |
printStatisticsAndClear(PrintStream printer) |
protected static void |
startWebService(int port)
Demarre le service web sur le port demande
|
void |
traceAfterExecute(org.aspectj.lang.JoinPoint jp) |
void |
traceAfterThrowingExecute(org.aspectj.lang.JoinPoint jp) |
void |
traceBeforeExecute(org.aspectj.lang.JoinPoint jp) |
public static final String PORT_OPTION
public static final String AUTO_SAVE_FILENAME_OPTION
protected static boolean initilized
protected Map<Method,NuitonTrace.Statistic> statistics
protected Map<Method,NuitonTrace.Caller<Method>> callers
protected static final ThreadLocal<Stack<NuitonTrace.Call>> callStack
public NuitonTrace.Statistic getStatistics(Method method)
method - public NuitonTrace.Caller<Method> getCallers(Method method)
method - public void traceBeforeExecute(org.aspectj.lang.JoinPoint jp)
public void traceAfterThrowingExecute(org.aspectj.lang.JoinPoint jp)
public void traceAfterExecute(org.aspectj.lang.JoinPoint jp)
public static Method[] getKeys(Map<Method,NuitonTrace.Statistic> statistics)
statistics - public static String getStatisticsCSVAndClear()
public static String getStatisticsJson()
public static void clearStatistics()
public static String getStatisticsAndClear()
public static void printStatisticsAndClear()
public static void printStatisticsAndClear(PrintStream printer)
protected static void startWebService(int port)
port - un port valide sur lequel attendreprotected static String getOption(String optionName)
optionName - protected static void init()
public static void main(String... args)
args - le port a utiliser si vide utilise les variables d'environnement
et en dernier recourrs utilise le port 4488Copyright © 2004–2013 CodeLutin. All rights reserved.