src/hotspot/share/runtime/thread.hpp
changeset 50785 d1b24f2ceca5
parent 50578 e2a7f431f65c
child 50858 2d3e99a72541
equal deleted inserted replaced
50784:57f5cba78093 50785:d1b24f2ceca5
    42 #include "runtime/park.hpp"
    42 #include "runtime/park.hpp"
    43 #include "runtime/safepoint.hpp"
    43 #include "runtime/safepoint.hpp"
    44 #include "runtime/stubRoutines.hpp"
    44 #include "runtime/stubRoutines.hpp"
    45 #include "runtime/threadHeapSampler.hpp"
    45 #include "runtime/threadHeapSampler.hpp"
    46 #include "runtime/threadLocalStorage.hpp"
    46 #include "runtime/threadLocalStorage.hpp"
       
    47 #include "runtime/threadStatisticalInfo.hpp"
    47 #include "runtime/unhandledOops.hpp"
    48 #include "runtime/unhandledOops.hpp"
    48 #include "utilities/align.hpp"
    49 #include "utilities/align.hpp"
    49 #include "utilities/exceptions.hpp"
    50 #include "utilities/exceptions.hpp"
    50 #include "utilities/macros.hpp"
    51 #include "utilities/macros.hpp"
    51 #ifdef ZERO
    52 #ifdef ZERO
   339   ThreadLocalAllocBuffer _tlab;                 // Thread-local eden
   340   ThreadLocalAllocBuffer _tlab;                 // Thread-local eden
   340   jlong _allocated_bytes;                       // Cumulative number of bytes allocated on
   341   jlong _allocated_bytes;                       // Cumulative number of bytes allocated on
   341                                                 // the Java heap
   342                                                 // the Java heap
   342   ThreadHeapSampler _heap_sampler;              // For use when sampling the memory.
   343   ThreadHeapSampler _heap_sampler;              // For use when sampling the memory.
   343 
   344 
       
   345   ThreadStatisticalInfo _statistical_info;      // Statistics about the thread
       
   346 
   344   JFR_ONLY(DEFINE_THREAD_LOCAL_FIELD_JFR;)      // Thread-local data for jfr
   347   JFR_ONLY(DEFINE_THREAD_LOCAL_FIELD_JFR;)      // Thread-local data for jfr
   345 
   348 
   346   int   _vm_operation_started_count;            // VM_Operation support
   349   int   _vm_operation_started_count;            // VM_Operation support
   347   int   _vm_operation_completed_count;          // VM_Operation support
   350   int   _vm_operation_completed_count;          // VM_Operation support
   348 
   351 
   519   void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
   522   void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
   520   inline jlong cooked_allocated_bytes();
   523   inline jlong cooked_allocated_bytes();
   521 
   524 
   522   ThreadHeapSampler& heap_sampler()     { return _heap_sampler; }
   525   ThreadHeapSampler& heap_sampler()     { return _heap_sampler; }
   523 
   526 
       
   527   ThreadStatisticalInfo& statistical_info() { return _statistical_info; }
       
   528 
   524   JFR_ONLY(DEFINE_THREAD_LOCAL_ACCESSOR_JFR;)
   529   JFR_ONLY(DEFINE_THREAD_LOCAL_ACCESSOR_JFR;)
   525 
   530 
   526   bool is_trace_suspend()               { return (_suspend_flags & _trace_flag) != 0; }
   531   bool is_trace_suspend()               { return (_suspend_flags & _trace_flag) != 0; }
   527 
   532 
   528   // VM operation support
   533   // VM operation support
   636 
   641 
   637   int     lgrp_id() const        { return _lgrp_id; }
   642   int     lgrp_id() const        { return _lgrp_id; }
   638   void    set_lgrp_id(int value) { _lgrp_id = value; }
   643   void    set_lgrp_id(int value) { _lgrp_id = value; }
   639 
   644 
   640   // Printing
   645   // Printing
   641   virtual void print_on(outputStream* st) const;
   646   void print_on(outputStream* st, bool print_extended_info) const;
       
   647   virtual void print_on(outputStream* st) const { print_on(st, false); }
   642   void print() const { print_on(tty); }
   648   void print() const { print_on(tty); }
   643   virtual void print_on_error(outputStream* st, char* buf, int buflen) const;
   649   virtual void print_on_error(outputStream* st, char* buf, int buflen) const;
   644   void print_value_on(outputStream* st) const;
   650   void print_value_on(outputStream* st) const;
   645 
   651 
   646   // Debug-only code
   652   // Debug-only code
  1757   // RedefineClasses Support
  1763   // RedefineClasses Support
  1758   void metadata_do(void f(Metadata*));
  1764   void metadata_do(void f(Metadata*));
  1759 
  1765 
  1760   // Misc. operations
  1766   // Misc. operations
  1761   char* name() const { return (char*)get_thread_name(); }
  1767   char* name() const { return (char*)get_thread_name(); }
  1762   void print_on(outputStream* st) const;
  1768   void print_on(outputStream* st, bool print_extended_info) const;
       
  1769   void print_on(outputStream* st) const { print_on(st, false); }
  1763   void print_value();
  1770   void print_value();
  1764   void print_thread_state_on(outputStream*) const      PRODUCT_RETURN;
  1771   void print_thread_state_on(outputStream*) const      PRODUCT_RETURN;
  1765   void print_thread_state() const                      PRODUCT_RETURN;
  1772   void print_thread_state() const                      PRODUCT_RETURN;
  1766   void print_on_error(outputStream* st, char* buf, int buflen) const;
  1773   void print_on_error(outputStream* st, char* buf, int buflen) const;
  1767   void print_name_on_error(outputStream* st, char* buf, int buflen) const;
  1774   void print_name_on_error(outputStream* st, char* buf, int buflen) const;
  2171   static bool is_vm_complete() { return _vm_complete; }
  2178   static bool is_vm_complete() { return _vm_complete; }
  2172 #endif
  2179 #endif
  2173 
  2180 
  2174   // Verification
  2181   // Verification
  2175   static void verify();
  2182   static void verify();
  2176   static void print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks);
  2183   static void print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks, bool print_extended_info);
  2177   static void print(bool print_stacks, bool internal_format) {
  2184   static void print(bool print_stacks, bool internal_format) {
  2178     // this function is only used by debug.cpp
  2185     // this function is only used by debug.cpp
  2179     print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */);
  2186     print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */, false /* simple format */);
  2180   }
  2187   }
  2181   static void print_on_error(outputStream* st, Thread* current, char* buf, int buflen);
  2188   static void print_on_error(outputStream* st, Thread* current, char* buf, int buflen);
  2182   static void print_on_error(Thread* this_thread, outputStream* st, Thread* current, char* buf,
  2189   static void print_on_error(Thread* this_thread, outputStream* st, Thread* current, char* buf,
  2183                              int buflen, bool* found_current);
  2190                              int buflen, bool* found_current);
  2184   static void print_threads_compiling(outputStream* st, char* buf, int buflen);
  2191   static void print_threads_compiling(outputStream* st, char* buf, int buflen);