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

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

Issue 230863005: Initial UserTag and dart:profiler library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object_store.cc ('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/code_observers.h" 9 #include "vm/code_observers.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #define kSampleFramesSize 256 105 #define kSampleFramesSize 256
106 106
107 // Each Sample holds a stack trace from an isolate. 107 // Each Sample holds a stack trace from an isolate.
108 class Sample { 108 class Sample {
109 public: 109 public:
110 void Init(Isolate* isolate, int64_t timestamp, ThreadId tid) { 110 void Init(Isolate* isolate, int64_t timestamp, ThreadId tid) {
111 timestamp_ = timestamp; 111 timestamp_ = timestamp;
112 tid_ = tid; 112 tid_ = tid;
113 isolate_ = isolate; 113 isolate_ = isolate;
114 vm_tag_ = VMTag::kInvalidTagId; 114 vm_tag_ = VMTag::kInvalidTagId;
115 user_tag_ = UserTags::kNoUserTag;
115 for (intptr_t i = 0; i < kSampleFramesSize; i++) { 116 for (intptr_t i = 0; i < kSampleFramesSize; i++) {
116 pcs_[i] = 0; 117 pcs_[i] = 0;
117 } 118 }
118 } 119 }
119 120
120 // Isolate sample was taken from. 121 // Isolate sample was taken from.
121 Isolate* isolate() const { 122 Isolate* isolate() const {
122 return isolate_; 123 return isolate_;
123 } 124 }
124 125
(...skipping 17 matching lines...) Expand all
142 } 143 }
143 144
144 uword vm_tag() const { 145 uword vm_tag() const {
145 return vm_tag_; 146 return vm_tag_;
146 } 147 }
147 void set_vm_tag(uword tag) { 148 void set_vm_tag(uword tag) {
148 ASSERT(tag != VMTag::kInvalidTagId); 149 ASSERT(tag != VMTag::kInvalidTagId);
149 vm_tag_ = tag; 150 vm_tag_ = tag;
150 } 151 }
151 152
153 uword user_tag() const {
154 return user_tag_;
155 }
156 void set_user_tag(uword tag) {
157 user_tag_ = tag;
158 }
159
152 private: 160 private:
153 int64_t timestamp_; 161 int64_t timestamp_;
154 ThreadId tid_; 162 ThreadId tid_;
155 Isolate* isolate_; 163 Isolate* isolate_;
156 uword vm_tag_; 164 uword vm_tag_;
165 uword user_tag_;
157 uword pcs_[kSampleFramesSize]; 166 uword pcs_[kSampleFramesSize];
158 }; 167 };
159 168
160 169
161 // Ring buffer of Samples that is (usually) shared by many isolates. 170 // Ring buffer of Samples that is (usually) shared by many isolates.
162 class SampleBuffer { 171 class SampleBuffer {
163 public: 172 public:
164 static const intptr_t kDefaultBufferCapacity = 120000; // 2 minutes @ 1000hz. 173 static const intptr_t kDefaultBufferCapacity = 120000; // 2 minutes @ 1000hz.
165 174
166 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity) { 175 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 intptr_t capacity_; 226 intptr_t capacity_;
218 uintptr_t cursor_; 227 uintptr_t cursor_;
219 228
220 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); 229 DISALLOW_COPY_AND_ASSIGN(SampleBuffer);
221 }; 230 };
222 231
223 232
224 } // namespace dart 233 } // namespace dart
225 234
226 #endif // VM_PROFILER_H_ 235 #endif // VM_PROFILER_H_
OLDNEW
« no previous file with comments | « runtime/vm/object_store.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698