Package edu.umd.cs.findbugs.log
Class Profiler
- java.lang.Object
-
- edu.umd.cs.findbugs.log.Profiler
-
- All Implemented Interfaces:
IProfiler,XMLWriteable
@NotThreadSafe public class Profiler extends java.lang.Object implements IProfiler, XMLWriteable
This class is mutable and not synchronized, so create independent
Profilerinstance for each worker thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProfiler.ClassNameComparator(package private) static classProfiler.Clockstatic interfaceProfiler.Filterstatic classProfiler.FilterByCallsstatic classProfiler.FilterByTimestatic classProfiler.FilterByTimePerCallstatic classProfiler.Profilestatic classProfiler.TimePerCallComparatorstatic classProfiler.TotalCallsComparatorstatic classProfiler.TotalTimeComparator
-
Field Summary
Fields Modifier and Type Field Description private java.util.Stack<java.lang.Object>context(package private) static booleanMAX_CONTEXTprivate java.util.concurrent.ConcurrentMap<java.lang.Class<?>,Profiler.Profile>profileUsingConcurrentMapjust for historical reason.(package private) static booleanREPORTprivate java.util.Stack<Profiler.Clock>startTimes
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclear()Clears the previously accumulated data.(package private) booleancontains(java.lang.Class<?> targetClass)voidend(java.lang.Class<?> c)voidendContext(java.lang.Object context)private java.lang.ObjectgetContext()Profiler.ProfilegetProfile(java.lang.Class<?> c)(package private) java.util.Collection<Profiler.Profile>getProfiles()(package private) java.util.Set<java.lang.Class<?>>getTargetClasses()voidreport()voidreport(java.util.Comparator<java.lang.Class<?>> reportComparator, Profiler.Filter filter, java.io.PrintStream stream)voidstart(java.lang.Class<?> c)voidstartContext(java.lang.Object context)voidwriteXML(XMLOutput xmlOutput)Deprecated.
-
-
-
Field Detail
-
REPORT
static final boolean REPORT
-
MAX_CONTEXT
static final boolean MAX_CONTEXT
-
startTimes
private final java.util.Stack<Profiler.Clock> startTimes
-
context
private final java.util.Stack<java.lang.Object> context
-
profile
private final java.util.concurrent.ConcurrentMap<java.lang.Class<?>,Profiler.Profile> profile
Using
ConcurrentMapjust for historical reason. It can beMapbecause the Profiler class itself is not thread-safe.
-
-
Constructor Detail
-
Profiler
public Profiler()
The default constructor forProfiler.
-
-
Method Detail
-
startContext
public void startContext(java.lang.Object context)
-
endContext
public void endContext(java.lang.Object context)
-
getContext
private java.lang.Object getContext()
-
start
public void start(java.lang.Class<?> c)
- Parameters:
c- The class of detector, analyzer or others that is NOT shared among worker threads.
-
end
public void end(java.lang.Class<?> c)
- Parameters:
c- The class of detector, analyzer or others that is NOT shared among worker threads.
-
report
@Deprecated public void report()
Deprecated.Default implementation usesProfiler.TotalTimeComparatorand prints out class statistics based on total time spent for a class
-
report
@Deprecated public void report(java.util.Comparator<java.lang.Class<?>> reportComparator, Profiler.Filter filter, java.io.PrintStream stream)Deprecated.- Parameters:
reportComparator- non null comparator instance which will be used to sort the report statistics
-
clear
public void clear()
Clears the previously accumulated data. This method is public because it can be accessed explicitly from clients (like Eclipse).There is no need to clear profiler data after each run, because a new profiler instance is used for each analysis run (see
FindBugs2.execute()).
-
getProfile
public Profiler.Profile getProfile(java.lang.Class<?> c)
- Specified by:
getProfilein interfaceIProfiler
-
writeXML
@Deprecated public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
Deprecated.Description copied from interface:XMLWriteableWrite this object to given XMLOutput.- Specified by:
writeXMLin interfaceXMLWriteable- Parameters:
xmlOutput- the XMLOutput for the document- Throws:
java.io.IOException
-
getTargetClasses
@NonNull java.util.Set<java.lang.Class<?>> getTargetClasses()
-
getProfiles
@NonNull java.util.Collection<Profiler.Profile> getProfiles()
-
contains
@CheckReturnValue boolean contains(@NonNull java.lang.Class<?> targetClass)
-
-