< prev index next >

src/hotspot/share/gc/shared/gcTraceTime.hpp

Print this page
rev 58036 : [mq]: asynclog

@@ -1,7 +1,7 @@
 /*
- * 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -41,14 +41,15 @@
   ~GCTraceCPUTime();
 };
 
 class GCTimer;
 
+template <typename Handle1, typename Handle2>
 class GCTraceTimeImpl : public StackObj {
  private:
-  LogTargetHandle _out_start;
-  LogTargetHandle _out_stop;
+  Handle1 _out_start;
+  Handle2 _out_stop;
   bool _enabled;
   Ticks _start_ticks;
   const char* _title;
   GCCause::Cause _gc_cause;
   GCTimer* _timer;

@@ -57,22 +58,29 @@
   void log_start(jlong start_counter);
   void log_stop(jlong start_counter, jlong stop_counter);
   void time_stamp(Ticks& ticks);
 
  public:
-  GCTraceTimeImpl(LogTargetHandle out_start, LogTargetHandle out_end, const char* title, GCTimer* timer = NULL, GCCause::Cause gc_cause = GCCause::_no_gc, bool log_heap_usage = false);
+  GCTraceTimeImpl(Handle1 out_start, Handle2 out_end, const char* title, GCTimer* timer = NULL, GCCause::Cause gc_cause = GCCause::_no_gc, bool log_heap_usage = false);
   ~GCTraceTimeImpl();
 };
 
 template <LogLevelType Level, LogTagType T0, LogTagType T1, LogTagType T2, LogTagType T3, LogTagType T4, LogTagType GuardTag>
 class GCTraceTimeImplWrapper : public StackObj {
-  GCTraceTimeImpl _impl;
+  typedef GCTraceTimeImpl<LogTargetHandle, LogTargetHandle> handle_t;
+  const handle_t _impl;
 public:
   GCTraceTimeImplWrapper(const char* title, GCTimer* timer = NULL, GCCause::Cause gc_cause = GCCause::_no_gc, bool log_heap_usage = false);
-  ~GCTraceTimeImplWrapper();
 };
 
+template <LogLevelType Level, LogTagType T0, LogTagType T1, LogTagType T2, LogTagType T3, LogTagType T4, LogTagType GuardTag>
+class GCAsyncTraceTimeImplWrapper : public StackObj {
+  typedef GCTraceTimeImpl<AsyncLogTargetHandle, AsyncLogTargetHandle> handle_t;
+  const handle_t _impl;
+public:
+  GCAsyncTraceTimeImplWrapper(const char* title, GCTimer* timer = NULL, GCCause::Cause gc_cause = GCCause::_no_gc, bool log_heap_usage = false);
+};
 // Similar to GCTraceTimeImpl but is intended for concurrent phase logging,
 // which is a bit simpler and should always print the start line, i.e. not add the "start" tag.
 template <LogLevelType Level, LogTagType T0, LogTagType T1 = LogTag::__NO_TAG, LogTagType T2 = LogTag::__NO_TAG, LogTagType T3 = LogTag::__NO_TAG,
     LogTagType T4 = LogTag::__NO_TAG, LogTagType GuardTag = LogTag::__NO_TAG>
 class GCTraceConcTimeImpl : public StackObj {
< prev index next >