1.1 --- a/src/share/vm/runtime/safepoint.hpp Tue Mar 02 12:09:40 2010 -0800 1.2 +++ b/src/share/vm/runtime/safepoint.hpp Wed Mar 10 21:42:26 2010 -0800 1.3 @@ -65,6 +65,7 @@ 1.4 }; 1.5 1.6 typedef struct { 1.7 + float _time_stamp; // record when the current safepoint occurs in seconds 1.8 int _vmop_type; // type of VM operation triggers the safepoint 1.9 int _nof_total_threads; // total number of Java threads 1.10 int _nof_initial_running_threads; // total number of initially seen running threads 1.11 @@ -73,14 +74,14 @@ 1.12 int _nof_threads_hit_page_trap; // total number of threads hitting the page trap 1.13 jlong _time_to_spin; // total time in millis spent in spinning 1.14 jlong _time_to_wait_to_block; // total time in millis spent in waiting for to block 1.15 + jlong _time_to_do_cleanups; // total time in millis spent in performing cleanups 1.16 jlong _time_to_sync; // total time in millis spent in getting to _synchronized 1.17 jlong _time_to_exec_vmop; // total time in millis spent in vm operation itself 1.18 - jlong _time_elapsed_since_last_safepoint; // time elasped since last safepoint 1.19 } SafepointStats; 1.20 1.21 private: 1.22 static volatile SynchronizeState _state; // Threads might read this flag directly, without acquireing the Threads_lock 1.23 - static volatile int _waiting_to_block; // No. of threads we are waiting for to block. 1.24 + static volatile int _waiting_to_block; // number of threads we are waiting for to block 1.25 1.26 // This counter is used for fast versions of jni_Get<Primitive>Field. 1.27 // An even value means there is no ongoing safepoint operations. 1.28 @@ -91,19 +92,22 @@ 1.29 public: 1.30 static volatile int _safepoint_counter; 1.31 private: 1.32 - 1.33 - static jlong _last_safepoint; // Time of last safepoint 1.34 + static long _end_of_last_safepoint; // Time of last safepoint in milliseconds 1.35 1.36 // statistics 1.37 - static SafepointStats* _safepoint_stats; // array of SafepointStats struct 1.38 - static int _cur_stat_index; // current index to the above array 1.39 - static julong _safepoint_reasons[]; // safepoint count for each VM op 1.40 - static julong _coalesced_vmop_count;// coalesced vmop count 1.41 - static jlong _max_sync_time; // maximum sync time in nanos 1.42 + static jlong _safepoint_begin_time; // time when safepoint begins 1.43 + static SafepointStats* _safepoint_stats; // array of SafepointStats struct 1.44 + static int _cur_stat_index; // current index to the above array 1.45 + static julong _safepoint_reasons[]; // safepoint count for each VM op 1.46 + static julong _coalesced_vmop_count; // coalesced vmop count 1.47 + static jlong _max_sync_time; // maximum sync time in nanos 1.48 + static jlong _max_vmop_time; // maximum vm operation time in nanos 1.49 + static float _ts_of_current_safepoint; // time stamp of current safepoint in seconds 1.50 1.51 static void begin_statistics(int nof_threads, int nof_running); 1.52 static void update_statistics_on_spin_end(); 1.53 static void update_statistics_on_sync_end(jlong end_time); 1.54 + static void update_statistics_on_cleanup_end(jlong end_time); 1.55 static void end_statistics(jlong end_time); 1.56 static void print_statistics(); 1.57 inline static void inc_page_trap_count() { 1.58 @@ -140,7 +144,9 @@ 1.59 static void handle_polling_page_exception(JavaThread *thread); 1.60 1.61 // VM Thread interface for determining safepoint rate 1.62 - static long last_non_safepoint_interval() { return os::javaTimeMillis() - _last_safepoint; } 1.63 + static long last_non_safepoint_interval() { 1.64 + return os::javaTimeMillis() - _end_of_last_safepoint; 1.65 + } 1.66 static bool is_cleanup_needed(); 1.67 static void do_cleanup_tasks(); 1.68