OLD | NEW |
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 static const char* KindToCString(Kind kind); | 99 static const char* KindToCString(Kind kind); |
100 | 100 |
101 void PrintToJSONArray(JSONArray* functions); | 101 void PrintToJSONArray(JSONArray* functions); |
102 | 102 |
103 // Returns true if the call was successful and |pfsp| is set. | 103 // Returns true if the call was successful and |pfsp| is set. |
104 bool GetSinglePosition(ProfileFunctionSourcePosition* pfsp); | 104 bool GetSinglePosition(ProfileFunctionSourcePosition* pfsp); |
105 | 105 |
106 void TickSourcePosition(TokenPosition token_position, bool exclusive); | 106 void TickSourcePosition(TokenPosition token_position, bool exclusive); |
107 | 107 |
| 108 intptr_t NumSourcePositions() const { |
| 109 return source_position_ticks_.length(); |
| 110 } |
| 111 |
| 112 const ProfileFunctionSourcePosition& GetSourcePosition(intptr_t i) const { |
| 113 return source_position_ticks_.At(i); |
| 114 } |
| 115 |
108 private: | 116 private: |
109 const Kind kind_; | 117 const Kind kind_; |
110 const char* name_; | 118 const char* name_; |
111 const Function& function_; | 119 const Function& function_; |
112 const intptr_t table_index_; | 120 const intptr_t table_index_; |
113 ZoneGrowableArray<intptr_t> profile_codes_; | 121 ZoneGrowableArray<intptr_t> profile_codes_; |
114 ZoneGrowableArray<ProfileFunctionSourcePosition> source_position_ticks_; | 122 ZoneGrowableArray<ProfileFunctionSourcePosition> source_position_ticks_; |
115 | 123 |
116 intptr_t exclusive_ticks_; | 124 intptr_t exclusive_ticks_; |
117 intptr_t inclusive_ticks_; | 125 intptr_t inclusive_ticks_; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 SampleFilter* filter, TagOrder tag_order, intptr_t extra_tags = 0); | 348 SampleFilter* filter, TagOrder tag_order, intptr_t extra_tags = 0); |
341 | 349 |
342 // After building: | 350 // After building: |
343 int64_t min_time() const { return min_time_; } | 351 int64_t min_time() const { return min_time_; } |
344 int64_t max_time() const { return max_time_; } | 352 int64_t max_time() const { return max_time_; } |
345 int64_t GetTimeSpan() const { | 353 int64_t GetTimeSpan() const { |
346 return max_time() - min_time(); | 354 return max_time() - min_time(); |
347 } | 355 } |
348 intptr_t sample_count() const { return sample_count_; } | 356 intptr_t sample_count() const { return sample_count_; } |
349 | 357 |
| 358 intptr_t NumFunctions() const; |
| 359 |
350 ProfileFunction* GetFunction(intptr_t index); | 360 ProfileFunction* GetFunction(intptr_t index); |
351 ProfileCode* GetCode(intptr_t index); | 361 ProfileCode* GetCode(intptr_t index); |
352 ProfileTrieNode* GetTrieRoot(TrieKind trie_kind); | 362 ProfileTrieNode* GetTrieRoot(TrieKind trie_kind); |
353 | 363 |
354 void PrintProfileJSON(JSONStream* stream); | 364 void PrintProfileJSON(JSONStream* stream); |
355 void PrintTimelineJSON(JSONStream* stream); | 365 void PrintTimelineJSON(JSONStream* stream); |
356 | 366 |
| 367 ProfileFunction* FindFunction(const Function& function); |
| 368 |
357 private: | 369 private: |
358 void PrintHeaderJSON(JSONObject* obj); | 370 void PrintHeaderJSON(JSONObject* obj); |
359 void PrintTimelineFrameJSON(JSONObject* frames, | 371 void PrintTimelineFrameJSON(JSONObject* frames, |
360 ProfileTrieNode* current, | 372 ProfileTrieNode* current, |
361 ProfileTrieNode* parent, | 373 ProfileTrieNode* parent, |
362 intptr_t* next_id); | 374 intptr_t* next_id); |
363 | 375 |
364 Isolate* isolate_; | 376 Isolate* isolate_; |
365 Zone* zone_; | 377 Zone* zone_; |
366 ProcessedSampleBuffer* samples_; | 378 ProcessedSampleBuffer* samples_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 JSONStream* stream, | 464 JSONStream* stream, |
453 Profile::TagOrder tag_order, | 465 Profile::TagOrder tag_order, |
454 intptr_t extra_tags, | 466 intptr_t extra_tags, |
455 SampleFilter* filter, | 467 SampleFilter* filter, |
456 bool as_timline); | 468 bool as_timline); |
457 }; | 469 }; |
458 | 470 |
459 } // namespace dart | 471 } // namespace dart |
460 | 472 |
461 #endif // VM_PROFILER_SERVICE_H_ | 473 #endif // VM_PROFILER_SERVICE_H_ |
OLD | NEW |