src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp

Print this page


   1 
   2 /*
   3  * Copyright (c) 2002, 2007, 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
  22  * questions.
  23  *
  24  */
  25 
  26 #include "incls/_precompiled.incl"
  27 #include "incls/_gcTaskThread.cpp.incl"








  28 
  29 GCTaskThread::GCTaskThread(GCTaskManager* manager,
  30                            uint           which,
  31                            uint           processor_id) :
  32   _manager(manager),
  33   _processor_id(processor_id),
  34   _time_stamps(NULL),
  35   _time_stamp_index(0)
  36 {
  37   if (!os::create_thread(this, os::pgc_thread))
  38     vm_exit_out_of_memory(0, "Cannot create GC thread. Out of system resources.");
  39 
  40   if (PrintGCTaskTimeStamps) {
  41     _time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries );
  42 
  43     guarantee(_time_stamps != NULL, "Sanity");
  44   }
  45   set_id(which);
  46   set_name("GC task thread#%d (ParallelGC)", which);
  47 }


   1 
   2 /*
   3  * Copyright (c) 2002, 2010, 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
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
  28 #include "gc_implementation/parallelScavenge/gcTaskThread.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "runtime/handles.hpp"
  33 #include "runtime/handles.inline.hpp"
  34 #include "runtime/os.hpp"
  35 #include "runtime/thread.hpp"
  36 
  37 GCTaskThread::GCTaskThread(GCTaskManager* manager,
  38                            uint           which,
  39                            uint           processor_id) :
  40   _manager(manager),
  41   _processor_id(processor_id),
  42   _time_stamps(NULL),
  43   _time_stamp_index(0)
  44 {
  45   if (!os::create_thread(this, os::pgc_thread))
  46     vm_exit_out_of_memory(0, "Cannot create GC thread. Out of system resources.");
  47 
  48   if (PrintGCTaskTimeStamps) {
  49     _time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries );
  50 
  51     guarantee(_time_stamps != NULL, "Sanity");
  52   }
  53   set_id(which);
  54   set_name("GC task thread#%d (ParallelGC)", which);
  55 }