Path: blob/master/runtime/gc_verbose_old_events/VerboseEventAFEnd.cpp
5985 views
12/*******************************************************************************3* Copyright (c) 1991, 2014 IBM Corp. and others4*5* This program and the accompanying materials are made available under6* the terms of the Eclipse Public License 2.0 which accompanies this7* distribution and is available at https://www.eclipse.org/legal/epl-2.0/8* or the Apache License, Version 2.0 which accompanies this distribution and9* is available at https://www.apache.org/licenses/LICENSE-2.0.10*11* This Source Code may also be made available under the following12* Secondary Licenses when the conditions for such availability set13* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU14* General Public License, version 2 with the GNU Classpath15* Exception [1] and GNU General Public License, version 2 with the16* OpenJDK Assembly Exception [2].17*18* [1] https://www.gnu.org/software/classpath/license.html19* [2] http://openjdk.java.net/legal/assembly-exception.html20*21* 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-exception22*******************************************************************************/2324#include "VerboseEventAFEnd.hpp"25#include "GCExtensions.hpp"26#include "VerboseEventStream.hpp"27#include "VerboseManagerOld.hpp"28#include "VerboseEventAFStart.hpp"2930/**31* Create an new instance of a MM_Verbose_AF_End event.32* @param event Pointer to a structure containing the data passed over the hookInterface33*/34MM_VerboseEvent *35MM_VerboseEventAFEnd::newInstance(MM_AllocationFailureEndEvent *event, J9HookInterface** hookInterface)36{37MM_VerboseEventAFEnd *eventObject;3839eventObject = (MM_VerboseEventAFEnd *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventAFEnd));40if(NULL != eventObject) {41new(eventObject) MM_VerboseEventAFEnd(event, hookInterface);42}43return eventObject;44}4546/**47* Populate events data fields.48* The event calls the event stream requesting the address of events it is interested in.49* When an address is returned it populates itself with the data.50*/51void52MM_VerboseEventAFEnd::consumeEvents(void)53{54MM_VerboseEventStream *eventStream = _manager->getEventStream();55MM_VerboseEventAFStart *event = NULL;5657if (NULL != (event = (MM_VerboseEventAFStart *)eventStream->returnEvent(J9HOOK_MM_PRIVATE_ALLOCATION_FAILURE_START, _manager->getPrivateHookInterface(), (MM_VerboseEvent *)this))){58_AFStartTime = event->getTimeStamp();59} else {60//Stream is corrupted, what now?61}6263/* Set last AF time */64(MEMORY_TYPE_NEW == event->getSubSpaceType()) ? (_manager->setLastNurseryAFTime(_time)) : (_manager->setLastTenureAFTime(_time));65}6667/**68* Passes a format string and data to the output routine defined in the passed output agent.69* @param agent Pointer to an output agent.70*/71void72MM_VerboseEventAFEnd::formattedOutput(MM_VerboseOutputAgent *agent)73{74UDATA indentLevel = _manager->getIndentLevel();75U_64 timeInMicroSeconds;7677/* output the common GC start info */78gcEndFormattedOutput(agent);7980if (!getTimeDeltaInMicroSeconds(&timeInMicroSeconds, _AFStartTime, _time + _exclusiveAccessTime)) {81agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"clock error detected in time totalms\" />");82}83agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<time totalms=\"%llu.%03.3llu\" />",84timeInMicroSeconds / 1000,85timeInMicroSeconds % 100086);8788_manager->decrementIndent();89indentLevel = _manager->getIndentLevel();9091agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</af>");92agent->endOfCycle(static_cast<J9VMThread*>(_omrThread->_language_vmthread));93}949596