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

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

Issue 1210283003: Extend allocation profile testing (Closed) Base URL: git@github.com:dart-lang/sdk.git@profile_model_public
Patch Set: Created 5 years, 5 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_service.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_SERVICE_H_ 5 #ifndef VM_PROFILER_SERVICE_H_
6 #define VM_PROFILER_SERVICE_H_ 6 #define VM_PROFILER_SERVICE_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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ProfileFunction(Kind kind, 43 ProfileFunction(Kind kind,
44 const char* name, 44 const char* name,
45 const Function& function, 45 const Function& function,
46 const intptr_t table_index); 46 const intptr_t table_index);
47 47
48 const char* name() const { 48 const char* name() const {
49 ASSERT(name_ != NULL); 49 ASSERT(name_ != NULL);
50 return name_; 50 return name_;
51 } 51 }
52 52
53 const char* Name() const;
54
53 RawFunction* function() const { 55 RawFunction* function() const {
54 return function_.raw(); 56 return function_.raw();
55 } 57 }
56 58
57 intptr_t table_index() const { 59 intptr_t table_index() const {
58 return table_index_; 60 return table_index_;
59 } 61 }
60 62
61 Kind kind() const { 63 Kind kind() const {
62 return kind_; 64 return kind_;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 241 }
240 242
241 intptr_t NumChildren() const { 243 intptr_t NumChildren() const {
242 return children_.length(); 244 return children_.length();
243 } 245 }
244 246
245 ProfileTrieNode* At(intptr_t i) { 247 ProfileTrieNode* At(intptr_t i) {
246 return children_.At(i); 248 return children_.At(i);
247 } 249 }
248 250
251 intptr_t IndexOf(ProfileTrieNode* node);
252
249 protected: 253 protected:
250 void SortChildren(); 254 void SortChildren();
251 255
252 static int ProfileTrieNodeCompare(ProfileTrieNode* const* a, 256 static int ProfileTrieNodeCompare(ProfileTrieNode* const* a,
253 ProfileTrieNode* const* b) { 257 ProfileTrieNode* const* b) {
254 ASSERT(a != NULL); 258 ASSERT(a != NULL);
255 ASSERT(b != NULL); 259 ASSERT(b != NULL);
256 return (*b)->count() - (*a)->count(); 260 return (*b)->count() - (*a)->count();
257 } 261 }
258 262
(...skipping 19 matching lines...) Expand all
278 }; 282 };
279 283
280 enum TrieKind { 284 enum TrieKind {
281 kExclusiveCode, 285 kExclusiveCode,
282 kExclusiveFunction, 286 kExclusiveFunction,
283 kInclusiveCode, 287 kInclusiveCode,
284 kInclusiveFunction, 288 kInclusiveFunction,
285 kNumTrieKinds, 289 kNumTrieKinds,
286 }; 290 };
287 291
292 static bool IsCodeTrie(TrieKind kind) {
293 return (kind == kExclusiveCode) || (kind == kInclusiveCode);
294 }
295
296 static bool IsFunctionTrie(TrieKind kind) {
297 return !IsCodeTrie(kind);
298 }
299
288 explicit Profile(Isolate* isolate); 300 explicit Profile(Isolate* isolate);
289 301
290 // Build a filtered model using |filter| with the specified |tag_order|. 302 // Build a filtered model using |filter| with the specified |tag_order|.
291 void Build(SampleFilter* filter, TagOrder tag_order); 303 void Build(SampleFilter* filter, TagOrder tag_order);
292 304
293 // After building: 305 // After building:
294 int64_t min_time() const { return min_time_; } 306 int64_t min_time() const { return min_time_; }
295 int64_t max_time() const { return max_time_; } 307 int64_t max_time() const { return max_time_; }
296 int64_t GetTimeSpan() const { 308 int64_t GetTimeSpan() const {
297 return max_time() - min_time(); 309 return max_time() - min_time();
(...skipping 19 matching lines...) Expand all
317 329
318 int64_t min_time_; 330 int64_t min_time_;
319 int64_t max_time_; 331 int64_t max_time_;
320 332
321 intptr_t sample_count_; 333 intptr_t sample_count_;
322 334
323 friend class ProfileBuilder; 335 friend class ProfileBuilder;
324 }; 336 };
325 337
326 338
339 class ProfileTrieWalker : public ValueObject {
340 public:
341 explicit ProfileTrieWalker(Profile* profile)
342 : profile_(profile),
343 parent_(NULL),
344 current_(NULL),
345 code_trie_(false) {
346 ASSERT(profile_ != NULL);
347 }
348
349 void Reset(Profile::TrieKind trie_kind);
350
351 const char* CurrentName();
352
353 bool Down();
354 bool NextSibling();
355
356 private:
357 Profile* profile_;
358 ProfileTrieNode* parent_;
359 ProfileTrieNode* current_;
360 bool code_trie_;
361 };
362
363
327 class ProfilerService : public AllStatic { 364 class ProfilerService : public AllStatic {
328 public: 365 public:
329 static void PrintJSON(JSONStream* stream, 366 static void PrintJSON(JSONStream* stream,
330 Profile::TagOrder tag_order); 367 Profile::TagOrder tag_order);
331 368
332 static void ClearSamples(); 369 static void ClearSamples();
333 }; 370 };
334 371
335 } // namespace dart 372 } // namespace dart
336 373
337 #endif // VM_PROFILER_SERVICE_H_ 374 #endif // VM_PROFILER_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/profiler_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698