26 #include "gc/z/zTracer.hpp" |
26 #include "gc/z/zTracer.hpp" |
27 #include "gc/shared/gcId.hpp" |
27 #include "gc/shared/gcId.hpp" |
28 #include "gc/shared/gcLocker.hpp" |
28 #include "gc/shared/gcLocker.hpp" |
29 #include "jfr/jfrEvents.hpp" |
29 #include "jfr/jfrEvents.hpp" |
30 #include "runtime/safepointVerifiers.hpp" |
30 #include "runtime/safepointVerifiers.hpp" |
|
31 #if INCLUDE_JFR |
|
32 #include "jfr/metadata/jfrSerializer.hpp" |
|
33 #endif |
|
34 |
|
35 #if INCLUDE_JFR |
|
36 class ZStatisticsCounterTypeConstant : public JfrSerializer { |
|
37 public: |
|
38 virtual void serialize(JfrCheckpointWriter& writer) { |
|
39 writer.write_count(ZStatCounter::count()); |
|
40 for (ZStatCounter* counter = ZStatCounter::first(); counter != NULL; counter = counter->next()) { |
|
41 writer.write_key(counter->id()); |
|
42 writer.write(counter->name()); |
|
43 } |
|
44 } |
|
45 }; |
|
46 |
|
47 class ZStatisticsSamplerTypeConstant : public JfrSerializer { |
|
48 public: |
|
49 virtual void serialize(JfrCheckpointWriter& writer) { |
|
50 writer.write_count(ZStatSampler::count()); |
|
51 for (ZStatSampler* sampler = ZStatSampler::first(); sampler != NULL; sampler = sampler->next()) { |
|
52 writer.write_key(sampler->id()); |
|
53 writer.write(sampler->name()); |
|
54 } |
|
55 } |
|
56 }; |
|
57 |
|
58 static void register_jfr_type_serializers() { |
|
59 JfrSerializer::register_serializer(TYPE_ZSTATISTICSCOUNTERTYPE, |
|
60 false /* require_safepoint */, |
|
61 true /* permit_cache */, |
|
62 new ZStatisticsCounterTypeConstant()); |
|
63 JfrSerializer::register_serializer(TYPE_ZSTATISTICSSAMPLERTYPE, |
|
64 false /* require_safepoint */, |
|
65 true /* permit_cache */, |
|
66 new ZStatisticsSamplerTypeConstant()); |
|
67 } |
|
68 #endif |
31 |
69 |
32 ZTracer* ZTracer::_tracer = NULL; |
70 ZTracer* ZTracer::_tracer = NULL; |
33 |
71 |
34 ZTracer::ZTracer() : |
72 ZTracer::ZTracer() : |
35 GCTracer(Z) {} |
73 GCTracer(Z) {} |
36 |
74 |
37 void ZTracer::initialize() { |
75 void ZTracer::initialize() { |
|
76 assert(_tracer == NULL, "Already initialized"); |
38 _tracer = new (ResourceObj::C_HEAP, mtGC) ZTracer(); |
77 _tracer = new (ResourceObj::C_HEAP, mtGC) ZTracer(); |
|
78 JFR_ONLY(register_jfr_type_serializers()); |
39 } |
79 } |
40 |
80 |
41 void ZTracer::send_stat_counter(uint32_t counter_id, uint64_t increment, uint64_t value) { |
81 void ZTracer::send_stat_counter(uint32_t counter_id, uint64_t increment, uint64_t value) { |
42 NoSafepointVerifier nsv(true, !SafepointSynchronize::is_at_safepoint()); |
82 NoSafepointVerifier nsv(true, !SafepointSynchronize::is_at_safepoint()); |
43 |
83 |