< prev index next >
src/hotspot/share/gc/shared/taskTerminator.cpp
Print this page
rev 57897 : imported patch 8238220-rename-owsttaskterminator
rev 57898 : [mq]: 8238229-remove-tracespinning-code
*** 27,42 ****
#include "gc/shared/taskTerminator.hpp"
#include "gc/shared/taskqueue.hpp"
#include "logging/log.hpp"
- #ifdef TRACESPINNING
- uint TaskTerminator::_total_yields = 0;
- uint TaskTerminator::_total_spins = 0;
- uint TaskTerminator::_total_peeks = 0;
- #endif
-
TaskTerminator::TaskTerminator(uint n_threads, TaskQueueSetSuper* queue_set) :
_n_threads(n_threads),
_queue_set(queue_set),
_offered_termination(0),
_spin_master(NULL) {
--- 27,36 ----
*** 62,78 ****
void TaskTerminator::yield() {
assert(_offered_termination <= _n_threads, "Invariant");
os::naked_yield();
}
- #ifdef TRACESPINNING
- void TaskTerminator::print_termination_counts() {
- log_trace(gc, task)("TaskTerminator Yields: %u Spins: %u Peeks: %u",
- total_yields(), total_spins(), total_peeks());
- }
- #endif
-
void TaskTerminator::reset_for_reuse() {
if (_offered_termination != 0) {
assert(_offered_termination == _n_threads,
"Terminator may still be in use");
_offered_termination = 0;
--- 56,65 ----
*** 190,214 ****
// and reset the counts and starting limit.
if (hard_spin_count > WorkStealingSpinToYieldRatio) {
yield();
hard_spin_count = 0;
hard_spin_limit = hard_spin_start;
- #ifdef TRACESPINNING
- _total_yields++;
- #endif
} else {
// Hard spin this time
// Increase the hard spinning period but only up to a limit.
hard_spin_limit = MIN2(2*hard_spin_limit,
(uint) WorkStealingHardSpins);
for (uint j = 0; j < hard_spin_limit; j++) {
SpinPause();
}
hard_spin_count++;
- #ifdef TRACESPINNING
- _total_spins++;
- #endif
}
} else {
log_develop_trace(gc, task)("TaskTerminator::do_spin_master_work() thread " PTR_FORMAT " sleeps after %u yields",
p2i(Thread::current()), yield_count);
yield_count = 0;
--- 177,195 ----
*** 221,233 ****
} else {
return false;
}
}
- #ifdef TRACESPINNING
- _total_peeks++;
- #endif
size_t tasks = tasks_in_queue_set();
bool exit = exit_termination(tasks, terminator);
{
MonitorLocker locker(_blocker, Mutex::_no_safepoint_check_flag);
// Termination condition reached
--- 202,211 ----
< prev index next >