--- a/src/hotspot/share/runtime/task.cpp Thu Feb 14 01:25:04 2019 +0100
+++ b/src/hotspot/share/runtime/task.cpp Thu Feb 14 11:33:45 2019 +0100
@@ -31,48 +31,20 @@
int PeriodicTask::_num_tasks = 0;
PeriodicTask* PeriodicTask::_tasks[PeriodicTask::max_tasks];
-#ifndef PRODUCT
-elapsedTimer PeriodicTask::_timer;
-int PeriodicTask::_intervalHistogram[PeriodicTask::max_interval];
-int PeriodicTask::_ticks;
-
-void PeriodicTask::print_intervals() {
- if (ProfilerCheckIntervals) {
- for (int i = 0; i < PeriodicTask::max_interval; i++) {
- int n = _intervalHistogram[i];
- if (n > 0) tty->print_cr("%3d: %5d (%4.1f%%)", i, n, 100.0 * n / _ticks);
- }
- }
-}
-#endif
void PeriodicTask::real_time_tick(int delay_time) {
assert(Thread::current()->is_Watcher_thread(), "must be WatcherThread");
-#ifndef PRODUCT
- if (ProfilerCheckIntervals) {
- _ticks++;
- _timer.stop();
- int ms = (int)_timer.milliseconds();
- _timer.reset();
- _timer.start();
- if (ms >= PeriodicTask::max_interval) ms = PeriodicTask::max_interval - 1;
- _intervalHistogram[ms]++;
- }
-#endif
+ // The WatcherThread does not participate in the safepoint protocol
+ // for the PeriodicTask_lock because it is not a JavaThread.
+ MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+ int orig_num_tasks = _num_tasks;
- {
- // The WatcherThread does not participate in the safepoint protocol
- // for the PeriodicTask_lock because it is not a JavaThread.
- MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
- int orig_num_tasks = _num_tasks;
-
- for(int index = 0; index < _num_tasks; index++) {
- _tasks[index]->execute_if_pending(delay_time);
- if (_num_tasks < orig_num_tasks) { // task dis-enrolled itself
- index--; // re-do current slot as it has changed
- orig_num_tasks = _num_tasks;
- }
+ for(int index = 0; index < _num_tasks; index++) {
+ _tasks[index]->execute_if_pending(delay_time);
+ if (_num_tasks < orig_num_tasks) { // task dis-enrolled itself
+ index--; // re-do current slot as it has changed
+ orig_num_tasks = _num_tasks;
}
}
}