Path: blob/master/runtime/gc_verbose_old_events/VerboseEventGCEnd.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 "VerboseEventGCEnd.hpp"24#include "GCExtensions.hpp"25#include "VerboseEventStream.hpp"26#include "VerboseManagerOld.hpp"2728void29MM_VerboseEventGCEnd::initialize(void)30{31OMRPORT_ACCESS_FROM_OMRVMTHREAD(_omrThread);32_timeInMilliSeconds = omrtime_current_time_millis();33}343536/**37* Output common data for the every GC start event. This method is expected38* be to invoked by subclasses from their formattedOutput routines39*40* @param agent Pointer to an output agent.41*/42void43MM_VerboseEventGCEnd::gcEndFormattedOutput(MM_VerboseOutputAgent *agent)44{45UDATA indentLevel = _manager->getIndentLevel();4647if(static_cast<J9VMThread*>(_omrThread->_language_vmthread)->javaVM->memoryManagerFunctions->j9gc_scavenger_enabled(static_cast<J9VMThread*>(_omrThread->_language_vmthread)->javaVM)) {48agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<nursery freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" />",49_gcEndData.commonData.nurseryFreeBytes,50_gcEndData.commonData.nurseryTotalBytes,51(UDATA) ( ( (U_64) _gcEndData.commonData.nurseryFreeBytes * 100) / (U_64) _gcEndData.commonData.nurseryTotalBytes)52);53}5455agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<tenured freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" %s>",56_gcEndData.commonData.tenureFreeBytes,57_gcEndData.commonData.tenureTotalBytes,58(UDATA) ( ( (U_64) _gcEndData.commonData.tenureFreeBytes * 100) / (U_64) _gcEndData.commonData.tenureTotalBytes),59hasDetailedTenuredOutput() ? "" : "/"60);6162if (hasDetailedTenuredOutput()) {63_manager->incrementIndent();64loaFormattedOutput(agent);65//tlhFormattedOutput(agent);66_manager->decrementIndent();6768agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</tenured>");69}7071if(_extensions->verboseExtensions) {72agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<rememberedset count=\"%zu\" />",73_gcEndData.commonData.rememberedSetCount74);75}76}7778/**79* Returns true if there are subclauses to the <tenured> clause, or80* false if the <tenured> clause can stand alone81*/82bool83MM_VerboseEventGCEnd::hasDetailedTenuredOutput()84{85/* if verbose extensions is on, then tlh and nontlh data will be output */86if (_extensions->verboseExtensions) {87return true;88}8990#if defined(J9VM_GC_LARGE_OBJECT_AREA)91if (_gcEndData.commonData.loaEnabled) {92return true;93}94#endif /* J9VM_GC_LARGE_OBJECT_AREA */9596return false;97}9899/**100* Output details about LOA and SOA spaces for the <tenured> clause.101* This output is only enabled if LOAs are enabled102*/103void104MM_VerboseEventGCEnd::loaFormattedOutput(MM_VerboseOutputAgent *agent)105{106#if defined(J9VM_GC_LARGE_OBJECT_AREA)107if (_gcEndData.commonData.loaEnabled) {108UDATA indentLevel = _manager->getIndentLevel();109UDATA tenureSOATotalBytes = _gcEndData.commonData.tenureTotalBytes - _gcEndData.commonData.tenureLOATotalBytes;110UDATA tenureSOAFreeBytes = _gcEndData.commonData.tenureFreeBytes - _gcEndData.commonData.tenureLOAFreeBytes;111112agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<soa freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" />",113tenureSOAFreeBytes,114tenureSOATotalBytes,115(UDATA) ( ( (U_64) tenureSOAFreeBytes * 100) / (U_64) tenureSOATotalBytes)116);117118agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<loa freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" />",119_gcEndData.commonData.tenureLOAFreeBytes,120_gcEndData.commonData.tenureLOATotalBytes,121( _gcEndData.commonData.tenureLOATotalBytes == 0 ? 0 : (UDATA) ( ( (U_64) _gcEndData.commonData.tenureLOAFreeBytes * 100) / (U_64) _gcEndData.commonData.tenureLOATotalBytes))122);123}124#endif /* J9VM_GC_LARGE_OBJECT_AREA*/125}126127128