@ApplicationScoped @Named(value="profiler") public class Profiler extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
protected List<ThreadProfile> |
activeThreads
Current active threads
|
protected List<ThreadProfile> |
completedThreads
Completed threads that exceed the max. time expected.
|
protected boolean |
completedThreadsErrorsEnabled
Flag indicating whether threads that ends with errors should be added to the thread registry.
|
protected ThreadProfileFilter |
completedThreadsFilter
Filter that a completed thread must satisfy in order to be added to the registry.
|
protected int |
completedThreadsMaxSize
Maximum number of completed threads to keep into the registry.
|
protected long |
completedThreadsMinTimeMillis
Save as completed only the threads which execution exceeds a maximum amount of time.
|
protected ThreadLocal<ThreadProfile> |
currentThreadProfile
The thread profile for the current thread.
|
protected long |
idleTimeInMillis
Amount of time in milliseconds the profile will remain idle between two consecutive profiling snapshots.
|
protected LowMemoryConstraints |
lowMemoryConstraints
Low memory runtime constraints are always added to the root trace of every thread profile
in order to ensure the system never runs out of memory.
|
protected long |
maxThreadProfilingTimeMillis
If a thread's execution time overtake a specified amount of time then the profiler will automatically stop getting profiling data for such thread,
Normally, the data obtained by the profiler until that moment will be enough to determine the thread's performance problem.
|
protected int |
maxThreadStackTraceLength
If a thread's stack trace length overtake at any moment a specified limit then the profiler will stop getting profiling data for such thread,
Normally, the data obtained by the profiler until that moment will be enough to determine the thread's performance problem.
|
protected long |
minCodeTraceTimeMillis
The minimum required time length in milliseconds for a code trace to be saved by the profiler.
|
protected Thread |
profilerThread
The profiler thread.
|
protected boolean |
running
The profiler thread status flag.
|
protected boolean |
runOnStart
Switch on the profiler on start.
|
Constructor and Description |
---|
Profiler() |
@Inject protected long idleTimeInMillis
@Inject protected boolean runOnStart
@Inject protected long maxThreadProfilingTimeMillis
@Inject protected int maxThreadStackTraceLength
@Inject protected long minCodeTraceTimeMillis
@Inject protected int completedThreadsMaxSize
@Inject protected long completedThreadsMinTimeMillis
@Inject protected boolean completedThreadsErrorsEnabled
protected Thread profilerThread
protected transient boolean running
protected List<ThreadProfile> activeThreads
protected List<ThreadProfile> completedThreads
protected ThreadProfileFilter completedThreadsFilter
protected ThreadLocal<ThreadProfile> currentThreadProfile
@Inject protected LowMemoryConstraints lowMemoryConstraints
public static Profiler lookup()
public boolean isRunOnStart()
public void setRunOnStart(boolean runOnStart)
public long getIdleTimeInMillis()
public void setIdleTimeInMillis(long idleTimeInMillis)
public long getMaxThreadProfilingTimeMillis()
public void setMaxThreadProfilingTimeMillis(long maxThreadProfilingTimeMillis)
public int getMaxThreadStackTraceLength()
public void setMaxThreadStackTraceLength(int maxThreadStackTraceLength)
public int getCompletedThreadsMaxSize()
public void setCompletedThreadsMaxSize(int completedThreadsMaxSize)
public boolean isCompletedThreadsErrorsEnabled()
public void setCompletedThreadsErrorsEnabled(boolean completedThreadsErrorsEnabled)
public long getMinCodeTraceTimeMillis()
public void setMinCodeTraceTimeMillis(long minCodeTraceTimeMillis)
public ThreadProfileFilter getCompletedThreadsFilter()
public void setCompletedThreadsFilter(ThreadProfileFilter completedThreadsFilter)
@PostConstruct public void start()
@PreDestroy public void shutdown()
public void turnOn()
public void turnOff()
public boolean isRunning()
protected void dumpStackTraces()
public void removeAllThreads()
public void removeThread(ThreadProfile tp)
public long getCompletedThreadsMinTimeMillis()
public void setCompletedThreadsMinTimeMillis(long completedThreadsMinTimeMillis)
public ThreadProfile createThreadProfile()
public ThreadProfile beginThreadProfile()
public ThreadProfile finishThreadProfile()
public ThreadProfile getCurrentThreadProfile()
public List<ThreadProfile> getActiveThreads()
public List<ThreadProfile> getCompletedThreads()
public List<ThreadProfile> getAllThreads()
public List<ThreadProfile> getFilteredThreads()
public ThreadProfile getThreadProfile(int hash)
public String printThreadsSummaryReport()
public String printActiveThreadsReport()
public String printCompletedThreadsReport(long ignoreTracesMillis, boolean showContext)
protected String getSubjectPrefix()
protected StringBuffer appendErrorReport(StringBuffer buffer, ErrorReport error)
protected StringBuffer appendThreadContext(StringBuffer buffer, ThreadProfile tp)
protected StringBuffer appendServerSettings(StringBuffer buffer)
protected StringBuffer appendCopyright(StringBuffer buffer)
Copyright © 2012–2017 JBoss by Red Hat. All rights reserved.