Path: blob/master/runtime/gc_stats/CopyForwardStats.hpp
5986 views
1/*******************************************************************************2* Copyright (c) 1991, 2021 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/**24* @file25* @ingroup GC_Stats26*/2728#if !defined(COPYFORWARDSTATS_HPP_)29#define COPYFORWARDSTATS_HPP_3031#include "CopyForwardStatsCore.hpp"32#include "j9cfg.h"33#include "j9comp.h"34#include "j9port.h"35#include "modronbase.h"36#include "modronopt.h"3738#if defined(J9VM_GC_VLHGC)3940#include "ReferenceStats.hpp"4142/**43* Storage for statistics relevant to a copy forward collector.44* @ingroup GC_Stats45*/46class MM_CopyForwardStats : public MM_CopyForwardStatsCore47{48/*49* Data members50*/51public:52/* The below stats include both marked and copied cases */53uintptr_t _unfinalizedCandidates; /**< unfinalized objects that are candidates to be finalized visited this cycle */54uintptr_t _unfinalizedEnqueued; /**< unfinalized objects that are enqueued during this cycle (MUST be less than or equal _unfinalizedCandidates) */5556uintptr_t _ownableSynchronizerCandidates; /**< number of ownable synchronizer objects visited this cycle */57uintptr_t _ownableSynchronizerSurvived; /**< number of ownable synchronizer objects survived this cycle */5859MM_ReferenceStats _weakReferenceStats; /**< Weak reference stats for the cycle */60MM_ReferenceStats _softReferenceStats; /**< Soft reference stats for the cycle */61MM_ReferenceStats _phantomReferenceStats; /**< Phantom reference stats for the cycle */6263uintptr_t _stringConstantsCleared; /**< The number of string constants that have been cleared during marking */64uintptr_t _stringConstantsCandidates; /**< The number of string constants that have been visited in string table during marking */6566uintptr_t _monitorReferenceCleared; /**< The number of monitor references that have been cleared during marking */67uintptr_t _monitorReferenceCandidates; /**< The number of monitor references that have been visited in monitor table during marking */6869#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)70uintptr_t _doubleMappedArrayletsCleared; /**< The number of double mapped arraylets that have been cleared durign marking */71uintptr_t _doubleMappedArrayletsCandidates; /**< The number of double mapped arraylets that have been visited during marking */72#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */7374uint64_t _cycleStartTime; /**< The start time of a copy forward cycle */7576private:7778/*79* Function members80*/81public:8283MMINLINE void clear() {8485MM_CopyForwardStatsCore::clear();8687_unfinalizedCandidates = 0;88_unfinalizedEnqueued = 0;8990_ownableSynchronizerCandidates = 0;91_ownableSynchronizerSurvived = 0;9293_weakReferenceStats.clear();94_softReferenceStats.clear();95_phantomReferenceStats.clear();9697_stringConstantsCleared = 0;98_stringConstantsCandidates = 0;99100_monitorReferenceCleared = 0;101_monitorReferenceCandidates = 0;102103#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)104_doubleMappedArrayletsCleared = 0;105_doubleMappedArrayletsCandidates = 0;106#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */107}108109/**110* Merge the given stat structures values into the receiver.111* @note This method is NOT thread safe.112*/113void merge(MM_CopyForwardStats *stats) {114MM_CopyForwardStatsCore::merge(stats);115_unfinalizedCandidates += stats->_unfinalizedCandidates;116_unfinalizedEnqueued += stats->_unfinalizedEnqueued;117118_ownableSynchronizerSurvived += stats->_ownableSynchronizerSurvived;119120_weakReferenceStats.merge(&stats->_weakReferenceStats);121_softReferenceStats.merge(&stats->_softReferenceStats);122_phantomReferenceStats.merge(&stats->_phantomReferenceStats);123124_stringConstantsCleared += stats->_stringConstantsCleared;125_stringConstantsCandidates += stats->_stringConstantsCandidates;126127_monitorReferenceCleared += stats->_monitorReferenceCleared;128_monitorReferenceCandidates += stats->_monitorReferenceCandidates;129130#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)131_doubleMappedArrayletsCleared += stats->_doubleMappedArrayletsCleared;132_doubleMappedArrayletsCandidates += stats->_doubleMappedArrayletsCandidates;133#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */134}135136MM_CopyForwardStats() :137MM_CopyForwardStatsCore()138, _unfinalizedCandidates(0)139, _unfinalizedEnqueued(0)140, _ownableSynchronizerCandidates(0)141, _ownableSynchronizerSurvived(0)142, _weakReferenceStats()143, _softReferenceStats()144, _phantomReferenceStats()145, _stringConstantsCleared(0)146, _stringConstantsCandidates(0)147, _monitorReferenceCleared(0)148, _monitorReferenceCandidates(0)149#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)150, _doubleMappedArrayletsCleared(0)151, _doubleMappedArrayletsCandidates(0)152#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */153{}154};155156#endif /* J9VM_GC_VLHGC */157#endif /* COPYFORWARDSTATS_HPP_ */158159160