Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
38920 views
/*1* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP25#define SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP2627#include "memory/allocation.hpp"2829class LineBuffer;3031template <class T> class WorkerDataArray;3233class G1GCPhaseTimes : public CHeapObj<mtGC> {34friend class G1GCParPhasePrinter;3536uint _active_gc_threads;37uint _max_gc_threads;3839public:40enum GCParPhases {41GCWorkerStart,42ExtRootScan,43ThreadRoots,44StringTableRoots,45UniverseRoots,46JNIRoots,47ObjectSynchronizerRoots,48FlatProfilerRoots,49ManagementRoots,50SystemDictionaryRoots,51CLDGRoots,52JVMTIRoots,53CodeCacheRoots,54CMRefRoots,55WaitForStrongCLD,56WeakCLDRoots,57SATBFiltering,58UpdateRS,59ScanRS,60CodeRoots,61ObjCopy,62Termination,63Other,64GCWorkerTotal,65GCWorkerEnd,66StringDedupQueueFixup,67StringDedupTableFixup,68RedirtyCards,69GCParPhasesSentinel70};7172private:73// Markers for grouping the phases in the GCPhases enum above74static const int GCMainParPhasesLast = GCWorkerEnd;75static const int StringDedupPhasesFirst = StringDedupQueueFixup;76static const int StringDedupPhasesLast = StringDedupTableFixup;7778WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel];79WorkerDataArray<size_t>* _update_rs_processed_buffers;80WorkerDataArray<size_t>* _termination_attempts;81WorkerDataArray<size_t>* _redirtied_cards;8283double _cur_collection_par_time_ms;84double _cur_collection_code_root_fixup_time_ms;85double _cur_strong_code_root_purge_time_ms;8687double _cur_evac_fail_recalc_used;88double _cur_evac_fail_restore_remsets;89double _cur_evac_fail_remove_self_forwards;9091double _cur_string_dedup_fixup_time_ms;9293double _cur_clear_ct_time_ms;94double _cur_ref_proc_time_ms;95double _cur_ref_enq_time_ms;9697double _cur_collection_start_sec;98double _root_region_scan_wait_time_ms;99100double _recorded_young_cset_choice_time_ms;101double _recorded_non_young_cset_choice_time_ms;102103double _recorded_redirty_logged_cards_time_ms;104105double _recorded_young_free_cset_time_ms;106double _recorded_non_young_free_cset_time_ms;107108double _cur_fast_reclaim_humongous_time_ms;109double _cur_fast_reclaim_humongous_register_time_ms;110size_t _cur_fast_reclaim_humongous_total;111size_t _cur_fast_reclaim_humongous_candidates;112size_t _cur_fast_reclaim_humongous_reclaimed;113114double _cur_verify_before_time_ms;115double _cur_verify_after_time_ms;116117// Helper methods for detailed logging118void print_stats(int level, const char* str, double value);119void print_stats(int level, const char* str, size_t value);120void print_stats(int level, const char* str, double value, uint workers);121122public:123G1GCPhaseTimes(uint max_gc_threads);124void note_gc_start(uint active_gc_threads, bool mark_in_progress);125void note_gc_end();126void print(double pause_time_sec);127128// record the time a phase took in seconds129void record_time_secs(GCParPhases phase, uint worker_i, double secs);130131// add a number of seconds to a phase132void add_time_secs(GCParPhases phase, uint worker_i, double secs);133134void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count);135136// return the average time for a phase in milliseconds137double average_time_ms(GCParPhases phase);138139size_t sum_thread_work_items(GCParPhases phase);140141private:142double get_time_ms(GCParPhases phase, uint worker_i);143double sum_time_ms(GCParPhases phase);144double min_time_ms(GCParPhases phase);145double max_time_ms(GCParPhases phase);146size_t get_thread_work_item(GCParPhases phase, uint worker_i);147double average_thread_work_items(GCParPhases phase);148size_t min_thread_work_items(GCParPhases phase);149size_t max_thread_work_items(GCParPhases phase);150151public:152153void record_clear_ct_time(double ms) {154_cur_clear_ct_time_ms = ms;155}156157void record_par_time(double ms) {158_cur_collection_par_time_ms = ms;159}160161void record_code_root_fixup_time(double ms) {162_cur_collection_code_root_fixup_time_ms = ms;163}164165void record_strong_code_root_purge_time(double ms) {166_cur_strong_code_root_purge_time_ms = ms;167}168169void record_evac_fail_recalc_used_time(double ms) {170_cur_evac_fail_recalc_used = ms;171}172173void record_evac_fail_restore_remsets(double ms) {174_cur_evac_fail_restore_remsets = ms;175}176177void record_evac_fail_remove_self_forwards(double ms) {178_cur_evac_fail_remove_self_forwards = ms;179}180181void record_string_dedup_fixup_time(double ms) {182_cur_string_dedup_fixup_time_ms = ms;183}184185void record_ref_proc_time(double ms) {186_cur_ref_proc_time_ms = ms;187}188189void record_ref_enq_time(double ms) {190_cur_ref_enq_time_ms = ms;191}192193void record_root_region_scan_wait_time(double time_ms) {194_root_region_scan_wait_time_ms = time_ms;195}196197void record_young_free_cset_time_ms(double time_ms) {198_recorded_young_free_cset_time_ms = time_ms;199}200201void record_non_young_free_cset_time_ms(double time_ms) {202_recorded_non_young_free_cset_time_ms = time_ms;203}204205void record_fast_reclaim_humongous_stats(double time_ms, size_t total, size_t candidates) {206_cur_fast_reclaim_humongous_register_time_ms = time_ms;207_cur_fast_reclaim_humongous_total = total;208_cur_fast_reclaim_humongous_candidates = candidates;209}210211void record_fast_reclaim_humongous_time_ms(double value, size_t reclaimed) {212_cur_fast_reclaim_humongous_time_ms = value;213_cur_fast_reclaim_humongous_reclaimed = reclaimed;214}215216void record_young_cset_choice_time_ms(double time_ms) {217_recorded_young_cset_choice_time_ms = time_ms;218}219220void record_non_young_cset_choice_time_ms(double time_ms) {221_recorded_non_young_cset_choice_time_ms = time_ms;222}223224void record_redirty_logged_cards_time_ms(double time_ms) {225_recorded_redirty_logged_cards_time_ms = time_ms;226}227228void record_cur_collection_start_sec(double time_ms) {229_cur_collection_start_sec = time_ms;230}231232void record_verify_before_time_ms(double time_ms) {233_cur_verify_before_time_ms = time_ms;234}235236void record_verify_after_time_ms(double time_ms) {237_cur_verify_after_time_ms = time_ms;238}239240double accounted_time_ms();241242double cur_collection_start_sec() {243return _cur_collection_start_sec;244}245246double cur_collection_par_time_ms() {247return _cur_collection_par_time_ms;248}249250double cur_clear_ct_time_ms() {251return _cur_clear_ct_time_ms;252}253254double root_region_scan_wait_time_ms() {255return _root_region_scan_wait_time_ms;256}257258double young_cset_choice_time_ms() {259return _recorded_young_cset_choice_time_ms;260}261262double young_free_cset_time_ms() {263return _recorded_young_free_cset_time_ms;264}265266double non_young_cset_choice_time_ms() {267return _recorded_non_young_cset_choice_time_ms;268}269270double non_young_free_cset_time_ms() {271return _recorded_non_young_free_cset_time_ms;272}273274double fast_reclaim_humongous_time_ms() {275return _cur_fast_reclaim_humongous_time_ms;276}277};278279class G1GCParPhaseTimesTracker : public StackObj {280Ticks _start_time;281G1GCPhaseTimes::GCParPhases _phase;282G1GCPhaseTimes* _phase_times;283uint _worker_id;284public:285G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);286~G1GCParPhaseTimesTracker();287};288289#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP290291292