equal
deleted
inserted
replaced
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" |
26 #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" |
27 #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" |
27 #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" |
|
28 #include "jfr/utilities/jfrBlob.hpp" |
28 #include "jfr/writers/jfrBigEndianWriter.hpp" |
29 #include "jfr/writers/jfrBigEndianWriter.hpp" |
29 |
30 |
30 JfrCheckpointFlush::JfrCheckpointFlush(Type* old, size_t used, size_t requested, Thread* t) : |
31 JfrCheckpointFlush::JfrCheckpointFlush(Type* old, size_t used, size_t requested, Thread* t) : |
31 _result(JfrCheckpointManager::flush(old, used, requested, t)) {} |
32 _result(JfrCheckpointManager::flush(old, used, requested, t)) {} |
32 |
33 |
99 assert(this->is_valid(), "invariant"); |
100 assert(this->is_valid(), "invariant"); |
100 assert(count() > 0, "invariant"); |
101 assert(count() > 0, "invariant"); |
101 assert(this->used_size() > sizeof(JfrCheckpointEntry), "invariant"); |
102 assert(this->used_size() > sizeof(JfrCheckpointEntry), "invariant"); |
102 const int64_t size = this->current_offset(); |
103 const int64_t size = this->current_offset(); |
103 assert(size + this->start_pos() == this->current_pos(), "invariant"); |
104 assert(size + this->start_pos() == this->current_pos(), "invariant"); |
104 write_checkpoint_header(const_cast<u1*>(this->start_pos()), size, _time, _type, count()); |
105 write_checkpoint_header(const_cast<u1*>(this->start_pos()), size, _time, (u4)_type, count()); |
105 release(); |
106 release(); |
106 } |
107 } |
107 |
108 |
108 u4 JfrCheckpointWriter::count() const { |
109 u4 JfrCheckpointWriter::count() const { |
109 return _count; |
110 return _count; |
157 *size = this->current_pos() - session_start_pos; |
158 *size = this->current_pos() - session_start_pos; |
158 return session_start_pos; |
159 return session_start_pos; |
159 } |
160 } |
160 *size = this->used_size(); |
161 *size = this->used_size(); |
161 assert(this->start_pos() + *size == this->current_pos(), "invariant"); |
162 assert(this->start_pos() + *size == this->current_pos(), "invariant"); |
162 write_checkpoint_header(const_cast<u1*>(this->start_pos()), this->used_offset(), _time, _type, count()); |
163 write_checkpoint_header(const_cast<u1*>(this->start_pos()), this->used_offset(), _time, (u4)_type, count()); |
163 _header = false; // the header is already written |
164 _header = false; // the header is already written |
164 if (move) { |
165 if (move) { |
165 this->seek(_offset); |
166 this->seek(_offset); |
166 } |
167 } |
167 return this->start_pos(); |
168 return this->start_pos(); |
180 } |
181 } |
181 bool JfrCheckpointWriter::has_data() const { |
182 bool JfrCheckpointWriter::has_data() const { |
182 return this->used_size() > sizeof(JfrCheckpointEntry); |
183 return this->used_size() > sizeof(JfrCheckpointEntry); |
183 } |
184 } |
184 |
185 |
185 JfrCheckpointBlobHandle JfrCheckpointWriter::copy(const JfrCheckpointContext* ctx /* 0 */) { |
186 JfrBlobHandle JfrCheckpointWriter::copy(const JfrCheckpointContext* ctx /* 0 */) { |
186 size_t size = 0; |
187 size_t size = 0; |
187 const u1* data = session_data(&size, false, ctx); |
188 const u1* data = session_data(&size, false, ctx); |
188 return JfrCheckpointBlob::make(data, size); |
189 return JfrBlob::make(data, size); |
189 } |
190 } |
190 |
191 |
191 JfrCheckpointBlobHandle JfrCheckpointWriter::move(const JfrCheckpointContext* ctx /* 0 */) { |
192 JfrBlobHandle JfrCheckpointWriter::move(const JfrCheckpointContext* ctx /* 0 */) { |
192 size_t size = 0; |
193 size_t size = 0; |
193 const u1* data = session_data(&size, true, ctx); |
194 const u1* data = session_data(&size, true, ctx); |
194 JfrCheckpointBlobHandle blob = JfrCheckpointBlob::make(data, size); |
195 JfrBlobHandle blob = JfrBlob::make(data, size); |
195 if (ctx != NULL) { |
196 if (ctx != NULL) { |
196 const_cast<JfrCheckpointContext*>(ctx)->count = 0; |
197 const_cast<JfrCheckpointContext*>(ctx)->count = 0; |
197 set_context(*ctx); |
198 set_context(*ctx); |
198 } |
199 } |
199 return blob; |
200 return blob; |