Skip to content
Permalink
Browse files
8278276: G1: Refine naming of G1GCParPhaseTimesTracker::_must_record
Reviewed-by: sjohanss, tschatzl
  • Loading branch information
Hamlin Li committed Dec 8, 2021
1 parent d7ad546 commit fb6d6113112d8a15864195ccd59b583fc12087fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,10 +36,10 @@ class G1GCParPhaseTimesTracker : public CHeapObj<mtGC> {
G1GCPhaseTimes* _phase_times;
uint _worker_id;
EventGCPhaseParallel _event;
bool _must_record;
bool _allow_multiple_record;

public:
G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id, bool must_record = true);
G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id, bool allow_multiple_record = false);
virtual ~G1GCParPhaseTimesTracker();
};

@@ -574,19 +574,19 @@ void G1EvacPhaseWithTrimTimeTracker::stop() {
_stopped = true;
}

G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id, bool must_record) :
_start_time(), _phase(phase), _phase_times(phase_times), _worker_id(worker_id), _event(), _must_record(must_record) {
G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id, bool allow_multiple_record) :
_start_time(), _phase(phase), _phase_times(phase_times), _worker_id(worker_id), _event(), _allow_multiple_record(allow_multiple_record) {
if (_phase_times != NULL) {
_start_time = Ticks::now();
}
}

G1GCParPhaseTimesTracker::~G1GCParPhaseTimesTracker() {
if (_phase_times != NULL) {
if (_must_record) {
_phase_times->record_time_secs(_phase, _worker_id, (Ticks::now() - _start_time).seconds());
} else {
if (_allow_multiple_record) {
_phase_times->record_or_add_time_secs(_phase, _worker_id, (Ticks::now() - _start_time).seconds());
} else {
_phase_times->record_time_secs(_phase, _worker_id, (Ticks::now() - _start_time).seconds());
}
_event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_phase));
}
@@ -1423,7 +1423,7 @@ class G1MergeHeapRootsTask : public WorkerTask {

// Merge remembered sets of current candidates.
{
G1GCParPhaseTimesTracker x(p, merge_remset_phase, worker_id, _initial_evacuation /* must_record */);
G1GCParPhaseTimesTracker x(p, merge_remset_phase, worker_id, !_initial_evacuation /* allow_multiple_record */);
G1MergeCardSetStats stats;
{
G1MergeCardSetClosure cl(_scan_state);

1 comment on commit fb6d611

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on fb6d611 Dec 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.