Path: blob/master/runtime/gc_stats/VLHGCIncrementStats.hpp
5986 views
1/*******************************************************************************2* Copyright (c) 1991, 2020 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(VLHGC_INCREMENT_STATS_HPP_)29#define VLHGC_INCREMENT_STATS_HPP_3031#include "j9.h"32#include "j9cfg.h"33#include "j9port.h"34#include "j9consts.h"35#include "modronopt.h"3637#if defined(J9VM_GC_VLHGC)3839#include "Base.hpp"40#include "ClassUnloadStats.hpp"41#if defined(J9VM_GC_MODRON_COMPACTION)42#include "CompactVLHGCStats.hpp"43#endif /* J9VM_GC_MODRON_COMPACTION */44#include "CopyForwardStats.hpp"45#include "InterRegionRememberedSetStats.hpp"46#include "MarkVLHGCStats.hpp"47#include "SweepVLHGCStats.hpp"48#include "WorkPacketStats.hpp"4950/**51* Storage for statistics relevant to the sweep phase of global collection52* @ingroup GC_Stats53*/54class MM_VLHGCIncrementStats : public MM_Base55{56public:57class MM_MarkVLHGCStats _markStats; /**< Stats for mark phase of increment */58class MM_SweepVLHGCStats _sweepStats; /**< Stats for sweep phase of increment */59#if defined(J9VM_GC_MODRON_COMPACTION)60class MM_CompactVLHGCStats _compactStats; /**< Stats for compact phase of increment */61#endif /* J9VM_GC_MODRON_COMPACTION */62class MM_WorkPacketStats _workPacketStats; /**< Stats for work packet activity of increment */63class MM_CopyForwardStats _copyForwardStats; /**< Stats for copy forward phase of increment */64class MM_ClassUnloadStats _classUnloadStats; /**< Stats for class unload operations of the increment */65class MM_InterRegionRememberedSetStats _irrsStats; /**< Stats for Inter Region Remembered Set processing */6667enum GlobalMarkIncrementType {68mark_idle = 0, /**< No Global marking in progress */69mark_concurrent = 1, /**< Global marking is being performed concurrently with mutator */70mark_incremental = 2, /**< Global marking is being performed non-concurrently in stop-the-world increments */71mark_global_collection = 3, /** Global marking is being performed as part of a global collection */72} _globalMarkIncrementType;7374public:75MM_VLHGCIncrementStats() :76_markStats()77,_sweepStats()78#if defined(J9VM_GC_MODRON_COMPACTION)79,_compactStats()80#endif /* J9VM_GC_MODRON_COMPACTION */81,_workPacketStats()82,_copyForwardStats()83,_classUnloadStats()84,_irrsStats()85,_globalMarkIncrementType(MM_VLHGCIncrementStats::mark_idle)86{};8788/**89* Reset the statistics of the receiver for a new round.90*/91MMINLINE void clear()92{93_markStats.clear();94_sweepStats.clear();95#if defined(J9VM_GC_MODRON_COMPACTION)96_compactStats.clear();97#endif /* J9VM_GC_MODRON_COMPACTION */98_workPacketStats.clear();99_copyForwardStats.clear();100_classUnloadStats.clear();101_irrsStats.clear();102_globalMarkIncrementType = MM_VLHGCIncrementStats::mark_idle;103}104105/**106* Add / combine the statistics from the parameter to the receiver.107*/108MMINLINE void merge(MM_VLHGCIncrementStats *stats)109{110_markStats.merge(&stats->_markStats);111_sweepStats.merge(&stats->_sweepStats);112#if defined(J9VM_GC_MODRON_COMPACTION)113_compactStats.merge(&stats->_compactStats);114#endif /* J9VM_GC_MODRON_COMPACTION */115_workPacketStats.merge(&stats->_workPacketStats);116_copyForwardStats.merge(&stats->_copyForwardStats);117_irrsStats.merge(&stats->_irrsStats);118}119120/**121* Get total stall time122*/123uint64_t getTotalStallTime()124{125return _copyForwardStats.getStallTime() + _markStats.getStallTime() + _sweepStats.idleTime + _workPacketStats.getStallTime() + _compactStats._moveStallTime + _compactStats._rebuildStallTime;126}127};128129#endif /* J9VM_GC_VLHGC */130#endif /* VLHGC_INCREMENT_STATS_HPP_ */131132133