Mercurial > hg > graal-compiler
comparison src/share/vm/services/memTracker.hpp @ 7971:4102b59539ce
8005012: Add WB APIs to better support NMT testing
Summary: Add WB API functions to enable better NMT testing
Reviewed-by: dholmes, zgu
author | ctornqvi |
---|---|
date | Fri, 01 Feb 2013 23:48:08 +0100 |
parents | ecd24264898b |
children | 06db4c0afbf3 |
comparison
equal
deleted
inserted
replaced
7962:4c75576d18d0 | 7971:4102b59539ce |
---|---|
89 static bool print_memory_usage(BaselineOutputer& out, size_t unit, | 89 static bool print_memory_usage(BaselineOutputer& out, size_t unit, |
90 bool summary_only = true) { } | 90 bool summary_only = true) { } |
91 static bool compare_memory_usage(BaselineOutputer& out, size_t unit, | 91 static bool compare_memory_usage(BaselineOutputer& out, size_t unit, |
92 bool summary_only = true) { } | 92 bool summary_only = true) { } |
93 | 93 |
94 static bool wbtest_wait_for_data_merge() { } | |
95 | |
94 static inline void sync() { } | 96 static inline void sync() { } |
95 static inline void thread_exiting(JavaThread* thread) { } | 97 static inline void thread_exiting(JavaThread* thread) { } |
96 | |
97 }; | 98 }; |
98 | 99 |
99 | 100 |
100 #else // !INCLUDE_NMT | 101 #else // !INCLUDE_NMT |
101 | 102 |
108 #include "services/memRecorder.hpp" | 109 #include "services/memRecorder.hpp" |
109 #include "services/memSnapshot.hpp" | 110 #include "services/memSnapshot.hpp" |
110 #include "services/memTrackWorker.hpp" | 111 #include "services/memTrackWorker.hpp" |
111 | 112 |
112 extern bool NMT_track_callsite; | 113 extern bool NMT_track_callsite; |
114 | |
115 #ifndef MAX_UNSIGNED_LONG | |
116 #define MAX_UNSIGNED_LONG (unsigned long)(-1) | |
117 #endif | |
113 | 118 |
114 #ifdef ASSERT | 119 #ifdef ASSERT |
115 #define DEBUG_CALLER_PC (NMT_track_callsite ? os::get_caller_pc(2) : 0) | 120 #define DEBUG_CALLER_PC (NMT_track_callsite ? os::get_caller_pc(2) : 0) |
116 #else | 121 #else |
117 #define DEBUG_CALLER_PC 0 | 122 #define DEBUG_CALLER_PC 0 |
378 bool summary_only = true); | 383 bool summary_only = true); |
379 // compare memory usage between current snapshot and baseline | 384 // compare memory usage between current snapshot and baseline |
380 static bool compare_memory_usage(BaselineOutputer& out, size_t unit, | 385 static bool compare_memory_usage(BaselineOutputer& out, size_t unit, |
381 bool summary_only = true); | 386 bool summary_only = true); |
382 | 387 |
388 // the version for whitebox testing support, it ensures that all memory | |
389 // activities before this method call, are reflected in the snapshot | |
390 // database. | |
391 static bool wbtest_wait_for_data_merge(); | |
392 | |
383 // sync is called within global safepoint to synchronize nmt data | 393 // sync is called within global safepoint to synchronize nmt data |
384 static void sync(); | 394 static void sync(); |
385 | 395 |
386 // called when a thread is about to exit | 396 // called when a thread is about to exit |
387 static void thread_exiting(JavaThread* thread); | 397 static void thread_exiting(JavaThread* thread); |
430 static void create_memory_record(address addr, MEMFLAGS type, | 440 static void create_memory_record(address addr, MEMFLAGS type, |
431 size_t size, address pc, Thread* thread); | 441 size_t size, address pc, Thread* thread); |
432 static void create_record_in_recorder(address addr, MEMFLAGS type, | 442 static void create_record_in_recorder(address addr, MEMFLAGS type, |
433 size_t size, address pc, JavaThread* thread); | 443 size_t size, address pc, JavaThread* thread); |
434 | 444 |
445 static void set_current_processing_generation(unsigned long generation) { | |
446 _worker_thread_idle = false; | |
447 _processing_generation = generation; | |
448 } | |
449 | |
450 static void report_worker_idle() { | |
451 _worker_thread_idle = true; | |
452 } | |
453 | |
435 private: | 454 private: |
436 // global memory snapshot | 455 // global memory snapshot |
437 static MemSnapshot* _snapshot; | 456 static MemSnapshot* _snapshot; |
438 | 457 |
439 // a memory baseline of snapshot | 458 // a memory baseline of snapshot |
481 | 500 |
482 // current nmt state | 501 // current nmt state |
483 static volatile enum NMTStates _state; | 502 static volatile enum NMTStates _state; |
484 // the reason for shutting down nmt | 503 // the reason for shutting down nmt |
485 static enum ShutdownReason _reason; | 504 static enum ShutdownReason _reason; |
505 // the generation that NMT is processing | |
506 static volatile unsigned long _processing_generation; | |
507 // although NMT is still procesing current generation, but | |
508 // there is not more recorder to process, set idle state | |
509 static volatile bool _worker_thread_idle; | |
486 }; | 510 }; |
487 | 511 |
488 #endif // !INCLUDE_NMT | 512 #endif // !INCLUDE_NMT |
489 | 513 |
490 #endif // SHARE_VM_SERVICES_MEM_TRACKER_HPP | 514 #endif // SHARE_VM_SERVICES_MEM_TRACKER_HPP |