--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp Sun Aug 25 10:12:57 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp Sun Aug 25 13:27:54 2019 +0200
@@ -408,7 +408,9 @@
}
size_t JfrCheckpointManager::flush_type_set() {
- return JfrTypeManager::flush_type_set();
+ const size_t elements = JfrTypeManager::flush_type_set();
+ flush();
+ return elements;
}
void JfrCheckpointManager::create_thread_checkpoint(Thread* t) {
--- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp Sun Aug 25 10:12:57 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp Sun Aug 25 13:27:54 2019 +0200
@@ -295,9 +295,7 @@
template <typename Functor>
static u4 invoke_with_flush_event(Functor& f) {
const u4 elements = invoke(f);
- if (elements != 0) {
- write_flush_event(f);
- }
+ write_flush_event(f);
return elements;
}
@@ -610,8 +608,10 @@
return total_elements;
}
total_elements += storage_elements;
- total_elements += flush_stacktrace(_stack_trace_repository, _chunkwriter);
- if (_string_pool.modified()) {
+ if (_stack_trace_repository.is_modified()) {
+ total_elements += flush_stacktrace(_stack_trace_repository, _chunkwriter);
+ }
+ if (_string_pool.is_modified()) {
total_elements += flush_stringpool(_string_pool, _chunkwriter);
}
total_elements += flush_typeset(_checkpoint_manager, _chunkwriter);
@@ -622,14 +622,13 @@
assert(_chunkwriter.is_valid(), "invariant");
ResourceMark rm;
HandleMark hm;
- reset_thread_local_buffer();
+ write_metadata_in_flushpoint = (msgs & MSGBIT(MSG_FLUSHPOINT_METADATA));
++flushpoint_id;
- write_metadata_in_flushpoint = (msgs & MSGBIT(MSG_FLUSHPOINT_METADATA));
+ reset_thread_local_buffer();
FlushFunctor flushpoint(*this);
Flush fl(_chunkwriter, flushpoint);
invoke_with_flush_event(fl);
write_thread_local_buffer(_chunkwriter);
- _checkpoint_manager.flush();
_repository.flush_chunk();
}
@@ -643,8 +642,10 @@
//
void JfrRecorderService::pre_safepoint_write() {
assert(_chunkwriter.is_valid(), "invariant");
- flush_stacktrace_checkpoint(_stack_trace_repository, _chunkwriter, false);
- if (_string_pool.modified()) {
+ if (_stack_trace_repository.is_modified()) {
+ flush_stacktrace_checkpoint(_stack_trace_repository, _chunkwriter, false);
+ }
+ if (_string_pool.is_modified()) {
flush_stringpool_checkpoint(_string_pool, _chunkwriter);
}
if (LeakProfiler::is_running()) {
@@ -674,9 +675,8 @@
//
void JfrRecorderService::safepoint_write() {
assert(SafepointSynchronize::is_at_safepoint(), "invariant");
-
flush_stacktrace_checkpoint(_stack_trace_repository, _chunkwriter, true);
- if (_string_pool.modified()) {
+ if (_string_pool.is_modified()) {
flush_stringpool_checkpoint_safepoint(_string_pool, _chunkwriter);
}
if (LeakProfiler::is_running()) {
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp Sun Aug 25 10:12:57 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp Sun Aug 25 13:27:54 2019 +0200
@@ -70,6 +70,12 @@
_instance = NULL;
}
+static traceid last_id = 0;
+
+bool JfrStackTraceRepository::is_modified() const {
+ return last_id != _next_id;
+}
+
size_t JfrStackTraceRepository::write_impl(JfrChunkWriter& sw, bool clear) {
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
assert(_entries > 0, "invariant");
@@ -92,6 +98,7 @@
memset(_table, 0, sizeof(_table));
_entries = 0;
}
+ last_id = _next_id;
return count;
}
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.hpp Sun Aug 25 10:12:57 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.hpp Sun Aug 25 13:27:54 2019 +0200
@@ -55,6 +55,8 @@
bool initialize();
static void destroy();
+ bool is_modified() const;
+
size_t write_impl(JfrChunkWriter& cw, bool clear);
static void write_metadata(JfrCheckpointWriter& cpw);
traceid write(JfrCheckpointWriter& cpw, traceid id, unsigned int hash);
--- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp Sun Aug 25 10:12:57 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp Sun Aug 25 13:27:54 2019 +0200
@@ -57,7 +57,7 @@
static void set_serialized_generation() {
set_value(OrderAccess::load_acquire(&store_generation), &serialized_generation);
}
-bool JfrStringPool::modified() {
+bool JfrStringPool::is_modified() {
return serialized_generation != OrderAccess::load_acquire(&store_generation);
}
JfrStringPool& JfrStringPool::instance() {
--- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.hpp Sun Aug 25 10:12:57 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.hpp Sun Aug 25 13:27:54 2019 +0200
@@ -71,7 +71,7 @@
static JfrStringPool* create(JfrChunkWriter& cw);
bool initialize();
static void destroy();
- static bool modified();
+ static bool is_modified();
friend class JfrRecorder;
friend class JfrRecorderService;