src/share/vm/services/memTracker.hpp

Print this page
rev 3901 : JDK-8005012: Add WB APIs to better support NMT testing
Summary:

@@ -89,13 +89,14 @@
    static bool print_memory_usage(BaselineOutputer& out, size_t unit,
             bool summary_only = true) { }
    static bool compare_memory_usage(BaselineOutputer& out, size_t unit,
             bool summary_only = true) { }
 
+   static bool wbtest_wait_for_data_merge() { }
+
    static inline void sync() { }
    static inline void thread_exiting(JavaThread* thread) { }
-
 };
 
 
 #else // !INCLUDE_NMT
 

@@ -109,10 +110,14 @@
 #include "services/memSnapshot.hpp"
 #include "services/memTrackWorker.hpp"
 
 extern bool NMT_track_callsite;
 
+#ifndef MAX_UNSIGNED_LONG
+#define MAX_UNSIGNED_LONG    (unsigned long)(-1)
+#endif
+
 #ifdef ASSERT
   #define DEBUG_CALLER_PC  (NMT_track_callsite ? os::get_caller_pc(2) : 0)
 #else
   #define DEBUG_CALLER_PC  0
 #endif

@@ -377,10 +382,15 @@
            bool summary_only = true);
   // compare memory usage between current snapshot and baseline
   static bool compare_memory_usage(BaselineOutputer& out, size_t unit,
            bool summary_only = true);
 
+  // the version for whitebox testing support, it ensures that all memory
+  // activities before this method call, are reflected in the snapshot
+  // database.
+  static bool wbtest_wait_for_data_merge();
+
   // sync is called within global safepoint to synchronize nmt data
   static void sync();
 
   // called when a thread is about to exit
   static void thread_exiting(JavaThread* thread);

@@ -429,10 +439,19 @@
   static void create_memory_record(address addr, MEMFLAGS type,
                    size_t size, address pc, Thread* thread);
   static void create_record_in_recorder(address addr, MEMFLAGS type,
                    size_t size, address pc, JavaThread* thread);
 
+  static void set_current_processing_generation(unsigned long generation) {
+    _worker_thread_idle = false;
+    _processing_generation = generation;
+  }
+
+  static void report_worker_idle() {
+    _worker_thread_idle = true;
+  }
+
  private:
   // global memory snapshot
   static MemSnapshot*     _snapshot;
 
   // a memory baseline of snapshot

@@ -480,10 +499,15 @@
 
   // current nmt state
   static volatile enum NMTStates   _state;
   // the reason for shutting down nmt
   static enum ShutdownReason       _reason;
+  // the generation that NMT is processing
+  static volatile unsigned long    _processing_generation;
+  // although NMT is still procesing current generation, but
+  // there is not more recorder to process, set idle state
+  static volatile bool             _worker_thread_idle;
 };
 
 #endif // !INCLUDE_NMT
 
 #endif // SHARE_VM_SERVICES_MEM_TRACKER_HPP