# HG changeset patch # User mgronlun # Date 1566902165 -7200 # Node ID a9cc3698a55c4bf50bb072a4592afa1b9546ca47 # Parent 87f8a814310dadd998972ab0891b7f377897a8de some cleanup diff -r 87f8a814310d -r a9cc3698a55c src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp --- a/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp Tue Aug 27 12:08:01 2019 +0200 +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp Tue Aug 27 12:36:05 2019 +0200 @@ -23,20 +23,11 @@ */ #include "precompiled.hpp" -#include "jfr/dcmd/jfrDcmds.hpp" -#include "jfr/recorder/jfrRecorder.hpp" #include "jfr/recorder/repository/jfrChunk.hpp" -#include "jfr/recorder/repository/jfrChunkWriter.hpp" +#include "jfr/recorder/service/jfrOptionSet.hpp" #include "jfr/utilities/jfrTimeConverter.hpp" -#include "logging/log.hpp" +#include "jfr/utilities/jfrTypes.hpp" #include "runtime/os.inline.hpp" -#include "runtime/thread.inline.hpp" - -static const char* const MAGIC = "FLR"; -static const u2 JFR_VERSION_MAJOR = 2; -static const u2 JFR_VERSION_MINOR = 0; - -static const u1 GUARD = 0xff; static jlong nanos_now() { return os::javaTimeMillis() * JfrTimeConverter::NANOS_PER_MILLISEC; @@ -143,7 +134,7 @@ update_start_nanos(); } -void JfrChunk::update_time_to_now() { +void JfrChunk::set_time_stamp() { save_current_and_update_start_nanos(); save_current_and_update_start_ticks(); } diff -r 87f8a814310d -r a9cc3698a55c src/hotspot/share/jfr/recorder/repository/jfrChunk.hpp --- a/src/hotspot/share/jfr/recorder/repository/jfrChunk.hpp Tue Aug 27 12:08:01 2019 +0200 +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunk.hpp Tue Aug 27 12:36:05 2019 +0200 @@ -25,9 +25,7 @@ #ifndef SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP #define SHARE_VM_JFR_RECORDER_REPOSITORY_JFRRCHUNK_HPP -#include "jni.h" #include "jfr/utilities/jfrAllocation.hpp" -#include "jfr/utilities/jfrTypes.hpp" class JfrChunk : public JfrCHeapObj { friend class JfrChunkWriter; @@ -72,12 +70,12 @@ int64_t previous_start_nanos() const; int64_t last_chunk_duration() const; - void update_time_to_now(); + void set_time_stamp(); + void update(); + void set_path(const char* path); const char* path() const; - void update(); - bool is_started() const; bool is_finished() const; bool is_initial_flush() const; diff -r 87f8a814310d -r a9cc3698a55c src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp Tue Aug 27 12:08:01 2019 +0200 +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp Tue Aug 27 12:36:05 2019 +0200 @@ -25,12 +25,9 @@ #include "precompiled.hpp" #include "jfr/recorder/repository/jfrChunk.hpp" #include "jfr/recorder/repository/jfrChunkWriter.hpp" -#include "jfr/recorder/service/jfrOptionSet.hpp" #include "jfr/utilities/jfrTime.hpp" -#include "jfr/utilities/jfrTimeConverter.hpp" #include "jfr/utilities/jfrTypes.hpp" #include "runtime/mutexLocker.hpp" -#include "runtime/os.hpp" #include "runtime/os.inline.hpp" static const int64_t MAGIC_OFFSET = 0; @@ -47,16 +44,6 @@ static const int64_t GENERATION_OFFSET = CPU_FREQUENCY_OFFSET + SLOT_SIZE; static const int64_t CAPABILITY_OFFSET = GENERATION_OFFSET + 2; static const int64_t HEADER_SIZE = CAPABILITY_OFFSET + 2; -static const int64_t RESERVE_SIZE = GENERATION_OFFSET - (4 * SIZE_OFFSET); - -static const u1 COMPLETE = 0; -static const u1 GUARD = 0xff; -static const u1 PAD = 0; - -typedef NoOwnershipAdapter JfrHeadBuffer; // stack local array as buffer -typedef StreamWriterHost JfrBufferedHeadWriter; -typedef WriterHost JfrHeadWriterBase; - static fio_fd open_chunk(const char* path) { return path != NULL ? os::open(path, O_CREAT | O_RDWR, S_IREAD | S_IWRITE) : invalid_fd; @@ -247,9 +234,9 @@ _chunk->set_path(path); } -void JfrChunkWriter::time_stamp_chunk_now() { +void JfrChunkWriter::set_time_stamp() { assert(_chunk != NULL, "invariant"); - _chunk->update_time_to_now(); + _chunk->set_time_stamp(); } int64_t JfrChunkWriter::size_written() const { diff -r 87f8a814310d -r a9cc3698a55c src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp Tue Aug 27 12:08:01 2019 +0200 +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp Tue Aug 27 12:36:05 2019 +0200 @@ -58,7 +58,7 @@ void set_last_metadata_offset(int64_t offset); bool is_initial_flushpoint_for_chunk() const; bool has_metadata() const; - void time_stamp_chunk_now(); + void set_time_stamp(); }; #endif // SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKWRITER_HPP diff -r 87f8a814310d -r a9cc3698a55c src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp Tue Aug 27 12:08:01 2019 +0200 +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp Tue Aug 27 12:36:05 2019 +0200 @@ -409,7 +409,7 @@ _string_pool.clear(); _storage.clear(); _checkpoint_manager.shift_epoch(); - _chunkwriter.time_stamp_chunk_now(); + _chunkwriter.set_time_stamp(); } void JfrRecorderService::post_safepoint_clear() { @@ -687,7 +687,7 @@ _storage.write_at_safepoint(); _checkpoint_manager.notify_threads(); _checkpoint_manager.shift_epoch(); - _chunkwriter.time_stamp_chunk_now(); + _chunkwriter.set_time_stamp(); } // @@ -732,7 +732,7 @@ // Optimistically write tagged artifacts. _checkpoint_manager.shift_epoch(); // update time - _chunkwriter.time_stamp_chunk_now(); + _chunkwriter.set_time_stamp(); post_safepoint_write(); } diff -r 87f8a814310d -r a9cc3698a55c src/hotspot/share/jfr/utilities/jfrTypes.hpp --- a/src/hotspot/share/jfr/utilities/jfrTypes.hpp Tue Aug 27 12:08:01 2019 +0200 +++ b/src/hotspot/share/jfr/utilities/jfrTypes.hpp Tue Aug 27 12:36:05 2019 +0200 @@ -26,11 +26,17 @@ #define SHARE_JFR_UTILITIES_JFRTYPES_HPP #include "jfrfiles/jfrEventIds.hpp" -#include "memory/allocation.hpp" -#include "utilities/globalDefinitions.hpp" typedef u8 traceid; typedef int fio_fd; + +const char* const MAGIC = "FLR"; +const u2 JFR_VERSION_MAJOR = 2; +const u2 JFR_VERSION_MINOR = 0; +const u1 COMPLETE = 0; +const u1 GUARD = 0xff; +const u1 PAD = 0; + const int invalid_fd = -1; const jlong invalid_offset = -1; const int64_t invalid_time = -1;