Path: blob/master/runtime/gc_verbose_old_events/VerboseEventConcurrentEnd.cpp
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#include "VerboseEventConcurrentEnd.hpp"24#include "GCExtensions.hpp"25#include "VerboseEventStream.hpp"26#include "VerboseManagerOld.hpp"27#include "VerboseEventConcurrentStart.hpp"2829/**30* Create an new instance of a MM_VerboseEventConcurrentEnd event.31* @param event Pointer to a structure containing the data passed over the hookInterface32*/33MM_VerboseEvent *34MM_VerboseEventConcurrentEnd::newInstance(MM_ConcurrentCollectionEndEvent *event, J9HookInterface** hookInterface)35{36MM_VerboseEventConcurrentEnd *eventObject;3738eventObject = (MM_VerboseEventConcurrentEnd *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventConcurrentEnd));39if(NULL != eventObject) {40new(eventObject) MM_VerboseEventConcurrentEnd(event, hookInterface);41}42return eventObject;43}4445/**46* Populate events data fields.47* The event calls the event stream requesting the address of events it is interested in.48* When an address is returned it populates itself with the data.49*/50void51MM_VerboseEventConcurrentEnd::consumeEvents(void)52{53MM_VerboseEventStream *eventStream = _manager->getEventStream();54MM_VerboseEventConcurrentStart *event = NULL;5556if (NULL != (event = (MM_VerboseEventConcurrentStart *)eventStream->returnEvent(J9HOOK_MM_PRIVATE_CONCURRENT_COLLECTION_START, _manager->getPrivateHookInterface(), (MM_VerboseEvent *)this))){57_conStartTime = event->getTimeStamp();58} else {59//Stream is corrupted, what now?60}6162/* Set last concurrent collection time */63_manager->setLastConcurrentGCTime(_time);64}6566/**67* Passes a format string and data to the output routine defined in the passed output agent.68* @param agent Pointer to an output agent.69*/70void71MM_VerboseEventConcurrentEnd::formattedOutput(MM_VerboseOutputAgent *agent)72{73UDATA indentLevel = _manager->getIndentLevel();74U_64 timeInMicroSeconds;7576/* output the common GC start info */77gcEndFormattedOutput(agent);7879if (!getTimeDeltaInMicroSeconds(&timeInMicroSeconds, _conStartTime, _time + _exclusiveAccessTime)) {80agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"clock error detected in time totalms\" />");81}82agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<time totalms=\"%llu.%03.3llu\" />",83timeInMicroSeconds / 1000,84timeInMicroSeconds % 100085);8687_manager->decrementIndent();88indentLevel = _manager->getIndentLevel();89agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</con>");90agent->endOfCycle(static_cast<J9VMThread*>(_omrThread->_language_vmthread));91}929394