Skip to content

Commit

Permalink
8310354: G1: Annotate G1MMUTracker::when_sec with const
Browse files Browse the repository at this point in the history
Reviewed-by: tschatzl, kbarrett
  • Loading branch information
albertnetymk committed Jun 26, 2023
1 parent a420ff4 commit 5271f4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1MMUTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void G1MMUTracker::add_pause(double start, double end) {
//
// When there are not enough GC events, i.e. we have a surplus budget, a new GC
// pause can start right away, so return 0.
double G1MMUTracker::when_sec(double current_timestamp, double pause_time) {
double G1MMUTracker::when_sec(double current_timestamp, double pause_time) const {
assert(pause_time > 0.0, "precondition");

// If the pause is over the maximum, just assume that it's the maximum.
Expand All @@ -148,7 +148,7 @@ double G1MMUTracker::when_sec(double current_timestamp, double pause_time) {
// Iterate from newest to oldest.
for (int i = 0; i < _no_entries; ++i) {
int index = trim_index(_head_index - i);
G1MMUTrackerElem *elem = &_array[index];
const G1MMUTrackerElem *elem = &_array[index];
// Outside the window.
if (elem->end_time() <= limit) {
break;
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/gc/g1/g1MMUTracker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class G1MMUTrackerElem {
double _end_time;

public:
inline double start_time() { return _start_time; }
inline double end_time() { return _end_time; }
inline double duration() { return _end_time - _start_time; }
inline double start_time() const { return _start_time; }
inline double end_time() const { return _end_time; }
inline double duration() const { return _end_time - _start_time; }

G1MMUTrackerElem() {
_start_time = 0.0;
Expand Down Expand Up @@ -95,7 +95,7 @@ class G1MMUTracker: public CHeapObj<mtGC> {
int _tail_index;
int _no_entries;

inline int trim_index(int index) {
inline int trim_index(int index) const {
return (index + QueueLength) % QueueLength;
}

Expand All @@ -110,13 +110,13 @@ class G1MMUTracker: public CHeapObj<mtGC> {

// Minimum delay required from current_timestamp until a GC pause of duration
// pause_time may be scheduled without violating the MMU constraint.
double when_sec(double current_timestamp, double pause_time);
double when_sec(double current_timestamp, double pause_time) const;

double max_gc_time() const {
return _max_gc_time;
}

double when_max_gc_sec(double current_time) {
double when_max_gc_sec(double current_time) const {
return when_sec(current_time, max_gc_time());
}
};
Expand Down

1 comment on commit 5271f4d

@openjdk-notifier
Copy link

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.