--- old/src/hotspot/share/gc/shared/gcTraceTime.inline.hpp 2020-02-24 07:47:41.065085939 +0000 +++ new/src/hotspot/share/gc/shared/gcTraceTime.inline.hpp 2020-02-24 07:47:40.805084520 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,8 @@ #define LOG_STOP_HEAP_FORMAT SIZE_FORMAT "M->" SIZE_FORMAT "M(" SIZE_FORMAT "M)" -inline void GCTraceTimeImpl::log_start(jlong start_counter) { +template +inline void GCTraceTimeImpl::log_start(jlong start_counter) { if (_out_start.is_enabled()) { LogStream out(_out_start); @@ -48,7 +49,8 @@ } } -inline void GCTraceTimeImpl::log_stop(jlong start_counter, jlong stop_counter) { +template +inline void GCTraceTimeImpl::log_stop(jlong start_counter, jlong stop_counter) { double duration_in_ms = TimeHelper::counter_to_millis(stop_counter - start_counter); double start_time_in_secs = TimeHelper::counter_to_seconds(start_counter); double stop_time_in_secs = TimeHelper::counter_to_seconds(stop_counter); @@ -72,13 +74,15 @@ out.print_cr(" %.3fms", duration_in_ms); } -inline void GCTraceTimeImpl::time_stamp(Ticks& ticks) { +template +inline void GCTraceTimeImpl::time_stamp(Ticks& ticks) { if (_enabled || _timer != NULL) { ticks.stamp(); } } -inline GCTraceTimeImpl::GCTraceTimeImpl(LogTargetHandle out_start, LogTargetHandle out_stop, const char* title, GCTimer* timer, GCCause::Cause gc_cause, bool log_heap_usage) : +template +inline GCTraceTimeImpl::GCTraceTimeImpl(Handle1 out_start, Handle2 out_stop, const char* title, GCTimer* timer, GCCause::Cause gc_cause, bool log_heap_usage) : _out_start(out_start), _out_stop(out_stop), _enabled(out_stop.is_enabled()), @@ -99,8 +103,8 @@ _timer->register_gc_phase_start(_title, _start_ticks); } } - -inline GCTraceTimeImpl::~GCTraceTimeImpl() { +template +inline GCTraceTimeImpl::~GCTraceTimeImpl() { Ticks stop_ticks; time_stamp(stop_ticks); if (_enabled) { @@ -150,10 +154,23 @@ STATIC_ASSERT(T4 == LogTag::__NO_TAG); // Need to leave at least the last tag for the "start" tag in log_start() } +template +GCAsyncTraceTimeImplWrapper::GCAsyncTraceTimeImplWrapper( + const char* title, GCTimer* timer, GCCause::Cause gc_cause, bool log_heap_usage) + : _impl( + AsyncLogTargetHandle::create(), + AsyncLogTargetHandle::create(), + title, + timer, + gc_cause, + log_heap_usage) { + + STATIC_ASSERT(T0 != LogTag::__NO_TAG); // Need some tag to log on. + STATIC_ASSERT(T4 == LogTag::__NO_TAG); // Need to leave at least the last tag for the "start" tag in log_start() +} + #undef INJECT_START_TAG -template -GCTraceTimeImplWrapper::~GCTraceTimeImplWrapper() {} #define GCTraceTime(Level, ...) GCTraceTimeImplWrapper #define GCTraceConcTime(Level, ...) GCTraceConcTimeImpl