Package org.nuiton.profiling
Class Trace
- java.lang.Object
-
- org.nuiton.profiling.Trace
-
public class Trace extends Object
Permet de tracer les appels aux methodes.- Author:
- bpoussin : poussin@codelutin.com, tchemit : chemit@codelutin.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classTrace.CallRepresente un call de methodeprotected static classTrace.StatAndStack
-
Field Summary
Fields Modifier and Type Field Description protected ConcurrentLinkedDeque<Trace.StatAndStack>allStatAndStackprotected static ThreadLocal<Trace.StatAndStack>callStacksarray : [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 melangeesprotected Map<Method,StatisticMethod>commonStatisticsstatistic on method callprotected booleandistinctThreadCallprotected Trace.StatAndStackmonoStatAndStackprotected booleanmultithread
-
Constructor Summary
Constructors Constructor Description Trace()default usable in multi-thread context, all calls in all threads are stored in same place (no thread distinction)Trace(boolean multithread, boolean distinctThreadCall)indique que l'on utilise Trace seulement avec un thread, cela evite d'utiliser en interne un ThreadLocal
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearStatistics()Clear all statistiques.voidenter(Method method)voidexit(Method method)protected Map<Method,StatisticMethod>getCommonStatistics()Trace.StatAndStackgetMonoStatAndStack()Trace.StatAndStackgetStack()StringgetStatisticsCSV()StringgetStatisticsJson()StringgetStatisticsText()voidprintStatisticsAndClear()voidprintStatisticsAndClear(PrintStream printer)
-
-
-
Field Detail
-
distinctThreadCall
protected boolean distinctThreadCall
-
multithread
protected boolean multithread
-
commonStatistics
protected Map<Method,StatisticMethod> commonStatistics
statistic on method call
-
monoStatAndStack
protected Trace.StatAndStack monoStatAndStack
-
allStatAndStack
protected ConcurrentLinkedDeque<Trace.StatAndStack> allStatAndStack
-
callStacks
protected static final ThreadLocal<Trace.StatAndStack> callStacks
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
-
-
Constructor Detail
-
Trace
public Trace()
default usable in multi-thread context, all calls in all threads are stored in same place (no thread distinction)
-
Trace
public Trace(boolean multithread, boolean distinctThreadCall)indique que l'on utilise Trace seulement avec un thread, cela evite d'utiliser en interne un ThreadLocal- Parameters:
multithread- si vrai indique que cette instance est utilise dans un context multithread. Dans ce cas il est possible d'indique la politique de collect des appels via le parametre distinctThreadCalldistinctThreadCall- si vrai indique que les appels des differents thread ne doivent pas etre melange. Si deux thread appel la meme methode cette methode se trouvera dans des statistiques differentes pour chacun des threads
-
-
Method Detail
-
getMonoStatAndStack
public Trace.StatAndStack getMonoStatAndStack()
-
getCommonStatistics
protected Map<Method,StatisticMethod> getCommonStatistics()
-
getStack
public Trace.StatAndStack getStack()
-
enter
public void enter(Method method)
-
exit
public void exit(Method method)
-
getStatisticsCSV
public String getStatisticsCSV()
- Returns:
- les statistiques in CSV format
-
getStatisticsJson
public String getStatisticsJson()
- Returns:
- les statistiques in json format
- Since:
- 2.7
-
clearStatistics
public void clearStatistics()
Clear all statistiques.- Since:
- 2.7
-
getStatisticsText
public String getStatisticsText()
- Returns:
- les statistiques
-
printStatisticsAndClear
public void printStatisticsAndClear()
-
printStatisticsAndClear
public void printStatisticsAndClear(PrintStream printer)
-
-