Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: runtime/vm/profiler.h

Issue 1199473003: Add storage of class id and state bit to the profiler's Sample (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_PROFILER_H_ 5 #ifndef VM_PROFILER_H_
6 #define VM_PROFILER_H_ 6 #define VM_PROFILER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/bitfield.h" 9 #include "vm/bitfield.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 void Clear() { 154 void Clear() {
155 isolate_ = NULL; 155 isolate_ = NULL;
156 pc_marker_ = 0; 156 pc_marker_ = 0;
157 for (intptr_t i = 0; i < kStackBufferSizeInWords; i++) { 157 for (intptr_t i = 0; i < kStackBufferSizeInWords; i++) {
158 stack_buffer_[i] = 0; 158 stack_buffer_[i] = 0;
159 } 159 }
160 vm_tag_ = VMTag::kInvalidTagId; 160 vm_tag_ = VMTag::kInvalidTagId;
161 user_tag_ = UserTags::kDefaultUserTag; 161 user_tag_ = UserTags::kDefaultUserTag;
162 sp_ = 0;
163 lr_ = 0; 162 lr_ = 0;
rmacnak 2015/06/22 22:23:19 metadata = 0
Cutch 2015/06/23 13:47:13 Done.
164 fp_ = 0;
165 state_ = 0; 163 state_ = 0;
166 uword* pcs = GetPCArray(); 164 uword* pcs = GetPCArray();
167 for (intptr_t i = 0; i < pcs_length_; i++) { 165 for (intptr_t i = 0; i < pcs_length_; i++) {
168 pcs[i] = 0; 166 pcs[i] = 0;
169 } 167 }
170 } 168 }
171 169
172 // Timestamp sample was taken at. 170 // Timestamp sample was taken at.
173 int64_t timestamp() const { 171 int64_t timestamp() const {
174 return timestamp_; 172 return timestamp_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 209 }
212 210
213 uword pc_marker() const { 211 uword pc_marker() const {
214 return pc_marker_; 212 return pc_marker_;
215 } 213 }
216 214
217 void set_pc_marker(uword pc_marker) { 215 void set_pc_marker(uword pc_marker) {
218 pc_marker_ = pc_marker; 216 pc_marker_ = pc_marker;
219 } 217 }
220 218
221 uword sp() const {
222 return sp_;
223 }
224
225 void set_sp(uword sp) {
226 sp_ = sp;
227 }
228
229 uword fp() const {
230 return fp_;
231 }
232
233 void set_fp(uword fp) {
234 fp_ = fp;
235 }
236
237 uword lr() const { 219 uword lr() const {
238 return lr_; 220 return lr_;
239 } 221 }
240 222
241 void set_lr(uword link_register) { 223 void set_lr(uword link_register) {
242 lr_ = link_register; 224 lr_ = link_register;
243 } 225 }
244 226
245 void InsertCallerForTopFrame(uword pc) { 227 void InsertCallerForTopFrame(uword pc) {
246 if (pcs_length_ == 1) { 228 if (pcs_length_ == 1) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 281 }
300 282
301 bool truncated_trace() const { 283 bool truncated_trace() const {
302 return TruncatedTraceBit::decode(state_); 284 return TruncatedTraceBit::decode(state_);
303 } 285 }
304 286
305 void set_truncated_trace(bool truncated_trace) { 287 void set_truncated_trace(bool truncated_trace) {
306 state_ = TruncatedTraceBit::update(truncated_trace, state_); 288 state_ = TruncatedTraceBit::update(truncated_trace, state_);
307 } 289 }
308 290
291 bool is_allocation_sample() const {
292 return ClassAllocationSampleBit::decode(state_);
293 }
294
295 void set_is_allocation_sample(bool allocation_sample) {
296 state_ = ClassAllocationSampleBit::update(allocation_sample, state_);
297 }
298
299 intptr_t allocation_cid() const {
300 ASSERT(is_allocation_sample());
301 return metadata_;
302 }
303
304 void set_metadata(intptr_t metadata) {
305 metadata_ = metadata;
306 }
307
309 static void InitOnce(); 308 static void InitOnce();
310 309
311 static intptr_t instance_size() { 310 static intptr_t instance_size() {
312 return instance_size_; 311 return instance_size_;
313 } 312 }
314 313
315 uword* GetPCArray() const; 314 uword* GetPCArray() const;
316 315
317 static const int kStackBufferSizeInWords = 2; 316 static const int kStackBufferSizeInWords = 2;
318 uword* GetStackBuffer() { 317 uword* GetStackBuffer() {
319 return &stack_buffer_[0]; 318 return &stack_buffer_[0];
320 } 319 }
321 320
322 private: 321 private:
323 static intptr_t instance_size_; 322 static intptr_t instance_size_;
324 static intptr_t pcs_length_; 323 static intptr_t pcs_length_;
325 enum StateBits { 324 enum StateBits {
326 kProcessedBit = 0, 325 kProcessedBit = 0,
327 kLeafFrameIsDartBit = 1, 326 kLeafFrameIsDartBit = 1,
328 kIgnoreBit = 2, 327 kIgnoreBit = 2,
329 kExitFrameBit = 3, 328 kExitFrameBit = 3,
330 kMissingFrameInsertedBit = 4, 329 kMissingFrameInsertedBit = 4,
331 kTruncatedTrace = 5, 330 kTruncatedTrace = 5,
331 kClassAllocationSample = 6,
332 }; 332 };
333 class ProcessedBit : public BitField<bool, kProcessedBit, 1> {}; 333 class ProcessedBit : public BitField<bool, kProcessedBit, 1> {};
334 class LeafFrameIsDart : public BitField<bool, kLeafFrameIsDartBit, 1> {}; 334 class LeafFrameIsDart : public BitField<bool, kLeafFrameIsDartBit, 1> {};
335 class IgnoreBit : public BitField<bool, kIgnoreBit, 1> {}; 335 class IgnoreBit : public BitField<bool, kIgnoreBit, 1> {};
336 class ExitFrameBit : public BitField<bool, kExitFrameBit, 1> {}; 336 class ExitFrameBit : public BitField<bool, kExitFrameBit, 1> {};
337 class MissingFrameInsertedBit 337 class MissingFrameInsertedBit
338 : public BitField<bool, kMissingFrameInsertedBit, 1> {}; 338 : public BitField<bool, kMissingFrameInsertedBit, 1> {};
339 class TruncatedTraceBit : public BitField<bool, kTruncatedTrace, 1> {}; 339 class TruncatedTraceBit : public BitField<bool, kTruncatedTrace, 1> {};
340 class ClassAllocationSampleBit
341 : public BitField<bool, kClassAllocationSample, 1> {};
340 342
341 int64_t timestamp_; 343 int64_t timestamp_;
342 ThreadId tid_; 344 ThreadId tid_;
343 Isolate* isolate_; 345 Isolate* isolate_;
344 uword pc_marker_; 346 uword pc_marker_;
345 uword stack_buffer_[kStackBufferSizeInWords]; 347 uword stack_buffer_[kStackBufferSizeInWords];
346 uword vm_tag_; 348 uword vm_tag_;
347 uword user_tag_; 349 uword user_tag_;
348 uword sp_; 350 uword metadata_;
349 uword fp_;
350 uword lr_; 351 uword lr_;
351 uword state_; 352 uword state_;
352 353
353 /* There are a variable number of words that follow, the words hold the 354 /* There are a variable number of words that follow, the words hold the
354 * sampled pc values. Access via GetPCArray() */ 355 * sampled pc values. Access via GetPCArray() */
355 356
356 DISALLOW_COPY_AND_ASSIGN(Sample); 357 DISALLOW_COPY_AND_ASSIGN(Sample);
357 }; 358 };
358 359
359 360
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 intptr_t capacity_; 410 intptr_t capacity_;
410 uintptr_t cursor_; 411 uintptr_t cursor_;
411 412
412 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); 413 DISALLOW_COPY_AND_ASSIGN(SampleBuffer);
413 }; 414 };
414 415
415 416
416 } // namespace dart 417 } // namespace dart
417 418
418 #endif // VM_PROFILER_H_ 419 #endif // VM_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698