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

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP
aoqi@0 26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP
aoqi@0 27
aoqi@0 28 #include "runtime/thread.hpp"
aoqi@0 29
aoqi@0 30 // Forward declarations of classes defined here.
aoqi@0 31 class GCTaskThread;
aoqi@0 32 class GCTaskTimeStamp;
aoqi@0 33
aoqi@0 34 // Declarations of classes referenced in this file via pointer.
aoqi@0 35 class GCTaskManager;
aoqi@0 36
aoqi@0 37 class GCTaskThread : public WorkerThread {
aoqi@0 38 friend class GCTaskManager;
aoqi@0 39 private:
aoqi@0 40 // Instance state.
aoqi@0 41 GCTaskManager* _manager; // Manager for worker.
aoqi@0 42 const uint _processor_id; // Which processor the worker is on.
aoqi@0 43
aoqi@0 44 GCTaskTimeStamp* _time_stamps;
aoqi@0 45 uint _time_stamp_index;
aoqi@0 46
aoqi@0 47 GCTaskTimeStamp* time_stamp_at(uint index);
aoqi@0 48
aoqi@0 49 bool _is_working; // True if participating in GC tasks
aoqi@0 50
aoqi@0 51 public:
aoqi@0 52 // Factory create and destroy methods.
aoqi@0 53 static GCTaskThread* create(GCTaskManager* manager,
aoqi@0 54 uint which,
aoqi@0 55 uint processor_id) {
aoqi@0 56 return new GCTaskThread(manager, which, processor_id);
aoqi@0 57 }
aoqi@0 58 static void destroy(GCTaskThread* manager) {
aoqi@0 59 if (manager != NULL) {
aoqi@0 60 delete manager;
aoqi@0 61 }
aoqi@0 62 }
aoqi@0 63 // Methods from Thread.
aoqi@0 64 bool is_GC_task_thread() const {
aoqi@0 65 return true;
aoqi@0 66 }
aoqi@0 67 virtual void run();
aoqi@0 68 // Methods.
aoqi@0 69 void start();
aoqi@0 70
aoqi@0 71 void print_task_time_stamps();
aoqi@0 72 void print_on(outputStream* st) const;
aoqi@0 73 void print() const { print_on(tty); }
aoqi@0 74
aoqi@0 75 protected:
aoqi@0 76 // Constructor. Clients use factory, but there could be subclasses.
aoqi@0 77 GCTaskThread(GCTaskManager* manager, uint which, uint processor_id);
aoqi@0 78 // Destructor: virtual destructor because of virtual methods.
aoqi@0 79 virtual ~GCTaskThread();
aoqi@0 80 // Accessors.
aoqi@0 81 GCTaskManager* manager() const {
aoqi@0 82 return _manager;
aoqi@0 83 }
aoqi@0 84 uint which() const {
aoqi@0 85 return id();
aoqi@0 86 }
aoqi@0 87 uint processor_id() const {
aoqi@0 88 return _processor_id;
aoqi@0 89 }
aoqi@0 90 void set_is_working(bool v) { _is_working = v; }
aoqi@0 91 };
aoqi@0 92
aoqi@0 93 class GCTaskTimeStamp : public CHeapObj<mtGC>
aoqi@0 94 {
aoqi@0 95 private:
aoqi@0 96 jlong _entry_time;
aoqi@0 97 jlong _exit_time;
aoqi@0 98 char* _name;
aoqi@0 99
aoqi@0 100 public:
aoqi@0 101 jlong entry_time() { return _entry_time; }
aoqi@0 102 jlong exit_time() { return _exit_time; }
aoqi@0 103 const char* name() const { return (const char*)_name; }
aoqi@0 104
aoqi@0 105 void set_entry_time(jlong time) { _entry_time = time; }
aoqi@0 106 void set_exit_time(jlong time) { _exit_time = time; }
aoqi@0 107 void set_name(char* name) { _name = name; }
aoqi@0 108 };
aoqi@0 109
aoqi@0 110 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP

mercurial