optimization to avoid retagging and already tagged set of stacktraces JEP-349-branch
authormgronlun
Thu, 29 Aug 2019 15:16:13 +0200
branchJEP-349-branch
changeset 57937 c72ed9929e02
parent 57936 1b2d0f4c1e38
child 57944 f1610739fe86
optimization to avoid retagging and already tagged set of stacktraces
src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp
src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp	Thu Aug 29 14:05:01 2019 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp	Thu Aug 29 15:16:13 2019 +0200
@@ -345,10 +345,17 @@
   }
 };
 
+static bool written = false;
+
 static void tag_old_stack_traces(ObjectSample* last_resolved, JfrStackTraceRepository& stack_trace_repo) {
   assert(last_resolved != NULL, "invariant");
   assert(stack_trace_id_set != NULL, "invariant");
   assert(stack_trace_id_set->is_empty(), "invariant");
+  if (written) {
+    // written -> retagged
+    written = false;
+    return;
+  }
   StackTraceTagger tagger(stack_trace_repo);
   do_samples(last_resolved, NULL, tagger);
 }
@@ -529,6 +536,7 @@
     return;
   }
   writer.write_count((u4)sw.count(), count_offset);
+  written = true;
 }
 
 void ObjectSampleCheckpoint::write(ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread) {
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp	Thu Aug 29 14:05:01 2019 +0200
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp	Thu Aug 29 15:16:13 2019 +0200
@@ -594,7 +594,7 @@
 };
 
 class RootType : public JfrSerializer {
-public:
+ public:
   void serialize(JfrCheckpointWriter& writer) {
     const u4 nof_root_types = OldObjectRoot::_number_of_types;
     writer.write_count(nof_root_types);