8310354: G1: Annotate G1MMUTracker::when_sec with const

Reviewed-by: tschatzl, kbarrett
This commit is contained in:
Albert Mingkun Yang 2023-06-26 12:14:00 +00:00
parent a420ff48da
commit 5271f4def6
2 changed files with 8 additions and 8 deletions

View File

@ -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.
@ -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;

View File

@ -35,9 +35,9 @@ private:
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;
@ -95,7 +95,7 @@ private:
int _tail_index;
int _no_entries;
inline int trim_index(int index) {
inline int trim_index(int index) const {
return (index + QueueLength) % QueueLength;
}
@ -110,13 +110,13 @@ public:
// 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());
}
};