Path: blob/master/runtime/gc_verbose_old_events/VerboseEventConcurrentHalted.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 "ConcurrentGCStats.hpp"24#include "GCExtensions.hpp"25#include "ScanClassesMode.hpp"26#include "VerboseEventConcurrentHalted.hpp"27#include "VerboseEventStream.hpp"28#include "VerboseManagerOld.hpp"2930#include "j9modron.h"3132/**33* Create an new instance of a MM_VerboseEventConcurrentHalted event.34* @param event Pointer to a structure containing the data passed over the hookInterface35*/36MM_VerboseEvent *37MM_VerboseEventConcurrentHalted::newInstance(MM_ConcurrentHaltedEvent *event, J9HookInterface** hookInterface)38{39MM_VerboseEventConcurrentHalted *eventObject;4041eventObject = (MM_VerboseEventConcurrentHalted *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventConcurrentHalted));42if(NULL != eventObject) {43new(eventObject) MM_VerboseEventConcurrentHalted(event, hookInterface);44}45return eventObject;46}4748/**49* Populate events data fields.50* The event calls the event stream requesting the address of events it is interested in.51* When an address is returned it populates itself with the data.52*/53void54MM_VerboseEventConcurrentHalted::consumeEvents(void)55{56}5758/**59* Passes a format string and data to the output routine defined in the passed output agent.60* @param agent Pointer to an output agent.61*/62void63MM_VerboseEventConcurrentHalted::formattedOutput(MM_VerboseOutputAgent *agent)64{65UDATA indentLevel = _manager->getIndentLevel();6667#define CONCURRENT_STATUS_BUFFER_LENGTH 3268char statusBuffer[CONCURRENT_STATUS_BUFFER_LENGTH];69MM_EnvironmentBase *env = MM_EnvironmentBase::getEnvironment(_omrThread);70const char* statusString = MM_ConcurrentGCStats::getConcurrentStatusString(env, _executionMode, statusBuffer, CONCURRENT_STATUS_BUFFER_LENGTH);71#undef CONCURRENT_STATUS_BUFFER_LENGTH72agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<con event=\"halted\" mode=\"%s\" state=\"%s\">",73statusString, getConcurrentStateAsString(_isCardCleaningComplete, _scanClassesMode, _isTracingExhausted));7475_manager->incrementIndent();76indentLevel = _manager->getIndentLevel();7778agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<stats tracetarget=\"%zu\">", _traceTarget);7980_manager->incrementIndent();81indentLevel = _manager->getIndentLevel();8283agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<traced total=\"%zu\" mutators=\"%zu\" helpers=\"%zu\" percent=\"%zu\" />",84_tracedTotal,85_tracedByMutators,86_tracedByHelpers,87_traceTarget == 0 ? 0 : (UDATA) ( ( (U_64) _tracedTotal * 100) / (U_64) _traceTarget)88);8990agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<cards cleaned=\"%zu\" kickoff=\"%zu\" />",91_cardsCleaned,92_cardCleaningThreshold93);9495if(_workStackOverflowOccured) {96agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"concurrent work stack overflow\" count=\"%zu\" />", _workStackOverflowCount);97}9899_manager->decrementIndent();100indentLevel = _manager->getIndentLevel();101102agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</stats>");103104_manager->decrementIndent();105indentLevel = _manager->getIndentLevel();106107agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</con>");108}109110/**111* Return the concurrent reason as a string112* @param isCardCleaningComplete Card cleaning complete condition113* @param scanClassesMode Current scan classes state114* $param isTracingExhausted Tracing complete condition115*/116const char *117MM_VerboseEventConcurrentHalted::getConcurrentStateAsString(UDATA isCardCleaningComplete, UDATA scanClassesMode, UDATA isTracingExhausted)118{119if (0 == isCardCleaningComplete) {120return "Card cleaning incomplete";121}122123#if defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING)124switch (scanClassesMode) {125case MM_ScanClassesMode::SCAN_CLASSES_NEED_TO_BE_EXECUTED:126case MM_ScanClassesMode::SCAN_CLASSES_CURRENTLY_ACTIVE:127return "Class scanning incomplete";128case MM_ScanClassesMode::SCAN_CLASSES_COMPLETE:129case MM_ScanClassesMode::SCAN_CLASSES_DISABLED:130break;131default:132return "Class scanning bad state";133}134#endif /* defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING) */135136if (0 == isTracingExhausted) {137return "Tracing incomplete";138}139140return "Complete";141}142143144145