src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp
changeset 50525 767cdb97f103
parent 50113 caf115bb98ad
child 50703 0486d7749b8d
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp	Tue Jun 12 07:52:30 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp	Tue Jun 12 17:40:28 2018 +0200
@@ -59,6 +59,9 @@
 #include "gc/g1/g1HeapRegionTraceType.hpp"
 #include "gc/g1/g1YCTypes.hpp"
 #endif
+#if INCLUDE_ZGC
+#include "gc/z/zStat.hpp"
+#endif
 
 // implementation for the static registration function exposed in the api
 bool JfrSerializer::register_serializer(JfrTypeId id, bool require_safepoint, bool permit_cache, JfrSerializer* cs) {
@@ -346,3 +349,27 @@
   writer.write(thread_group_id);
   JfrThreadGroup::serialize(&writer, thread_group_id);
 }
+
+void ZStatisticsCounterTypeConstant::serialize(JfrCheckpointWriter& writer) {
+#if INCLUDE_ZGC
+  writer.write_count(ZStatCounter::count());
+  for (ZStatCounter* counter = ZStatCounter::first(); counter != NULL; counter = counter->next()) {
+    writer.write_key(counter->id());
+    writer.write(counter->name());
+  }
+#else
+  writer.write_count(0);
+#endif
+}
+
+void ZStatisticsSamplerTypeConstant::serialize(JfrCheckpointWriter& writer) {
+#if INCLUDE_ZGC
+  writer.write_count(ZStatSampler::count());
+  for (ZStatSampler* sampler = ZStatSampler::first(); sampler != NULL; sampler = sampler->next()) {
+    writer.write_key(sampler->id());
+    writer.write(sampler->name());
+  }
+#else
+  writer.write_count(0);
+#endif
+}