public class FilteredStackProfiler extends Profiler
Profiler
. The difference between the two is
that this class only counts samples whose stack trace contains an entry matching a particular
pattern.
This is useful for drilling down into particular regions of code within an application also busy doing other things; for example, a production HTTP API may have many endpoints, but you only want to know what one of them spends its time doing.
Constructor and Description |
---|
FilteredStackProfiler(int pollIntervalInMs,
java.util.function.Function<? super Profiler,java.lang.String> startFutureResultSupplier,
java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
Constructs a new profiler instance.
|
FilteredStackProfiler(int pollIntervalInMs,
java.util.function.Function<? super Profiler,java.lang.String> startFutureResultSupplier,
java.lang.String pattern)
Constructs a new profiler instance.
|
FilteredStackProfiler(int pollIntervalInMs,
java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
Constructs a new profiler instance.
|
FilteredStackProfiler(int pollIntervalInMs,
java.lang.String pattern)
Constructs a new profiler instance.
|
FilteredStackProfiler(java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
Constructs a new profiler instance.
|
FilteredStackProfiler(java.lang.String pattern)
Constructs a new profiler instance.
|
public FilteredStackProfiler(java.lang.String pattern)
#dump()
with a provided output stream to get the results to.pattern
- Only stack traces where the string representation of a
StackTraceElement
matches this regular expression will be counted.public FilteredStackProfiler(java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
#dump()
with a provided output stream to get the results to.filter
- Only stack traces where the predicate returns true
will be includedpublic FilteredStackProfiler(int pollIntervalInMs, java.lang.String pattern)
#dump()
with a provided output stream to get the results to.pollIntervalInMs
- frequency to check running threadspattern
- Only stack traces where the string representation of a
StackTraceElement
matches this regular expression will be counted.public FilteredStackProfiler(int pollIntervalInMs, java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
#dump()
with a provided output stream to get the results to.pollIntervalInMs
- frequency to check running threadsfilter
- Only stack traces where the predicate returns true
will be includedpublic FilteredStackProfiler(int pollIntervalInMs, java.util.function.Function<? super Profiler,java.lang.String> startFutureResultSupplier, java.lang.String pattern)
#dump()
with a provided output stream to get the results to.
This constructor allows you to change the behavior of the ListenableFuture
result when
Profiler.start(long)
or Profiler.start(Executor, long)
is used. Generally this will provide
the complete result of Profiler.dump()
. This can be replaced with calling
Profiler.dump(OutputStream, boolean, int)
with parameters to reduce the output, or even
null
so long as the consumers of the future can handle a null result.
pollIntervalInMs
- frequency to check running threadsstartFutureResultSupplier
- Supplier to be used for providing future resultspattern
- Only stack traces where the string representation of a
StackTraceElement
matches this regular expression will be counted.public FilteredStackProfiler(int pollIntervalInMs, java.util.function.Function<? super Profiler,java.lang.String> startFutureResultSupplier, java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
#dump()
with a provided output stream to get the results to.
This constructor allows you to change the behavior of the ListenableFuture
result when
Profiler.start(long)
or Profiler.start(Executor, long)
is used. Generally this will provide
the complete result of Profiler.dump()
. This can be replaced with calling
Profiler.dump(OutputStream, boolean, int)
with parameters to reduce the output, or even
null
so long as the consumers of the future can handle a null result.
pollIntervalInMs
- frequency to check running threadsstartFutureResultSupplier
- Supplier to be used for providing future resultsfilter
- Only stack traces where the predicate returns true
will be included