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

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

Issue 1525913002: Observatory: Include profiler samples in the timeline view. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « runtime/observatory/web/timeline.js ('k') | 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"
11 #include "vm/globals.h" 11 #include "vm/globals.h"
12 #include "vm/growable_array.h" 12 #include "vm/growable_array.h"
13 #include "vm/object.h" 13 #include "vm/object.h"
14 #include "vm/tags.h" 14 #include "vm/tags.h"
15 #include "vm/thread_interrupter.h" 15 #include "vm/thread_interrupter.h"
16 16
17 // Profiler sampling and stack walking support. 17 // Profiler sampling and stack walking support.
18 // NOTE: For service related code, see profile_service.h. 18 // NOTE: For service related code, see profile_service.h.
19 19
20 namespace dart { 20 namespace dart {
21 21
22 // Forward declarations. 22 // Forward declarations.
23 class ProcessedSample; 23 class ProcessedSample;
24 class ProcessedSampleBuffer; 24 class ProcessedSampleBuffer;
25 25
26 class Sample; 26 class Sample;
27 class SampleBuffer; 27 class SampleBuffer;
28 class ProfileTrieNode;
28 29
29 class Profiler : public AllStatic { 30 class Profiler : public AllStatic {
30 public: 31 public:
31 static void InitOnce(); 32 static void InitOnce();
32 static void Shutdown(); 33 static void Shutdown();
33 34
34 static void SetSampleDepth(intptr_t depth); 35 static void SetSampleDepth(intptr_t depth);
35 static void SetSamplePeriod(intptr_t period); 36 static void SetSamplePeriod(intptr_t period);
36 37
37 static SampleBuffer* sample_buffer() { 38 static SampleBuffer* sample_buffer() {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 uword At(intptr_t index) const { 527 uword At(intptr_t index) const {
527 ASSERT(index >= 0); 528 ASSERT(index >= 0);
528 ASSERT(index < length()); 529 ASSERT(index < length());
529 return pcs_[index]; 530 return pcs_[index];
530 } 531 }
531 532
532 // Timestamp sample was taken at. 533 // Timestamp sample was taken at.
533 int64_t timestamp() const { return timestamp_; } 534 int64_t timestamp() const { return timestamp_; }
534 void set_timestamp(int64_t timestamp) { timestamp_ = timestamp; } 535 void set_timestamp(int64_t timestamp) { timestamp_ = timestamp; }
535 536
537 ThreadId tid() const { return tid_; }
538 void set_tid(ThreadId tid) { tid_ = tid; }
539
536 // The VM tag. 540 // The VM tag.
537 uword vm_tag() const { return vm_tag_; } 541 uword vm_tag() const { return vm_tag_; }
538 void set_vm_tag(uword tag) { vm_tag_ = tag; } 542 void set_vm_tag(uword tag) { vm_tag_ = tag; }
539 543
540 // The user tag. 544 // The user tag.
541 uword user_tag() const { return user_tag_; } 545 uword user_tag() const { return user_tag_; }
542 void set_user_tag(uword tag) { user_tag_ = tag; } 546 void set_user_tag(uword tag) { user_tag_ = tag; }
543 547
544 // The class id if this is an allocation profile sample. -1 otherwise. 548 // The class id if this is an allocation profile sample. -1 otherwise.
545 intptr_t allocation_cid() const { return allocation_cid_; } 549 intptr_t allocation_cid() const { return allocation_cid_; }
546 void set_allocation_cid(intptr_t cid) { allocation_cid_ = cid; } 550 void set_allocation_cid(intptr_t cid) { allocation_cid_ = cid; }
547 551
548 bool IsAllocationSample() const { 552 bool IsAllocationSample() const {
549 return allocation_cid_ > 0; 553 return allocation_cid_ > 0;
550 } 554 }
551 555
552 // Was the stack trace truncated? 556 // Was the stack trace truncated?
553 bool truncated() const { return truncated_; } 557 bool truncated() const { return truncated_; }
554 void set_truncated(bool truncated) { truncated_ = truncated; } 558 void set_truncated(bool truncated) { truncated_ = truncated; }
555 559
556 // Was the first frame in the stack trace executing? 560 // Was the first frame in the stack trace executing?
557 bool first_frame_executing() const { return first_frame_executing_; } 561 bool first_frame_executing() const { return first_frame_executing_; }
558 void set_first_frame_executing(bool first_frame_executing) { 562 void set_first_frame_executing(bool first_frame_executing) {
559 first_frame_executing_ = first_frame_executing; 563 first_frame_executing_ = first_frame_executing;
560 } 564 }
561 565
566 ProfileTrieNode* timeline_trie() const { return timeline_trie_; }
567 void set_timeline_trie(ProfileTrieNode* trie) {
568 ASSERT(timeline_trie_ == NULL);
569 timeline_trie_ = trie;
570 }
571
562 private: 572 private:
563 void FixupCaller(const CodeLookupTable& clt, 573 void FixupCaller(const CodeLookupTable& clt,
564 uword pc_marker, 574 uword pc_marker,
565 uword* stack_buffer); 575 uword* stack_buffer);
566 576
567 void CheckForMissingDartFrame(const CodeLookupTable& clt, 577 void CheckForMissingDartFrame(const CodeLookupTable& clt,
568 const CodeDescriptor* code, 578 const CodeDescriptor* code,
569 uword pc_marker, 579 uword pc_marker,
570 uword* stack_buffer); 580 uword* stack_buffer);
571 581
572 ZoneGrowableArray<uword> pcs_; 582 ZoneGrowableArray<uword> pcs_;
573 int64_t timestamp_; 583 int64_t timestamp_;
584 ThreadId tid_;
574 uword vm_tag_; 585 uword vm_tag_;
575 uword user_tag_; 586 uword user_tag_;
576 intptr_t allocation_cid_; 587 intptr_t allocation_cid_;
577 bool truncated_; 588 bool truncated_;
578 bool first_frame_executing_; 589 bool first_frame_executing_;
590 ProfileTrieNode* timeline_trie_;
579 591
580 friend class SampleBuffer; 592 friend class SampleBuffer;
581 DISALLOW_COPY_AND_ASSIGN(ProcessedSample); 593 DISALLOW_COPY_AND_ASSIGN(ProcessedSample);
582 }; 594 };
583 595
584 596
585 // A collection of |ProcessedSample|s. 597 // A collection of |ProcessedSample|s.
586 class ProcessedSampleBuffer : public ZoneAllocated { 598 class ProcessedSampleBuffer : public ZoneAllocated {
587 public: 599 public:
588 ProcessedSampleBuffer(); 600 ProcessedSampleBuffer();
(...skipping 17 matching lines...) Expand all
606 private: 618 private:
607 ZoneGrowableArray<ProcessedSample*> samples_; 619 ZoneGrowableArray<ProcessedSample*> samples_;
608 CodeLookupTable* code_lookup_table_; 620 CodeLookupTable* code_lookup_table_;
609 621
610 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); 622 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer);
611 }; 623 };
612 624
613 } // namespace dart 625 } // namespace dart
614 626
615 #endif // VM_PROFILER_H_ 627 #endif // VM_PROFILER_H_
OLDNEW
« no previous file with comments | « runtime/observatory/web/timeline.js ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698