31 #include "jfr/leakprofiler/checkpoint/objectSampleWriter.hpp" |
31 #include "jfr/leakprofiler/checkpoint/objectSampleWriter.hpp" |
32 #include "jfr/leakprofiler/checkpoint/rootResolver.hpp" |
32 #include "jfr/leakprofiler/checkpoint/rootResolver.hpp" |
33 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
33 #include "jfr/leakprofiler/sampling/objectSampler.hpp" |
34 #include "jfr/leakprofiler/utilities/rootType.hpp" |
34 #include "jfr/leakprofiler/utilities/rootType.hpp" |
35 #include "jfr/leakprofiler/utilities/unifiedOop.hpp" |
35 #include "jfr/leakprofiler/utilities/unifiedOop.hpp" |
|
36 #include "jfr/metadata/jfrSerializer.hpp" |
36 #include "jfr/writers/jfrTypeWriterHost.hpp" |
37 #include "jfr/writers/jfrTypeWriterHost.hpp" |
37 #include "oops/oop.inline.hpp" |
38 #include "oops/oop.inline.hpp" |
38 #include "oops/symbol.hpp" |
39 #include "oops/symbol.hpp" |
39 #include "utilities/growableArray.hpp" |
40 #include "utilities/growableArray.hpp" |
40 |
41 |
578 add_gc_root_info(edge, id); |
579 add_gc_root_info(edge, id); |
579 } |
580 } |
580 } |
581 } |
581 } |
582 } |
582 |
583 |
|
584 class RootSystemType : public JfrSerializer { |
|
585 public: |
|
586 void serialize(JfrCheckpointWriter& writer) { |
|
587 const u4 nof_root_systems = OldObjectRoot::_number_of_systems; |
|
588 writer.write_count(nof_root_systems); |
|
589 for (u4 i = 0; i < nof_root_systems; ++i) { |
|
590 writer.write_key(i); |
|
591 writer.write(OldObjectRoot::system_description((OldObjectRoot::System)i)); |
|
592 } |
|
593 } |
|
594 }; |
|
595 |
|
596 class RootType : public JfrSerializer { |
|
597 public: |
|
598 void serialize(JfrCheckpointWriter& writer) { |
|
599 const u4 nof_root_types = OldObjectRoot::_number_of_types; |
|
600 writer.write_count(nof_root_types); |
|
601 for (u4 i = 0; i < nof_root_types; ++i) { |
|
602 writer.write_key(i); |
|
603 writer.write(OldObjectRoot::type_description((OldObjectRoot::Type)i)); |
|
604 } |
|
605 } |
|
606 }; |
|
607 |
|
608 static void register_serializers() { |
|
609 static bool is_registered = false; |
|
610 if (!is_registered) { |
|
611 JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTSYSTEM, true, new RootSystemType()); |
|
612 JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTTYPE, true, new RootType()); |
|
613 is_registered = true; |
|
614 } |
|
615 } |
|
616 |
583 ObjectSampleWriter::ObjectSampleWriter(JfrCheckpointWriter& writer, EdgeStore* store) : |
617 ObjectSampleWriter::ObjectSampleWriter(JfrCheckpointWriter& writer, EdgeStore* store) : |
584 _writer(writer), |
618 _writer(writer), |
585 _store(store) { |
619 _store(store) { |
586 assert(store != NULL, "invariant"); |
620 assert(store != NULL, "invariant"); |
587 assert(!store->is_empty(), "invariant"); |
621 assert(!store->is_empty(), "invariant"); |
|
622 register_serializers(); |
588 sample_infos = NULL; |
623 sample_infos = NULL; |
589 ref_infos = NULL; |
624 ref_infos = NULL; |
590 array_infos = NULL; |
625 array_infos = NULL; |
591 field_infos = NULL; |
626 field_infos = NULL; |
592 root_infos = NULL; |
627 root_infos = NULL; |