Chromium Code Reviews| Index: runtime/vm/profiler_service.h |
| diff --git a/runtime/vm/profiler_service.h b/runtime/vm/profiler_service.h |
| index 15f3f7d526c8041691c5bc672af32fb2865c297c..eb65158826d2774cba345b9ebe63ffb619bc2f53 100644 |
| --- a/runtime/vm/profiler_service.h |
| +++ b/runtime/vm/profiler_service.h |
| @@ -12,6 +12,7 @@ |
| #include "vm/object.h" |
| #include "vm/tags.h" |
| #include "vm/thread_interrupter.h" |
| +#include "vm/token_position.h" |
| // CPU Profile model and service protocol bits. |
| // NOTE: For sampling and stack walking related code, see profiler.h. |
| @@ -30,6 +31,23 @@ class RawFunction; |
| class SampleFilter; |
| class ProcessedSampleBuffer; |
| +class ProfileFunctionSourcePosition { |
| + public: |
| + explicit ProfileFunctionSourcePosition(TokenPosition token_pos); |
| + |
| + void Tick(bool exclusive); |
| + |
| + TokenPosition token_pos() const { return token_pos_; } |
| + intptr_t exclusive_ticks() const { return exclusive_ticks_; } |
| + intptr_t inclusive_ticks() const { return inclusive_ticks_; } |
| + |
| + private: |
| + TokenPosition token_pos_; |
|
srdjan
2016/03/02 19:02:56
const
Cutch
2016/03/02 19:14:08
Done.
|
| + intptr_t exclusive_ticks_; |
| + intptr_t inclusive_ticks_; |
|
srdjan
2016/03/02 19:02:55
DISALLOW_ALLOCATION
Cutch
2016/03/02 19:14:07
Done.
|
| +}; |
| + |
| + |
| // Profile data related to a |Function|. |
| class ProfileFunction : public ZoneAllocated { |
| public: |
| @@ -72,18 +90,25 @@ class ProfileFunction : public ZoneAllocated { |
| inclusive_ticks_++; |
| } |
| - void Tick(bool exclusive, intptr_t inclusive_serial); |
| + void Tick(bool exclusive, |
| + intptr_t inclusive_serial, |
| + TokenPosition token_position); |
| static const char* KindToCString(Kind kind); |
| void PrintToJSONArray(JSONArray* functions); |
| + bool GetSinglePosition(ProfileFunctionSourcePosition* pfsp); |
|
srdjan
2016/03/02 19:02:56
Add comment about when is true/false returned.
Cutch
2016/03/02 19:14:07
Done.
|
| + |
| + void TickSourcePosition(TokenPosition token_position, bool exclusive); |
| + |
| private: |
| const Kind kind_; |
| const char* name_; |
| const Function& function_; |
| const intptr_t table_index_; |
| ZoneGrowableArray<intptr_t> profile_codes_; |
| + ZoneGrowableArray<ProfileFunctionSourcePosition> source_position_ticks_; |
| intptr_t exclusive_ticks_; |
| intptr_t inclusive_ticks_; |
| @@ -376,6 +401,12 @@ class ProfileTrieWalker : public ValueObject { |
| // Return the number siblings (including yourself). |
| intptr_t SiblingCount(); |
| + // If the following conditions are met returns the current token: |
| + // 1) This is a function trie. |
| + // 2) There is only one token position for a given function. |
| + // Will return NULL otherwise. |
| + const char* CurrentToken(); |
| + |
| bool Down(); |
| bool NextSibling(); |