src/share/vm/gc_implementation/shared/gcTrace.cpp
Print this page
rev 5685 : 8028128: Add a type safe alternative for working with counter based data
Reviewed-by:
@@ -30,10 +30,11 @@
#include "gc_implementation/shared/objectCountEventSender.hpp"
#include "memory/heapInspection.hpp"
#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"
#endif
@@ -43,41 +44,41 @@
static GCId GCTracer_next_gc_id = 0;
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();
_shared_gc_info.set_id(gc_id);
_shared_gc_info.set_cause(cause);
_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);
}
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());
_shared_gc_info.set_longest_pause(time_partitions->longest_pause());
_shared_gc_info.set_end_timestamp(timestamp);
send_phase_events(time_partitions);
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);
_shared_gc_info.set_id(SharedGCInfo::UNSET_GCID);
@@ -95,14 +96,14 @@
#if INCLUDE_SERVICES
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),
_timestamp(timestamp)
{}
@@ -129,13 +130,11 @@
KlassInfoTable cit(false);
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);
}
}
}
#endif // INCLUDE_SERVICES
@@ -145,11 +144,11 @@
send_gc_heap_summary_event(when, heap_summary);
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");
GCTracer::report_gc_end_impl(timestamp, time_partitions);
send_young_gc_event();
@@ -165,18 +164,18 @@
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);
send_parallel_old_event();
}
@@ -198,11 +197,11 @@
assert_set_gc_id();
_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);
send_g1_young_gc_event();
}