src/hotspot/share/gc/shared/collectorCounters.cpp
changeset 48115 d8ec0640616c
parent 47216 71c04702a3d5
child 48157 7c4d43c26352
--- a/src/hotspot/share/gc/shared/collectorCounters.cpp	Fri Nov 24 15:21:28 2017 +0100
+++ b/src/hotspot/share/gc/shared/collectorCounters.cpp	Fri Nov 24 15:21:30 2017 +0100
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "gc/shared/collectorCounters.hpp"
 #include "memory/resourceArea.hpp"
+#include "runtime/os.hpp"
 
 CollectorCounters::CollectorCounters(const char* name, int ordinal) {
 
@@ -59,3 +60,24 @@
                                                        CHECK);
   }
 }
+
+CollectorCounters::~CollectorCounters() {
+  if (_name_space != NULL) {
+    FREE_C_HEAP_ARRAY(char, _name_space);
+  }
+}
+
+TraceCollectorStats::TraceCollectorStats(CollectorCounters* c) :
+    PerfTraceTimedEvent(c->time_counter(), c->invocation_counter()),
+    _c(c) {
+
+  if (UsePerfData) {
+     _c->last_entry_counter()->set_value(os::elapsed_counter());
+  }
+}
+
+TraceCollectorStats::~TraceCollectorStats() {
+  if (UsePerfData) {
+    _c->last_exit_counter()->set_value(os::elapsed_counter());
+  }
+}