Path: blob/master/runtime/gc_verbose_old_events/VerboseEventConcurrentCompleteTracingEnd.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 "VerboseEventConcurrentCompleteTracingEnd.hpp"24#include "GCExtensions.hpp"25#include "VerboseEventStream.hpp"26#include "VerboseManagerOld.hpp"27#include "VerboseEventConcurrentCompleteTracingStart.hpp"2829/**30* Create an new instance of a MM_VerboseEventConcurrentCompleteTracingEnd event.31* @param event Pointer to a structure containing the data passed over the hookInterface32*/33MM_VerboseEvent *34MM_VerboseEventConcurrentCompleteTracingEnd::newInstance(MM_ConcurrentCompleteTracingEndEvent *event, J9HookInterface** hookInterface)35{36MM_VerboseEventConcurrentCompleteTracingEnd *eventObject;3738eventObject = (MM_VerboseEventConcurrentCompleteTracingEnd *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventConcurrentCompleteTracingEnd));39if(NULL != eventObject) {40new(eventObject) MM_VerboseEventConcurrentCompleteTracingEnd(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_VerboseEventConcurrentCompleteTracingEnd::consumeEvents(void)52{53MM_VerboseEventStream *eventStream = _manager->getEventStream();54MM_VerboseEventConcurrentCompleteTracingStart *event = NULL;5556if (NULL != (event = (MM_VerboseEventConcurrentCompleteTracingStart *)eventStream->returnEvent(J9HOOK_MM_PRIVATE_CONCURRENT_COMPLETE_TRACING_START, _manager->getPrivateHookInterface(), (MM_VerboseEvent *)this))){57_conCompleteTracingStartTime = 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_VerboseEventConcurrentCompleteTracingEnd::formattedOutput(MM_VerboseOutputAgent *agent)70{71UDATA indentLevel = _manager->getIndentLevel();72U_64 timeInMicroSeconds;7374agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<con event=\"complete marking\">");7576_manager->incrementIndent();77indentLevel = _manager->getIndentLevel();7879if (!getTimeDeltaInMicroSeconds(&timeInMicroSeconds, _conCompleteTracingStartTime, _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 traced=\"%zu\" timetakenms=\"%llu.%03.3llu\" />",83_bytesTraced,84timeInMicroSeconds / 1000,85timeInMicroSeconds % 100086);8788/* Has overflow count gone up during while we complete marking.89* If so we have had further work stack overflows which we should report now.90*/91if(_workStackOverflowCount > _workStackOverflowCountStart) {92agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"concurrent work stack overflow\" count=\"%zu\" />",93_workStackOverflowCount);94}959697_manager->decrementIndent();98indentLevel = _manager->getIndentLevel();99100agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</con>");101}102103104