8028128: Add a type safe alternative for working with counter based data

Reviewed-by: dholmes, egahlin
This commit is contained in:
Markus Grönlund 2013-11-23 12:25:13 +01:00
parent 9963570316
commit b1e3461fe5
37 changed files with 522 additions and 235 deletions

View file

@ -32,6 +32,7 @@
#include "memory/referenceProcessorStats.hpp"
#include "runtime/os.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/ticks.inline.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/evacuationInfo.hpp"
@ -45,7 +46,7 @@ static GCId create_new_gc_id() {
return GCTracer_next_gc_id++;
}
void GCTracer::report_gc_start_impl(GCCause::Cause cause, jlong timestamp) {
void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) {
assert_unset_gc_id();
GCId gc_id = create_new_gc_id();
@ -54,7 +55,7 @@ void GCTracer::report_gc_start_impl(GCCause::Cause cause, jlong timestamp) {
_shared_gc_info.set_start_timestamp(timestamp);
}
void GCTracer::report_gc_start(GCCause::Cause cause, jlong timestamp) {
void GCTracer::report_gc_start(GCCause::Cause cause, const Ticks& timestamp) {
assert_unset_gc_id();
report_gc_start_impl(cause, timestamp);
@ -64,7 +65,7 @@ bool GCTracer::has_reported_gc_start() const {
return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID;
}
void GCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();
_shared_gc_info.set_sum_of_pauses(time_partitions->sum_of_pauses());
@ -75,7 +76,7 @@ void GCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitio
send_garbage_collection_event();
}
void GCTracer::report_gc_end(jlong timestamp, TimePartitions* time_partitions) {
void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();
report_gc_end_impl(timestamp, time_partitions);
@ -97,10 +98,10 @@ class ObjectCountEventSenderClosure : public KlassInfoClosure {
const GCId _gc_id;
const double _size_threshold_percentage;
const size_t _total_size_in_words;
const jlong _timestamp;
const Ticks _timestamp;
public:
ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) :
ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, const Ticks& timestamp) :
_gc_id(gc_id),
_size_threshold_percentage(ObjectCountCutOffPercent / 100),
_total_size_in_words(total_size_in_words),
@ -131,9 +132,7 @@ void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) {
if (!cit.allocation_failed()) {
HeapInspection hi(false, false, false, NULL);
hi.populate_table(&cit, is_alive_cl);
jlong timestamp = os::elapsed_counter();
ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp);
ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), Ticks::now());
cit.iterate(&event_sender);
}
}
@ -147,7 +146,7 @@ void GCTracer::report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& he
send_meta_space_summary_event(when, meta_space_summary);
}
void YoungGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
void YoungGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();
assert(_tenuring_threshold != UNSET_TENURING_THRESHOLD, "Tenuring threshold has not been reported");
@ -167,14 +166,14 @@ void YoungGCTracer::report_tenuring_threshold(const uint tenuring_threshold) {
_tenuring_threshold = tenuring_threshold;
}
void OldGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();
GCTracer::report_gc_end_impl(timestamp, time_partitions);
send_old_gc_event();
}
void ParallelOldTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
void ParallelOldTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();
OldGCTracer::report_gc_end_impl(timestamp, time_partitions);
@ -200,7 +199,7 @@ void G1NewTracer::report_yc_type(G1YCType type) {
_g1_young_gc_info.set_type(type);
}
void G1NewTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
assert_set_gc_id();
YoungGCTracer::report_gc_end_impl(timestamp, time_partitions);