< prev index next >

src/hotspot/share/services/threadService.hpp

Print this page

 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_SERVICES_THREADSERVICE_HPP
 26 #define SHARE_SERVICES_THREADSERVICE_HPP
 27 
 28 #include "classfile/classLoader.hpp"
 29 #include "classfile/javaClasses.hpp"
 30 #include "classfile/javaThreadStatus.hpp"
 31 #include "runtime/handles.hpp"
 32 #include "runtime/init.hpp"
 33 #include "runtime/javaThread.hpp"
 34 #include "runtime/objectMonitor.hpp"
 35 #include "runtime/perfData.hpp"
 36 #include "runtime/safepoint.hpp"
 37 #include "runtime/threadSMR.hpp"
 38 #include "services/management.hpp"
 39 
 40 class DeadlockCycle;
 41 class ObjectMonitorsHashtable;
 42 class OopClosure;
 43 class StackFrameInfo;
 44 class ThreadConcurrentLocks;
 45 class ThreadDumpResult;
 46 class ThreadSnapshot;
 47 class ThreadStackTrace;
 48 
 49 // VM monitoring and management support for the thread and
 50 // synchronization subsystem
 51 //
 52 // Thread contention monitoring is disabled by default.
 53 // When enabled, the VM will begin measuring the accumulated
 54 // elapsed time a thread blocked on synchronization.
 55 //
 56 class ThreadService : public AllStatic {
 57 private:
 58   // These counters could be moved to Threads class
 59   static PerfCounter*  _total_threads_count;
 60   static PerfVariable* _live_threads_count;
 61   static PerfVariable* _peak_threads_count;

247 
248   bool        is_suspended()              { return _is_suspended; }
249   bool        is_in_native()              { return _is_in_native; }
250 
251   jlong       contended_enter_count()     { return _contended_enter_count; }
252   jlong       contended_enter_ticks()     { return _contended_enter_ticks; }
253   jlong       monitor_wait_count()        { return _monitor_wait_count; }
254   jlong       monitor_wait_ticks()        { return _monitor_wait_ticks; }
255   jlong       sleep_count()               { return _sleep_count; }
256   jlong       sleep_ticks()               { return _sleep_ticks; }
257 
258 
259   oop         blocker_object() const;
260   oop         blocker_object_owner() const;
261 
262   ThreadSnapshot*   next() const          { return _next; }
263   ThreadStackTrace* get_stack_trace()     { return _stack_trace; }
264   ThreadConcurrentLocks* get_concurrent_locks()     { return _concurrent_locks; }
265 
266   void        dump_stack_at_safepoint(int max_depth, bool with_locked_monitors,
267                                       ObjectMonitorsHashtable* table, bool full);
268   void        set_concurrent_locks(ThreadConcurrentLocks* l) { _concurrent_locks = l; }
269   void        metadata_do(void f(Metadata*));
270 };
271 
272 class ThreadStackTrace : public CHeapObj<mtInternal> {
273  private:
274   JavaThread*                     _thread;
275   int                             _depth;  // number of stack frames added
276   bool                            _with_locked_monitors;
277   GrowableArray<StackFrameInfo*>* _frames;
278   GrowableArray<OopHandle>*       _jni_locked_monitors;
279 
280  public:
281 
282   ThreadStackTrace(JavaThread* thread, bool with_locked_monitors);
283   ~ThreadStackTrace();
284 
285   JavaThread*     thread()              { return _thread; }
286   StackFrameInfo* stack_frame_at(int i) { return _frames->at(i); }
287   int             get_stack_depth()     { return _depth; }
288 
289   void            add_stack_frame(javaVFrame* jvf);
290   void            dump_stack_at_safepoint(int max_depth, ObjectMonitorsHashtable* table, bool full);
291   Handle          allocate_fill_stack_trace_element_array(TRAPS);
292   void            metadata_do(void f(Metadata*));
293   GrowableArray<OopHandle>* jni_locked_monitors() { return _jni_locked_monitors; }
294   int             num_jni_locked_monitors() { return (_jni_locked_monitors != nullptr ? _jni_locked_monitors->length() : 0); }
295 
296   bool            is_owned_monitor_on_stack(oop object);
297   void            add_jni_locked_monitor(oop object);
298 };
299 
300 // StackFrameInfo for keeping Method* and bci during
301 // stack walking for later construction of StackTraceElement[]
302 // Java instances
303 class StackFrameInfo : public CHeapObj<mtInternal> {
304  private:
305   Method*             _method;
306   int                 _bci;
307   GrowableArray<OopHandle>* _locked_monitors; // list of object monitors locked by this frame
308   // We need to save the mirrors in the backtrace to keep the class
309   // from being unloaded while we still have this stack trace.
310   OopHandle           _class_holder;

 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_SERVICES_THREADSERVICE_HPP
 26 #define SHARE_SERVICES_THREADSERVICE_HPP
 27 
 28 #include "classfile/classLoader.hpp"
 29 #include "classfile/javaClasses.hpp"
 30 #include "classfile/javaThreadStatus.hpp"
 31 #include "runtime/handles.hpp"
 32 #include "runtime/init.hpp"
 33 #include "runtime/javaThread.hpp"
 34 #include "runtime/objectMonitor.hpp"
 35 #include "runtime/perfData.hpp"
 36 #include "runtime/safepoint.hpp"
 37 #include "runtime/threadSMR.hpp"
 38 #include "services/management.hpp"
 39 
 40 class DeadlockCycle;
 41 class ObjectMonitorsView;
 42 class OopClosure;
 43 class StackFrameInfo;
 44 class ThreadConcurrentLocks;
 45 class ThreadDumpResult;
 46 class ThreadSnapshot;
 47 class ThreadStackTrace;
 48 
 49 // VM monitoring and management support for the thread and
 50 // synchronization subsystem
 51 //
 52 // Thread contention monitoring is disabled by default.
 53 // When enabled, the VM will begin measuring the accumulated
 54 // elapsed time a thread blocked on synchronization.
 55 //
 56 class ThreadService : public AllStatic {
 57 private:
 58   // These counters could be moved to Threads class
 59   static PerfCounter*  _total_threads_count;
 60   static PerfVariable* _live_threads_count;
 61   static PerfVariable* _peak_threads_count;

247 
248   bool        is_suspended()              { return _is_suspended; }
249   bool        is_in_native()              { return _is_in_native; }
250 
251   jlong       contended_enter_count()     { return _contended_enter_count; }
252   jlong       contended_enter_ticks()     { return _contended_enter_ticks; }
253   jlong       monitor_wait_count()        { return _monitor_wait_count; }
254   jlong       monitor_wait_ticks()        { return _monitor_wait_ticks; }
255   jlong       sleep_count()               { return _sleep_count; }
256   jlong       sleep_ticks()               { return _sleep_ticks; }
257 
258 
259   oop         blocker_object() const;
260   oop         blocker_object_owner() const;
261 
262   ThreadSnapshot*   next() const          { return _next; }
263   ThreadStackTrace* get_stack_trace()     { return _stack_trace; }
264   ThreadConcurrentLocks* get_concurrent_locks()     { return _concurrent_locks; }
265 
266   void        dump_stack_at_safepoint(int max_depth, bool with_locked_monitors,
267                                       ObjectMonitorsView* monitors, bool full);
268   void        set_concurrent_locks(ThreadConcurrentLocks* l) { _concurrent_locks = l; }
269   void        metadata_do(void f(Metadata*));
270 };
271 
272 class ThreadStackTrace : public CHeapObj<mtInternal> {
273  private:
274   JavaThread*                     _thread;
275   int                             _depth;  // number of stack frames added
276   bool                            _with_locked_monitors;
277   GrowableArray<StackFrameInfo*>* _frames;
278   GrowableArray<OopHandle>*       _jni_locked_monitors;
279 
280  public:
281 
282   ThreadStackTrace(JavaThread* thread, bool with_locked_monitors);
283   ~ThreadStackTrace();
284 
285   JavaThread*     thread()              { return _thread; }
286   StackFrameInfo* stack_frame_at(int i) { return _frames->at(i); }
287   int             get_stack_depth()     { return _depth; }
288 
289   void            add_stack_frame(javaVFrame* jvf);
290   void            dump_stack_at_safepoint(int max_depth, ObjectMonitorsView* monitors, bool full);
291   Handle          allocate_fill_stack_trace_element_array(TRAPS);
292   void            metadata_do(void f(Metadata*));
293   GrowableArray<OopHandle>* jni_locked_monitors() { return _jni_locked_monitors; }
294   int             num_jni_locked_monitors() { return (_jni_locked_monitors != nullptr ? _jni_locked_monitors->length() : 0); }
295 
296   bool            is_owned_monitor_on_stack(oop object);
297   void            add_jni_locked_monitor(oop object);
298 };
299 
300 // StackFrameInfo for keeping Method* and bci during
301 // stack walking for later construction of StackTraceElement[]
302 // Java instances
303 class StackFrameInfo : public CHeapObj<mtInternal> {
304  private:
305   Method*             _method;
306   int                 _bci;
307   GrowableArray<OopHandle>* _locked_monitors; // list of object monitors locked by this frame
308   // We need to save the mirrors in the backtrace to keep the class
309   // from being unloaded while we still have this stack trace.
310   OopHandle           _class_holder;
< prev index next >