/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "memory/allocation.hpp"
// Keeps track of the GC work and decides when it is OK to do GC work
// and for how long so that the MMU invariants are maintained.
/***** ALL TIMES ARE IN SECS!!!!!!! *****/
// this is the "interface"
protected:
double _time_slice;
public:
virtual double longest_pause(double current_time) = 0;
double max_gc_time() {
return _max_gc_time;
}
}
}
}
}
};
private:
double _start_time;
double _end_time;
public:
_start_time = 0.0;
_end_time = 0.0;
}
}
};
// this is an implementation of the MMUTracker using a (fixed-size) queue
// that keeps track of all the recent pause times
private:
enum PrivateConstants {
};
// The array keeps track of all the pauses that fall within a time
// slice (the last time slice during which pauses took place).
// The data structure implemented is a circular queue.
// Head "points" to the most recent addition, tail to the oldest one.
// The array is of fixed size and I don't think we'll need more than
// two or three entries with the current behaviour of G1 pauses.
// If the array is full, an easy fix is to look for the pauses with
// the shortest gap between them and consolidate them.
// For now, we have taken the expedient alternative of forgetting
// the oldest entry in the event that +G1UseFixedWindowMMUTracker, thus
// potentially violating MMU specs for some time thereafter.
int _head_index;
int _tail_index;
int _no_entries;
}
void remove_expired_entries(double current_time);
double calculate_gc_time(double current_time);
double longest_pause_internal(double current_time);
public:
virtual double longest_pause(double current_time);
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP