Index: src/profile-generator.h |
diff --git a/src/profile-generator.h b/src/profile-generator.h |
index b128dad4a87c527e64244dc962fd6dcdb04681bb..4ddb75337e62435dd3b65a1e304b85af49b410b3 100644 |
--- a/src/profile-generator.h |
+++ b/src/profile-generator.h |
@@ -150,6 +150,7 @@ class ProfileNode { |
INLINE(const List<ProfileNode*>* children() const) { return &children_list_; } |
double GetSelfMillis() const; |
double GetTotalMillis() const; |
+ unsigned id() const { return id_; } |
void Print(int indent); |
@@ -170,6 +171,7 @@ class ProfileNode { |
// Mapping from CodeEntry* to ProfileNode* |
HashMap children_; |
List<ProfileNode*> children_list_; |
+ unsigned id_; |
DISALLOW_COPY_AND_ASSIGN(ProfileNode); |
}; |
@@ -180,7 +182,7 @@ class ProfileTree { |
ProfileTree(); |
~ProfileTree(); |
- void AddPathFromEnd(const Vector<CodeEntry*>& path); |
+ ProfileNode* AddPathFromEnd(const Vector<CodeEntry*>& path); |
void AddPathFromStart(const Vector<CodeEntry*>& path); |
void CalculateTotalTicks(); |
void FilteredClone(ProfileTree* src, int security_token_id); |
@@ -191,6 +193,8 @@ class ProfileTree { |
ProfileNode* root() const { return root_; } |
void SetTickRatePerMs(double ticks_per_ms); |
+ unsigned next_node_id() { return next_node_id_++; } |
+ |
void ShortPrint(); |
void Print() { |
root_->Print(0); |
@@ -201,6 +205,7 @@ class ProfileTree { |
void TraverseDepthFirst(Callback* callback); |
CodeEntry root_entry_; |
+ unsigned next_node_id_; |
ProfileNode* root_; |
double ms_to_ticks_scale_; |
@@ -210,8 +215,8 @@ class ProfileTree { |
class CpuProfile { |
public: |
- CpuProfile(const char* title, unsigned uid) |
- : title_(title), uid_(uid) { } |
+ CpuProfile(const char* title, unsigned uid, bool record_samples) |
+ : title_(title), uid_(uid), record_samples_(record_samples) { } |
// Add pc -> ... -> main() call path to the profile. |
void AddPath(const Vector<CodeEntry*>& path); |
@@ -223,6 +228,9 @@ class CpuProfile { |
INLINE(unsigned uid() const) { return uid_; } |
INLINE(const ProfileTree* top_down() const) { return &top_down_; } |
+ INLINE(int samples_count() const) { return samples_.length(); } |
+ INLINE(ProfileNode* sample(int index) const) { return samples_.at(index); } |
+ |
void UpdateTicksScale(); |
void ShortPrint(); |
@@ -231,6 +239,8 @@ class CpuProfile { |
private: |
const char* title_; |
unsigned uid_; |
+ bool record_samples_; |
+ List<ProfileNode*> samples_; |
ProfileTree top_down_; |
DISALLOW_COPY_AND_ASSIGN(CpuProfile); |
@@ -288,8 +298,7 @@ class CpuProfilesCollection { |
CpuProfilesCollection(); |
~CpuProfilesCollection(); |
- bool StartProfiling(const char* title, unsigned uid); |
- bool StartProfiling(String* title, unsigned uid); |
+ bool StartProfiling(const char* title, unsigned uid, bool record_samples); |
CpuProfile* StopProfiling(int security_token_id, |
const char* title, |
double actual_sampling_rate); |