Path: blob/master/runtime/gc_stats/MarkVLHGCStats.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(MARKVLHGCSTATS_HPP_)29#define MARKVLHGCSTATS_HPP_3031#include "j9.h"32#include "j9cfg.h"33#include "j9port.h"34#include "j9consts.h"35#include "modron.h"36#include "modronopt.h"3738#if defined(J9VM_GC_VLHGC)3940#include "MarkVLHGCStatsCore.hpp"41#include "Base.hpp"42#include "AtomicOperations.hpp"43#include "ReferenceStats.hpp"4445/**46* Storage for statistics relevant to the mark phase of a global collection.47* @ingroup GC_Stats48*/49class MM_MarkVLHGCStats : public MM_MarkVLHGCStatsCore50{51/* data members */52private:53protected:54public:5556UDATA _unfinalizedCandidates; /**< unfinalized objects that are candidates to be finalized visited this cycle */57UDATA _unfinalizedEnqueued; /**< unfinalized objects that are enqueued during this cycle (MUST be less than or equal _unfinalizedCandidates) */5859UDATA _ownableSynchronizerCandidates; /**< number of ownable synchronizer objects visited this cycle, used by both MarkingScheme */60UDATA _ownableSynchronizerSurvived; /**< number of ownable synchronizer objects survived this cycle, used only by PMS */61UDATA _ownableSynchronizerCleared; /**< number of ownable synchronizer objects cleared this cycle, used only by GMP */6263MM_ReferenceStats _weakReferenceStats; /**< Weak reference stats for the cycle */64MM_ReferenceStats _softReferenceStats; /**< Soft reference stats for the cycle */65MM_ReferenceStats _phantomReferenceStats; /**< Phantom reference stats for the cycle */6667UDATA _stringConstantsCleared; /**< The number of string constants that have been cleared during marking */68UDATA _stringConstantsCandidates; /**< The number of string constants that have been visited in string table during marking */6970UDATA _monitorReferenceCleared; /**< The number of monitor references that have been cleared during marking */71UDATA _monitorReferenceCandidates; /**< The number of monitor references that have been visited in monitor table during marking */7273#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)74UDATA _doubleMappedArrayletsCleared; /**< The number of double mapped arraylets that have been cleared durign marking */75UDATA _doubleMappedArrayletsCandidates; /**< The number of double mapped arraylets that have been visited during marking */76#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */7778#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)79UDATA _splitArraysProcessed; /**< The number of array chunks (not counting parts smaller than the split size) processed by this thread */80#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */8182U_64 _concurrentGCThreadsCPUStartTimeSum; /**< The sum of all gc cpu thread times when concurrent gc work began */83U_64 _concurrentGCThreadsCPUEndTimeSum; /**< The sum of all gc cpu thread times when concurrent gc work ended */84U_64 _concurrentMarkGCThreadsTotalWorkTime; /**< The slowdown attributed to concurrent GC work */85/* function members */86private:87protected:88public:8990void clear()91{92MM_MarkVLHGCStatsCore::clear();93_unfinalizedCandidates = 0;94_unfinalizedEnqueued = 0;9596_ownableSynchronizerCandidates = 0;97_ownableSynchronizerSurvived = 0;98_ownableSynchronizerCleared = 0;99100_weakReferenceStats.clear();101_softReferenceStats.clear();102_phantomReferenceStats.clear();103104_stringConstantsCleared = 0;105_stringConstantsCandidates = 0;106107_monitorReferenceCleared = 0;108_monitorReferenceCandidates = 0;109110#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)111_doubleMappedArrayletsCleared = 0;112_doubleMappedArrayletsCandidates = 0;113#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */114115#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)116_splitArraysProcessed = 0;117#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */118119_concurrentGCThreadsCPUStartTimeSum = 0;120_concurrentGCThreadsCPUEndTimeSum = 0;121_concurrentMarkGCThreadsTotalWorkTime = 0;122123}124125void merge(MM_MarkVLHGCStats *statsToMerge)126{127MM_MarkVLHGCStatsCore::merge(statsToMerge);128_unfinalizedCandidates += statsToMerge->_unfinalizedCandidates;129_unfinalizedEnqueued += statsToMerge->_unfinalizedEnqueued;130131_ownableSynchronizerCandidates += statsToMerge->_ownableSynchronizerCandidates;132_ownableSynchronizerSurvived += statsToMerge->_ownableSynchronizerSurvived;133_ownableSynchronizerCleared += statsToMerge->_ownableSynchronizerCleared;134135_weakReferenceStats.merge(&statsToMerge->_weakReferenceStats);136_softReferenceStats.merge(&statsToMerge->_softReferenceStats);137_phantomReferenceStats.merge(&statsToMerge->_phantomReferenceStats);138139_stringConstantsCleared += statsToMerge->_stringConstantsCleared;140_stringConstantsCandidates += statsToMerge->_stringConstantsCandidates;141142_monitorReferenceCleared += statsToMerge->_monitorReferenceCleared;143_monitorReferenceCandidates += statsToMerge->_monitorReferenceCandidates;144145#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)146_doubleMappedArrayletsCleared += statsToMerge->_doubleMappedArrayletsCleared;147_doubleMappedArrayletsCandidates += statsToMerge->_doubleMappedArrayletsCandidates;148#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */149150_concurrentGCThreadsCPUStartTimeSum += statsToMerge->_concurrentGCThreadsCPUStartTimeSum;151_concurrentGCThreadsCPUEndTimeSum += statsToMerge->_concurrentGCThreadsCPUEndTimeSum;152_concurrentMarkGCThreadsTotalWorkTime += statsToMerge->_concurrentMarkGCThreadsTotalWorkTime;153154#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)155/* It may not ever be useful to merge these stats, but do it anyways */156_splitArraysProcessed += statsToMerge->_splitArraysProcessed;157#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */158}159160MM_MarkVLHGCStats() :161MM_MarkVLHGCStatsCore()162,_unfinalizedCandidates(0)163,_unfinalizedEnqueued(0)164,_ownableSynchronizerCandidates(0)165,_ownableSynchronizerSurvived(0)166,_ownableSynchronizerCleared(0)167,_weakReferenceStats()168,_softReferenceStats()169,_phantomReferenceStats()170,_stringConstantsCleared(0)171,_stringConstantsCandidates(0)172,_monitorReferenceCleared(0)173,_monitorReferenceCandidates(0)174#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)175,_doubleMappedArrayletsCleared(0)176,_doubleMappedArrayletsCandidates(0)177#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */178#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)179,_splitArraysProcessed(0)180#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */181,_concurrentGCThreadsCPUStartTimeSum(0)182,_concurrentGCThreadsCPUEndTimeSum(0)183,_concurrentMarkGCThreadsTotalWorkTime(0)184{185}186187};188189#endif /* J9VM_GC_VLHGC */190#endif /* MARKVLHGCSTATS_HPP_ */191192193