Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp
38920 views
/*1* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP25#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP2627#include "runtime/thread.hpp"2829// Forward declarations of classes defined here.30class GCTaskThread;31class GCTaskTimeStamp;3233// Declarations of classes referenced in this file via pointer.34class GCTaskManager;3536class GCTaskThread : public WorkerThread {37friend class GCTaskManager;38private:39// Instance state.40GCTaskManager* _manager; // Manager for worker.41const uint _processor_id; // Which processor the worker is on.4243GCTaskTimeStamp* _time_stamps;44uint _time_stamp_index;4546GCTaskTimeStamp* time_stamp_at(uint index);4748bool _is_working; // True if participating in GC tasks4950public:51// Factory create and destroy methods.52static GCTaskThread* create(GCTaskManager* manager,53uint which,54uint processor_id) {55return new GCTaskThread(manager, which, processor_id);56}57static void destroy(GCTaskThread* manager) {58if (manager != NULL) {59delete manager;60}61}62// Methods from Thread.63bool is_GC_task_thread() const {64return true;65}66virtual void run();67// Methods.68void start();6970void print_task_time_stamps();71void print_on(outputStream* st) const;72void print() const { print_on(tty); }7374protected:75// Constructor. Clients use factory, but there could be subclasses.76GCTaskThread(GCTaskManager* manager, uint which, uint processor_id);77// Destructor: virtual destructor because of virtual methods.78virtual ~GCTaskThread();79// Accessors.80GCTaskManager* manager() const {81return _manager;82}83uint which() const {84return id();85}86uint processor_id() const {87return _processor_id;88}89void set_is_working(bool v) { _is_working = v; }90};9192class GCTaskTimeStamp : public CHeapObj<mtGC>93{94private:95jlong _entry_time;96jlong _exit_time;97char* _name;9899public:100jlong entry_time() { return _entry_time; }101jlong exit_time() { return _exit_time; }102const char* name() const { return (const char*)_name; }103104void set_entry_time(jlong time) { _entry_time = time; }105void set_exit_time(jlong time) { _exit_time = time; }106void set_name(char* name) { _name = name; }107};108109#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP110111112