提交 61226506 编写于 作者: D Denghui Dong 提交者: D-D-H

[Backport] 8236263: Remove experimental streaming events

Summary:

Test Plan: jdk/jfr

Reviewed-by: yuleil

Issue: https://github.com/alibaba/dragonwell8/issues/112
上级 cab9c7ff
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
...@@ -936,36 +936,6 @@ ...@@ -936,36 +936,6 @@
<Field type="ulong" contentType="bytes" name="size" label="Size Written" /> <Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event> </Event>
<Event name="FlushStorage" category="Flight Recorder" label="Flush Storage" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushStacktrace" category="Flight Recorder" label="Flush Stacktrace" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushStringPool" category="Flight Recorder" label="Flush String Pool" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushMetadata" category="Flight Recorder" label="Flush Metadata" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Event name="FlushTypeSet" category="Flight Recorder" label="Flush Type Set" thread="false" experimental="true">
<Field type="ulong" name="flushId" label="Flush Identifier" relation="FlushId" />
<Field type="ulong" name="elements" label="Elements Written" />
<Field type="ulong" contentType="bytes" name="size" label="Size Written" />
</Event>
<Type name="ZStatisticsCounterType" label="Z Statistics Counter"> <Type name="ZStatisticsCounterType" label="Z Statistics Counter">
<Field type="string" name="counter" label="Counter" /> <Field type="string" name="counter" label="Counter" />
</Type> </Type>
......
...@@ -58,13 +58,12 @@ ...@@ -58,13 +58,12 @@
// incremented on each flushpoint // incremented on each flushpoint
static u8 flushpoint_id = 0; static u8 flushpoint_id = 0;
template <typename E, typename Instance, size_t(Instance::*func)()> template <typename Instance, size_t(Instance::*func)()>
class Content { class Content {
private: private:
Instance& _instance; Instance& _instance;
u4 _elements; u4 _elements;
public: public:
typedef E EventType;
Content(Instance& instance) : _instance(instance), _elements(0) {} Content(Instance& instance) : _instance(instance), _elements(0) {}
bool process() { bool process() {
_elements = (u4)(_instance.*func)(); _elements = (u4)(_instance.*func)();
...@@ -82,7 +81,6 @@ class WriteContent : public StackObj { ...@@ -82,7 +81,6 @@ class WriteContent : public StackObj {
Content& _content; Content& _content;
const int64_t _start_offset; const int64_t _start_offset;
public: public:
typedef typename Content::EventType EventType;
WriteContent(JfrChunkWriter& cw, Content& content) : WriteContent(JfrChunkWriter& cw, Content& content) :
_start_time(JfrTicks::now()), _start_time(JfrTicks::now()),
...@@ -128,14 +126,6 @@ class WriteContent : public StackObj { ...@@ -128,14 +126,6 @@ class WriteContent : public StackObj {
return (u4)(end_offset() - start_offset()); return (u4)(end_offset() - start_offset());
} }
static bool is_event_enabled() {
return EventType::is_enabled();
}
static u8 event_id() {
return EventType::eventId;
}
void write_elements(int64_t offset) { void write_elements(int64_t offset) {
_cw.write_padded_at_offset<u4>(elements(), offset); _cw.write_padded_at_offset<u4>(elements(), offset);
} }
...@@ -199,23 +189,16 @@ static u4 invoke(Functor& f) { ...@@ -199,23 +189,16 @@ static u4 invoke(Functor& f) {
return f.elements(); return f.elements();
} }
template <typename Functor>
static void write_flush_event(Functor& f) {
if (Functor::is_event_enabled()) {
typename Functor::EventType e(UNTIMED);
e.set_starttime(f.start_time());
e.set_endtime(f.end_time());
e.set_flushId(flushpoint_id);
e.set_elements(f.elements());
e.set_size(f.size());
e.commit();
}
}
template <typename Functor> template <typename Functor>
static u4 invoke_with_flush_event(Functor& f) { static u4 invoke_with_flush_event(Functor& f) {
const u4 elements = invoke(f); const u4 elements = invoke(f);
write_flush_event(f); EventFlush e(UNTIMED);
e.set_starttime(f.start_time());
e.set_endtime(f.end_time());
e.set_flushId(flushpoint_id);
e.set_elements(f.elements());
e.set_size(f.size());
e.commit();
return elements; return elements;
} }
...@@ -227,7 +210,6 @@ class StackTraceRepository : public StackObj { ...@@ -227,7 +210,6 @@ class StackTraceRepository : public StackObj {
bool _clear; bool _clear;
public: public:
typedef EventFlushStacktrace EventType;
StackTraceRepository(JfrStackTraceRepository& repo, JfrChunkWriter& cw, bool clear) : StackTraceRepository(JfrStackTraceRepository& repo, JfrChunkWriter& cw, bool clear) :
_repo(repo), _cw(cw), _elements(0), _clear(clear) {} _repo(repo), _cw(cw), _elements(0), _clear(clear) {}
bool process() { bool process() {
...@@ -243,7 +225,7 @@ typedef WriteCheckpointEvent<StackTraceRepository> WriteStackTrace; ...@@ -243,7 +225,7 @@ typedef WriteCheckpointEvent<StackTraceRepository> WriteStackTrace;
static u4 flush_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWriter& chunkwriter) { static u4 flush_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWriter& chunkwriter) {
StackTraceRepository str(stack_trace_repo, chunkwriter, false); StackTraceRepository str(stack_trace_repo, chunkwriter, false);
WriteStackTrace wst(chunkwriter, str, TYPE_STACKTRACE); WriteStackTrace wst(chunkwriter, str, TYPE_STACKTRACE);
return invoke_with_flush_event(wst); return invoke(wst);
} }
static u4 write_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWriter& chunkwriter, bool clear) { static u4 write_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWriter& chunkwriter, bool clear) {
...@@ -252,14 +234,14 @@ static u4 write_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWr ...@@ -252,14 +234,14 @@ static u4 write_stacktrace(JfrStackTraceRepository& stack_trace_repo, JfrChunkWr
return invoke(wst); return invoke(wst);
} }
typedef Content<EventFlushStorage, JfrStorage, &JfrStorage::write> Storage; typedef Content<JfrStorage, &JfrStorage::write> Storage;
typedef WriteContent<Storage> WriteStorage; typedef WriteContent<Storage> WriteStorage;
static size_t flush_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) { static size_t flush_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) {
assert(chunkwriter.is_valid(), "invariant"); assert(chunkwriter.is_valid(), "invariant");
Storage fsf(storage); Storage fsf(storage);
WriteStorage fs(chunkwriter, fsf); WriteStorage fs(chunkwriter, fsf);
return invoke_with_flush_event(fs); return invoke(fs);
} }
static size_t write_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) { static size_t write_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) {
...@@ -269,15 +251,15 @@ static size_t write_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) { ...@@ -269,15 +251,15 @@ static size_t write_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) {
return invoke(fs); return invoke(fs);
} }
typedef Content<EventFlushStringPool, JfrStringPool, &JfrStringPool::write> StringPool; typedef Content<JfrStringPool, &JfrStringPool::write> StringPool;
typedef Content<EventFlushStringPool, JfrStringPool, &JfrStringPool::write_at_safepoint> StringPoolSafepoint; typedef Content<JfrStringPool, &JfrStringPool::write_at_safepoint> StringPoolSafepoint;
typedef WriteCheckpointEvent<StringPool> WriteStringPool; typedef WriteCheckpointEvent<StringPool> WriteStringPool;
typedef WriteCheckpointEvent<StringPoolSafepoint> WriteStringPoolSafepoint; typedef WriteCheckpointEvent<StringPoolSafepoint> WriteStringPoolSafepoint;
static u4 flush_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) { static u4 flush_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) {
StringPool sp(string_pool); StringPool sp(string_pool);
WriteStringPool wsp(chunkwriter, sp, TYPE_STRING); WriteStringPool wsp(chunkwriter, sp, TYPE_STRING);
return invoke_with_flush_event(wsp); return invoke(wsp);
} }
static u4 write_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) { static u4 write_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) {
...@@ -292,20 +274,19 @@ static u4 write_stringpool_safepoint(JfrStringPool& string_pool, JfrChunkWriter& ...@@ -292,20 +274,19 @@ static u4 write_stringpool_safepoint(JfrStringPool& string_pool, JfrChunkWriter&
return invoke(wsps); return invoke(wsps);
} }
typedef Content<EventFlushTypeSet, JfrCheckpointManager, &JfrCheckpointManager::flush_type_set> FlushTypeSetFunctor; typedef Content<JfrCheckpointManager, &JfrCheckpointManager::flush_type_set> FlushTypeSetFunctor;
typedef WriteContent<FlushTypeSetFunctor> FlushTypeSet; typedef WriteContent<FlushTypeSetFunctor> FlushTypeSet;
static u4 flush_typeset(JfrCheckpointManager& checkpoint_manager, JfrChunkWriter& chunkwriter) { static u4 flush_typeset(JfrCheckpointManager& checkpoint_manager, JfrChunkWriter& chunkwriter) {
FlushTypeSetFunctor flush_type_set(checkpoint_manager); FlushTypeSetFunctor flush_type_set(checkpoint_manager);
FlushTypeSet fts(chunkwriter, flush_type_set); FlushTypeSet fts(chunkwriter, flush_type_set);
return invoke_with_flush_event(fts); return invoke(fts);
} }
class MetadataEvent : public StackObj { class MetadataEvent : public StackObj {
private: private:
JfrChunkWriter& _cw; JfrChunkWriter& _cw;
public: public:
typedef EventFlushMetadata EventType;
MetadataEvent(JfrChunkWriter& cw) : _cw(cw) {} MetadataEvent(JfrChunkWriter& cw) : _cw(cw) {}
bool process() { bool process() {
JfrMetadataEvent::write(_cw); JfrMetadataEvent::write(_cw);
...@@ -320,7 +301,7 @@ static u4 flush_metadata(JfrChunkWriter& chunkwriter) { ...@@ -320,7 +301,7 @@ static u4 flush_metadata(JfrChunkWriter& chunkwriter) {
assert(chunkwriter.is_valid(), "invariant"); assert(chunkwriter.is_valid(), "invariant");
MetadataEvent me(chunkwriter); MetadataEvent me(chunkwriter);
WriteMetadata wm(chunkwriter, me); WriteMetadata wm(chunkwriter, me);
return invoke_with_flush_event(wm); return invoke(wm);
} }
static u4 write_metadata(JfrChunkWriter& chunkwriter) { static u4 write_metadata(JfrChunkWriter& chunkwriter) {
...@@ -606,7 +587,7 @@ size_t JfrRecorderService::flush() { ...@@ -606,7 +587,7 @@ size_t JfrRecorderService::flush() {
return total_elements; return total_elements;
} }
typedef Content<EventFlush, JfrRecorderService, &JfrRecorderService::flush> FlushFunctor; typedef Content<JfrRecorderService, &JfrRecorderService::flush> FlushFunctor;
typedef WriteContent<FlushFunctor> Flush; typedef WriteContent<FlushFunctor> Flush;
void JfrRecorderService::invoke_flush() { void JfrRecorderService::invoke_flush() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册