0N/A/*
1879N/A * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP
1879N/A#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP
1879N/A
1879N/A#include "runtime/thread.hpp"
1879N/A
0N/A// Forward declarations of classes defined here.
0N/Aclass GCTaskThread;
0N/Aclass GCTaskTimeStamp;
0N/A
0N/A// Declarations of classes referenced in this file via pointer.
0N/Aclass GCTaskManager;
0N/A
0N/Aclass GCTaskThread : public WorkerThread {
2941N/A friend class GCTaskManager;
0N/Aprivate:
0N/A // Instance state.
0N/A GCTaskManager* _manager; // Manager for worker.
0N/A const uint _processor_id; // Which processor the worker is on.
0N/A
0N/A GCTaskTimeStamp* _time_stamps;
0N/A uint _time_stamp_index;
0N/A
0N/A GCTaskTimeStamp* time_stamp_at(uint index);
0N/A
2941N/A bool _is_working; // True if participating in GC tasks
2941N/A
0N/A public:
0N/A // Factory create and destroy methods.
0N/A static GCTaskThread* create(GCTaskManager* manager,
0N/A uint which,
0N/A uint processor_id) {
0N/A return new GCTaskThread(manager, which, processor_id);
0N/A }
0N/A static void destroy(GCTaskThread* manager) {
0N/A if (manager != NULL) {
0N/A delete manager;
0N/A }
0N/A }
0N/A // Methods from Thread.
0N/A bool is_GC_task_thread() const {
0N/A return true;
0N/A }
0N/A virtual void run();
0N/A // Methods.
0N/A void start();
0N/A
0N/A void print_task_time_stamps();
0N/A void print_on(outputStream* st) const;
0N/A void print() const { print_on(tty); }
0N/A
0N/Aprotected:
0N/A // Constructor. Clients use factory, but there could be subclasses.
0N/A GCTaskThread(GCTaskManager* manager, uint which, uint processor_id);
0N/A // Destructor: virtual destructor because of virtual methods.
0N/A virtual ~GCTaskThread();
0N/A // Accessors.
0N/A GCTaskManager* manager() const {
0N/A return _manager;
0N/A }
0N/A uint which() const {
0N/A return id();
0N/A }
0N/A uint processor_id() const {
0N/A return _processor_id;
0N/A }
2941N/A void set_is_working(bool v) { _is_working = v; }
0N/A};
0N/A
3863N/Aclass GCTaskTimeStamp : public CHeapObj<mtGC>
0N/A{
0N/A private:
0N/A jlong _entry_time;
0N/A jlong _exit_time;
0N/A char* _name;
0N/A
0N/A public:
0N/A jlong entry_time() { return _entry_time; }
0N/A jlong exit_time() { return _exit_time; }
0N/A const char* name() const { return (const char*)_name; }
0N/A
0N/A void set_entry_time(jlong time) { _entry_time = time; }
0N/A void set_exit_time(jlong time) { _exit_time = time; }
0N/A void set_name(char* name) { _name = name; }
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GCTASKTHREAD_HPP