< prev index next >

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

Print this page


   1 
   2 /*
   3  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any


  79   for(uint i=0; i<_time_stamp_index; i++) {
  80     GCTaskTimeStamp* time_stamp = time_stamp_at(i);
  81     tty->print_cr("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
  82                   time_stamp->name(),
  83                   time_stamp->entry_time(),
  84                   time_stamp->exit_time());
  85   }
  86 
  87   // Reset after dumping the data
  88   _time_stamp_index = 0;
  89 }
  90 
  91 // GC workers get tasks from the GCTaskManager and execute
  92 // them in this method.  If there are no tasks to execute,
  93 // the GC workers wait in the GCTaskManager's get_task()
  94 // for tasks to be enqueued for execution.
  95 
  96 void GCTaskThread::run() {
  97   // Set up the thread for stack overflow support
  98   this->record_stack_base_and_size();
  99   this->initialize_thread_local_storage();
 100   this->initialize_named_thread();
 101   // Bind yourself to your processor.
 102   if (processor_id() != GCTaskManager::sentinel_worker()) {
 103     if (TraceGCTaskThread) {
 104       tty->print_cr("GCTaskThread::run: "
 105                     "  binding to processor %u", processor_id());
 106     }
 107     if (!os::bind_to_processor(processor_id())) {
 108       DEBUG_ONLY(
 109         warning("Couldn't bind GCTaskThread %u to processor %u",
 110                       which(), processor_id());
 111       )
 112     }
 113   }
 114   // Part of thread setup.
 115   // ??? Are these set up once here to make subsequent ones fast?
 116   HandleMark   hm_outer;
 117   ResourceMark rm_outer;
 118 
 119   TimeStamp timer;



   1 /*
   2  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any


  78   for(uint i=0; i<_time_stamp_index; i++) {
  79     GCTaskTimeStamp* time_stamp = time_stamp_at(i);
  80     tty->print_cr("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
  81                   time_stamp->name(),
  82                   time_stamp->entry_time(),
  83                   time_stamp->exit_time());
  84   }
  85 
  86   // Reset after dumping the data
  87   _time_stamp_index = 0;
  88 }
  89 
  90 // GC workers get tasks from the GCTaskManager and execute
  91 // them in this method.  If there are no tasks to execute,
  92 // the GC workers wait in the GCTaskManager's get_task()
  93 // for tasks to be enqueued for execution.
  94 
  95 void GCTaskThread::run() {
  96   // Set up the thread for stack overflow support
  97   this->record_stack_base_and_size();

  98   this->initialize_named_thread();
  99   // Bind yourself to your processor.
 100   if (processor_id() != GCTaskManager::sentinel_worker()) {
 101     if (TraceGCTaskThread) {
 102       tty->print_cr("GCTaskThread::run: "
 103                     "  binding to processor %u", processor_id());
 104     }
 105     if (!os::bind_to_processor(processor_id())) {
 106       DEBUG_ONLY(
 107         warning("Couldn't bind GCTaskThread %u to processor %u",
 108                       which(), processor_id());
 109       )
 110     }
 111   }
 112   // Part of thread setup.
 113   // ??? Are these set up once here to make subsequent ones fast?
 114   HandleMark   hm_outer;
 115   ResourceMark rm_outer;
 116 
 117   TimeStamp timer;


< prev index next >