< prev index next >

src/share/vm/gc/parallel/gcTaskManager.cpp

Print this page
rev 11508 : 8157240: GC task trace logging is incomprehensible
Reviewed-by: tschatzl
rev 11509 : imported patch code_review2


 369 
 370 //
 371 // GCTaskManager
 372 //
 373 GCTaskManager::GCTaskManager(uint workers) :
 374   _workers(workers),
 375   _active_workers(0),
 376   _idle_workers(0),
 377   _created_workers(0) {
 378   initialize();
 379 }
 380 
 381 GCTaskThread* GCTaskManager::install_worker(uint t) {
 382   GCTaskThread* new_worker = GCTaskThread::create(this, t, _processor_assignment[t]);
 383   set_thread(t, new_worker);
 384   return new_worker;
 385 }
 386 
 387 void GCTaskManager::add_workers(bool initializing) {
 388   os::ThreadType worker_type = os::pgc_thread;


 389   _created_workers = WorkerManager::add_workers(this,
 390                                                 _active_workers,
 391                                                 (uint) _workers,
 392                                                 _created_workers,
 393                                                 worker_type,
 394                                                 initializing);
 395   _active_workers = MIN2(_created_workers, _active_workers);






 396 }
 397 
 398 void GCTaskManager::initialize() {
 399   if (TraceGCTaskManager) {
 400     tty->print_cr("GCTaskManager::initialize: workers: %u", workers());
 401   }
 402   assert(workers() != 0, "no workers");
 403   _monitor = new Monitor(Mutex::barrier,                // rank
 404                          "GCTaskManager monitor",       // name
 405                          Mutex::_allow_vm_block_flag,   // allow_vm_block
 406                          Monitor::_safepoint_check_never);
 407   // The queue for the GCTaskManager must be a CHeapObj.
 408   GCTaskQueue* unsynchronized_queue = GCTaskQueue::create_on_c_heap();
 409   _queue = SynchronizedGCTaskQueue::create(unsynchronized_queue, lock());
 410   _noop_task = NoopGCTask::create_on_c_heap();
 411   _resource_flag = NEW_C_HEAP_ARRAY(bool, workers(), mtGC);
 412   {
 413     // Set up worker threads.
 414     //     Distribute the workers among the available processors,
 415     //     unless we were told not to, or if the os doesn't want to.




 369 
 370 //
 371 // GCTaskManager
 372 //
 373 GCTaskManager::GCTaskManager(uint workers) :
 374   _workers(workers),
 375   _active_workers(0),
 376   _idle_workers(0),
 377   _created_workers(0) {
 378   initialize();
 379 }
 380 
 381 GCTaskThread* GCTaskManager::install_worker(uint t) {
 382   GCTaskThread* new_worker = GCTaskThread::create(this, t, _processor_assignment[t]);
 383   set_thread(t, new_worker);
 384   return new_worker;
 385 }
 386 
 387 void GCTaskManager::add_workers(bool initializing) {
 388   os::ThreadType worker_type = os::pgc_thread;
 389   uint previous_created_workers = _created_workers;
 390 
 391   _created_workers = WorkerManager::add_workers(this,
 392                                                 _active_workers,
 393                                                 _workers,
 394                                                 _created_workers,
 395                                                 worker_type,
 396                                                 initializing);
 397   _active_workers = MIN2(_created_workers, _active_workers);
 398 
 399   WorkerManager::log_worker_creation(this, previous_created_workers, _active_workers, _created_workers, initializing);
 400 }
 401 
 402 const char* GCTaskManager::group_name() {
 403   return "ParGC Thread";
 404 }
 405 
 406 void GCTaskManager::initialize() {
 407   if (TraceGCTaskManager) {
 408     tty->print_cr("GCTaskManager::initialize: workers: %u", workers());
 409   }
 410   assert(workers() != 0, "no workers");
 411   _monitor = new Monitor(Mutex::barrier,                // rank
 412                          "GCTaskManager monitor",       // name
 413                          Mutex::_allow_vm_block_flag,   // allow_vm_block
 414                          Monitor::_safepoint_check_never);
 415   // The queue for the GCTaskManager must be a CHeapObj.
 416   GCTaskQueue* unsynchronized_queue = GCTaskQueue::create_on_c_heap();
 417   _queue = SynchronizedGCTaskQueue::create(unsynchronized_queue, lock());
 418   _noop_task = NoopGCTask::create_on_c_heap();
 419   _resource_flag = NEW_C_HEAP_ARRAY(bool, workers(), mtGC);
 420   {
 421     // Set up worker threads.
 422     //     Distribute the workers among the available processors,
 423     //     unless we were told not to, or if the os doesn't want to.


< prev index next >