Path: blob/master/runtime/gc_verbose_old_events/VerboseEvent.hpp
5985 views
1/*******************************************************************************2* Copyright (c) 1991, 2014 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* distribution and is available at https://www.eclipse.org/legal/epl-2.0/7* or the Apache License, Version 2.0 which accompanies this distribution and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*20* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception21*******************************************************************************/2223#if !defined(VERBOSE_EVENT_HPP_)24#define VERBOSE_EVENT_HPP_2526#include "j9.h"27#include "j9cfg.h"28#include "modron.h"2930#include "Base.hpp"31#include "GCExtensions.hpp"3233class MM_EnvironmentBase;34class MM_VerboseEventStream;35class MM_VerboseOutputAgent;36class MM_VerboseManagerOld;3738/**39* Base class for MM_VerboseEvents.40* @ingroup GC_verbose_events41*/42class MM_VerboseEvent : public MM_Base43{44/*45* Data members46*/47private:48protected:49OMR_VMThread *_omrThread;50MM_GCExtensions *_extensions;51MM_VerboseManagerOld *_manager;5253U_64 _time;54UDATA _type;5556MM_VerboseEvent *_next;57MM_VerboseEvent *_previous;5859J9HookInterface** _hookInterface; /* hook interface the event is registered with */6061public:6263/*64* Function members65*/66private:67protected:68public:69MMINLINE MM_VerboseEvent *getNextEvent() { return _next; }70MMINLINE MM_VerboseEvent *getPreviousEvent() { return _previous; }7172MMINLINE void setNextEvent(MM_VerboseEvent *nextEvent) { _next = nextEvent; }73MMINLINE void setPreviousEvent(MM_VerboseEvent *previousEvent) { _previous = previousEvent; }7475virtual bool definesOutputRoutine() = 0;76virtual bool endsEventChain() = 0;7778virtual bool isAtomic() { return false; } /**< Override to return true if event should be handled away from main event stream */7980MMINLINE OMR_VMThread* getThread() { return _omrThread; }81MMINLINE U_64 getTimeStamp() { return _time; }82MMINLINE UDATA getEventType() { return _type; }83MMINLINE J9HookInterface** getHookInterface() { return _hookInterface; }8485MMINLINE bool getTimeDeltaInMicroSeconds(U_64 *timeInMicroSeconds, U_64 startTime, U_64 endTime)86{87if(endTime < startTime) {88*timeInMicroSeconds = 0;89return false;90}91OMRPORT_ACCESS_FROM_OMRVMTHREAD(_omrThread);9293*timeInMicroSeconds = omrtime_hires_delta(startTime, endTime, J9PORT_TIME_DELTA_IN_MICROSECONDS);94return true;95}9697static void *create(OMR_VMThread *omrVMThread, UDATA size);98static void *create(J9VMThread *vmThread, UDATA size);99virtual void kill(MM_EnvironmentBase *env);100101virtual void consumeEvents() = 0;102virtual void formattedOutput(MM_VerboseOutputAgent *agent) = 0;103104MM_VerboseEvent(OMR_VMThread *omrVMThread, U_64 timestamp, UDATA type, J9HookInterface** hookInterface)105: MM_Base()106, _omrThread(omrVMThread)107, _extensions(MM_GCExtensions::getExtensions(omrVMThread))108, _manager((MM_VerboseManagerOld*)_extensions->verboseGCManager)109, _time(timestamp)110, _type(type)111, _next(NULL)112, _previous(NULL)113, _hookInterface(hookInterface)114{}115};116117#endif /* VERBOSE_EVENT_HPP_ */118119120