8005012: Add WB APIs to better support NMT testing

Add WB API functions to enable better NMT testing

Reviewed-by: dholmes, zgu
This commit is contained in:
Christian Tornqvist 2013-02-01 23:48:08 +01:00
parent 4a1c674d5b
commit 111ddcc827
12 changed files with 171 additions and 14 deletions

View file

@ -91,9 +91,10 @@ class MemTracker : AllStatic {
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) { }
};
@ -111,6 +112,10 @@ class MemTracker : AllStatic {
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
@ -380,6 +385,11 @@ class MemTracker : AllStatic {
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();
@ -432,6 +442,15 @@ class MemTracker : AllStatic {
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;
@ -483,6 +502,11 @@ class MemTracker : AllStatic {
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