Class FilteredStackProfiler
- java.lang.Object
-
- org.threadly.util.debug.Profiler
-
- org.threadly.util.debug.FilteredStackProfiler
-
public class FilteredStackProfiler extends Profiler
This class functions very similar to theProfiler
. 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.
- Since:
- 5.35
-
-
Constructor Summary
Constructors Constructor Description FilteredStackProfiler(int pollIntervalInMs, java.lang.String pattern)
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.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.Predicate<java.lang.StackTraceElement[]> filter)
Constructs a new profiler instance.FilteredStackProfiler(java.lang.String pattern)
Constructs a new profiler instance.FilteredStackProfiler(java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
Constructs a new profiler instance.
-
-
-
Constructor Detail
-
FilteredStackProfiler
public FilteredStackProfiler(java.lang.String pattern)
Constructs a new profiler instance. The only way to get results from this instance is to call#dump()
with a provided output stream to get the results to.- Parameters:
pattern
- Only stack traces where the string representation of aStackTraceElement
matches this regular expression will be counted.
-
FilteredStackProfiler
public FilteredStackProfiler(java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
Constructs a new profiler instance. The only way to get results from this instance is to call#dump()
with a provided output stream to get the results to.- Parameters:
filter
- Only stack traces where the predicate returnstrue
will be included
-
FilteredStackProfiler
public FilteredStackProfiler(int pollIntervalInMs, java.lang.String pattern)
Constructs a new profiler instance. The only way to get results from this instance is to call#dump()
with a provided output stream to get the results to.- Parameters:
pollIntervalInMs
- frequency to check running threadspattern
- Only stack traces where the string representation of aStackTraceElement
matches this regular expression will be counted.
-
FilteredStackProfiler
public FilteredStackProfiler(int pollIntervalInMs, java.util.function.Predicate<java.lang.StackTraceElement[]> filter)
Constructs a new profiler instance. The only way to get results from this instance is to call#dump()
with a provided output stream to get the results to.- Parameters:
pollIntervalInMs
- frequency to check running threadsfilter
- Only stack traces where the predicate returnstrue
will be included
-
FilteredStackProfiler
public FilteredStackProfiler(int pollIntervalInMs, java.util.function.Function<? super Profiler,java.lang.String> startFutureResultSupplier, java.lang.String pattern)
Constructs a new profiler instance. The only way to get results from this instance is to call#dump()
with a provided output stream to get the results to.This constructor allows you to change the behavior of the
ListenableFuture
result whenProfiler.start(long)
orProfiler.start(Executor, long)
is used. Generally this will provide the complete result ofProfiler.dump()
. This can be replaced with callingProfiler.dump(OutputStream, boolean, int)
with parameters to reduce the output, or evennull
so long as the consumers of the future can handle a null result.- Parameters:
pollIntervalInMs
- frequency to check running threadsstartFutureResultSupplier
- Supplier to be used for providing future resultspattern
- Only stack traces where the string representation of aStackTraceElement
matches this regular expression will be counted.
-
FilteredStackProfiler
public 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. The only way to get results from this instance is to call#dump()
with a provided output stream to get the results to.This constructor allows you to change the behavior of the
ListenableFuture
result whenProfiler.start(long)
orProfiler.start(Executor, long)
is used. Generally this will provide the complete result ofProfiler.dump()
. This can be replaced with callingProfiler.dump(OutputStream, boolean, int)
with parameters to reduce the output, or evennull
so long as the consumers of the future can handle a null result.- Parameters:
pollIntervalInMs
- frequency to check running threadsstartFutureResultSupplier
- Supplier to be used for providing future resultsfilter
- Only stack traces where the predicate returnstrue
will be included
-
-