Dashboard Builder Commons 6.1.0.CR1

org.jboss.dashboard.profiler
Class Profiler

java.lang.Object
  extended by org.jboss.dashboard.profiler.Profiler
All Implemented Interfaces:
Runnable

@ApplicationScoped
@Named(value="profiler")
public class Profiler
extends Object
implements Runnable

The profiler keeps track of threads execution with the following goals in mind:


Field Summary
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 Summary
Profiler()
           
 
Method Summary
protected  StringBuffer appendCopyright(StringBuffer buffer)
           
protected  StringBuffer appendErrorReport(StringBuffer buffer, ErrorReport error)
           
protected  StringBuffer appendServerSettings(StringBuffer buffer)
           
protected  StringBuffer appendThreadContext(StringBuffer buffer, ThreadProfile tp)
           
 ThreadProfile beginThreadProfile()
           
 ThreadProfile createThreadProfile()
           
protected  void dumpStackTraces()
           
 ThreadProfile finishThreadProfile()
           
 List<ThreadProfile> getActiveThreads()
           
 List<ThreadProfile> getAllThreads()
           
 List<ThreadProfile> getCompletedThreads()
           
 ThreadProfileFilter getCompletedThreadsFilter()
           
 int getCompletedThreadsMaxSize()
           
 long getCompletedThreadsMinTimeMillis()
           
 ThreadProfile getCurrentThreadProfile()
           
 List<ThreadProfile> getFilteredThreads()
           
 long getIdleTimeInMillis()
           
 long getMaxThreadProfilingTimeMillis()
           
 int getMaxThreadStackTraceLength()
           
 long getMinCodeTraceTimeMillis()
           
protected  String getSubjectPrefix()
           
 ThreadProfile getThreadProfile(int hash)
           
 boolean isCompletedThreadsErrorsEnabled()
           
 boolean isRunning()
           
 boolean isRunOnStart()
           
static Profiler lookup()
           
 String printActiveThreadsReport()
           
 String printCompletedThreadsReport(long ignoreTracesMillis, boolean showContext)
           
 String printThreadsSummaryReport()
           
 void removeAllThreads()
           
 void removeThread(ThreadProfile tp)
           
 void run()
           
 void setCompletedThreadsErrorsEnabled(boolean completedThreadsErrorsEnabled)
           
 void setCompletedThreadsFilter(ThreadProfileFilter completedThreadsFilter)
           
 void setCompletedThreadsMaxSize(int completedThreadsMaxSize)
           
 void setCompletedThreadsMinTimeMillis(long completedThreadsMinTimeMillis)
           
 void setIdleTimeInMillis(long idleTimeInMillis)
           
 void setMaxThreadProfilingTimeMillis(long maxThreadProfilingTimeMillis)
           
 void setMaxThreadStackTraceLength(int maxThreadStackTraceLength)
           
 void setMinCodeTraceTimeMillis(long minCodeTraceTimeMillis)
           
 void setRunOnStart(boolean runOnStart)
           
 void shutdown()
           
 void start()
           
 void turnOff()
           
 void turnOn()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idleTimeInMillis

@Inject
protected long idleTimeInMillis
Amount of time in milliseconds the profile will remain idle between two consecutive profiling snapshots.


runOnStart

@Inject
protected boolean runOnStart
Switch on the profiler on start.


maxThreadProfilingTimeMillis

@Inject
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.


maxThreadStackTraceLength

@Inject
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. This property is very useful to detect and protect the profiler against threads that perform uncontrolled recursive calls.


minCodeTraceTimeMillis

@Inject
protected long minCodeTraceTimeMillis
The minimum required time length in milliseconds for a code trace to be saved by the profiler.


completedThreadsMaxSize

@Inject
protected int completedThreadsMaxSize
Maximum number of completed threads to keep into the registry.


completedThreadsMinTimeMillis

@Inject
protected long completedThreadsMinTimeMillis
Save as completed only the threads which execution exceeds a maximum amount of time.


completedThreadsErrorsEnabled

@Inject
protected boolean completedThreadsErrorsEnabled
Flag indicating whether threads that ends with errors should be added to the thread registry.


profilerThread

protected Thread profilerThread
The profiler thread.


running

protected transient boolean running
The profiler thread status flag.


activeThreads

protected List<ThreadProfile> activeThreads
Current active threads


completedThreads

protected List<ThreadProfile> completedThreads
Completed threads that exceed the max. time expected.


completedThreadsFilter

protected ThreadProfileFilter completedThreadsFilter
Filter that a completed thread must satisfy in order to be added to the registry.


currentThreadProfile

protected ThreadLocal<ThreadProfile> currentThreadProfile
The thread profile for the current thread.


lowMemoryConstraints

@Inject
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.

Constructor Detail

Profiler

public Profiler()
Method Detail

lookup

public static Profiler lookup()

isRunOnStart

public boolean isRunOnStart()

setRunOnStart

public void setRunOnStart(boolean runOnStart)

getIdleTimeInMillis

public long getIdleTimeInMillis()

setIdleTimeInMillis

public void setIdleTimeInMillis(long idleTimeInMillis)

getMaxThreadProfilingTimeMillis

public long getMaxThreadProfilingTimeMillis()

setMaxThreadProfilingTimeMillis

public void setMaxThreadProfilingTimeMillis(long maxThreadProfilingTimeMillis)

getMaxThreadStackTraceLength

public int getMaxThreadStackTraceLength()

setMaxThreadStackTraceLength

public void setMaxThreadStackTraceLength(int maxThreadStackTraceLength)

getCompletedThreadsMaxSize

public int getCompletedThreadsMaxSize()

setCompletedThreadsMaxSize

public void setCompletedThreadsMaxSize(int completedThreadsMaxSize)

isCompletedThreadsErrorsEnabled

public boolean isCompletedThreadsErrorsEnabled()

setCompletedThreadsErrorsEnabled

public void setCompletedThreadsErrorsEnabled(boolean completedThreadsErrorsEnabled)

getMinCodeTraceTimeMillis

public long getMinCodeTraceTimeMillis()

setMinCodeTraceTimeMillis

public void setMinCodeTraceTimeMillis(long minCodeTraceTimeMillis)

getCompletedThreadsFilter

public ThreadProfileFilter getCompletedThreadsFilter()

setCompletedThreadsFilter

public void setCompletedThreadsFilter(ThreadProfileFilter completedThreadsFilter)

start

@PostConstruct
public void start()

shutdown

@PreDestroy
public void shutdown()

turnOn

public void turnOn()

turnOff

public void turnOff()

isRunning

public boolean isRunning()

run

public void run()
Specified by:
run in interface Runnable

dumpStackTraces

protected void dumpStackTraces()

removeAllThreads

public void removeAllThreads()

removeThread

public void removeThread(ThreadProfile tp)

getCompletedThreadsMinTimeMillis

public long getCompletedThreadsMinTimeMillis()

setCompletedThreadsMinTimeMillis

public void setCompletedThreadsMinTimeMillis(long completedThreadsMinTimeMillis)

createThreadProfile

public ThreadProfile createThreadProfile()

beginThreadProfile

public ThreadProfile beginThreadProfile()

finishThreadProfile

public ThreadProfile finishThreadProfile()

getCurrentThreadProfile

public ThreadProfile getCurrentThreadProfile()

getActiveThreads

public List<ThreadProfile> getActiveThreads()

getCompletedThreads

public List<ThreadProfile> getCompletedThreads()

getAllThreads

public List<ThreadProfile> getAllThreads()

getFilteredThreads

public List<ThreadProfile> getFilteredThreads()

getThreadProfile

public ThreadProfile getThreadProfile(int hash)

printThreadsSummaryReport

public String printThreadsSummaryReport()

printActiveThreadsReport

public String printActiveThreadsReport()

printCompletedThreadsReport

public String printCompletedThreadsReport(long ignoreTracesMillis,
                                          boolean showContext)

getSubjectPrefix

protected String getSubjectPrefix()

appendErrorReport

protected StringBuffer appendErrorReport(StringBuffer buffer,
                                         ErrorReport error)

appendThreadContext

protected StringBuffer appendThreadContext(StringBuffer buffer,
                                           ThreadProfile tp)

appendServerSettings

protected StringBuffer appendServerSettings(StringBuffer buffer)

appendCopyright

protected StringBuffer appendCopyright(StringBuffer buffer)

Dashboard Builder Commons 6.1.0.CR1

Copyright © 2012-2014 JBoss by Red Hat. All Rights Reserved.