Path: blob/master/runtime/gc_verbose_old_events/VerboseEventConcurrentRSScanEnd.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 "VerboseEventConcurrentRSScanEnd.hpp"24#include "GCExtensions.hpp"25#include "VerboseEventStream.hpp"26#include "VerboseManagerOld.hpp"27#include "VerboseEventConcurrentRSScanStart.hpp"2829/**30* Create an new instance of a MM_VerboseEventConcurrentRSScanEnd event.31* @param event Pointer to a structure containing the data passed over the hookInterface32*/33MM_VerboseEvent *34MM_VerboseEventConcurrentRSScanEnd::newInstance(MM_ConcurrentRememberedSetScanEndEvent *event, J9HookInterface** hookInterface)35{36MM_VerboseEventConcurrentRSScanEnd *eventObject;3738eventObject = (MM_VerboseEventConcurrentRSScanEnd *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventConcurrentRSScanEnd));39if(NULL != eventObject) {40new(eventObject) MM_VerboseEventConcurrentRSScanEnd(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_VerboseEventConcurrentRSScanEnd::consumeEvents(void)52{53MM_VerboseEventStream *eventStream = _manager->getEventStream();54MM_VerboseEventConcurrentRSScanStart *event = NULL;5556if (NULL != (event = (MM_VerboseEventConcurrentRSScanStart *)eventStream->returnEvent(J9HOOK_MM_PRIVATE_CONCURRENT_REMEMBERED_SET_SCAN_START, _manager->getPrivateHookInterface(), (MM_VerboseEvent *)this))){57_conRSScanStartTime = event->getTimeStamp();58_workStackOverflowCountStart = event->getWorkStackOverflowCount();59} else {60//Stream is corrupted, what now?61}62}6364/**65* Passes a format string and data to the output routine defined in the passed output agent.66* @param agent Pointer to an output agent.67*/68void69MM_VerboseEventConcurrentRSScanEnd::formattedOutput(MM_VerboseOutputAgent *agent)70{71UDATA indentLevel = _manager->getIndentLevel();72U_64 timeInMicroSeconds;7374agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<con event=\"remembered set scan\">");7576_manager->incrementIndent();77indentLevel = _manager->getIndentLevel();7879if (!getTimeDeltaInMicroSeconds(&timeInMicroSeconds, _conRSScanStartTime, _time)) {80agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"clock error detected in stats timetakenms\" />");81}82agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<stats objectsfound=\"%zu\" traced=\"%zu\" timetakenms=\"%llu.%03.3llu\" />",83_objectsFound,84_bytesTraced,85timeInMicroSeconds / 1000,86timeInMicroSeconds % 100087);8889/* Has overflow count gone up since start of final card cleaning.90* If so we have had further work stack overflows91*/92if(_workStackOverflowCount > _workStackOverflowCountStart) {93agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"concurrent work stack overflow\" count=\"%zu\" />",94_workStackOverflowCount);95}9697_manager->decrementIndent();98indentLevel = _manager->getIndentLevel();99100agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</con>");101}102103104