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

Unified Diff: src/profiler/profile-generator.h

Issue 2396733002: [profiler] Tracing-based CPU profiler. (Closed)
Patch Set: Addressing comments + moving traced-value back to src/tracing Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profiler/cpu-profiler.cc ('k') | src/profiler/profile-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/profile-generator.h
diff --git a/src/profiler/profile-generator.h b/src/profiler/profile-generator.h
index 179d4114293eedbd9060e9a9786fe1abcab77aac..253fce38ab3143e389cea8851e07888b7d693c99 100644
--- a/src/profiler/profile-generator.h
+++ b/src/profiler/profile-generator.h
@@ -183,7 +183,7 @@ class ProfileTree;
class ProfileNode {
public:
- inline ProfileNode(ProfileTree* tree, CodeEntry* entry);
+ inline ProfileNode(ProfileTree* tree, CodeEntry* entry, ProfileNode* parent);
ProfileNode* FindChild(CodeEntry* entry);
ProfileNode* FindOrAddChild(CodeEntry* entry);
@@ -196,6 +196,7 @@ class ProfileNode {
const List<ProfileNode*>* children() const { return &children_list_; }
unsigned id() const { return id_; }
unsigned function_id() const;
+ ProfileNode* parent() const { return parent_; }
unsigned int GetHitLineCount() const { return line_ticks_.occupancy(); }
bool GetLineTicks(v8::CpuProfileNode::LineTick* entries,
unsigned int length) const;
@@ -223,6 +224,7 @@ class ProfileNode {
// Mapping from CodeEntry* to ProfileNode*
base::CustomMatcherHashMap children_;
List<ProfileNode*> children_list_;
+ ProfileNode* parent_;
unsigned id_;
base::CustomMatcherHashMap line_ticks_;
@@ -251,10 +253,18 @@ class ProfileTree {
Isolate* isolate() const { return isolate_; }
+ void EnqueueNode(const ProfileNode* node) { pending_nodes_.push_back(node); }
+ size_t pending_nodes_count() const { return pending_nodes_.size(); }
+ std::vector<const ProfileNode*> TakePendingNodes() {
+ return std::move(pending_nodes_);
+ }
+
private:
template <typename Callback>
void TraverseDepthFirst(Callback* callback);
+ std::vector<const ProfileNode*> pending_nodes_;
+
CodeEntry root_entry_;
unsigned next_node_id_;
ProfileNode* root_;
@@ -274,7 +284,7 @@ class CpuProfile {
// Add pc -> ... -> main() call path to the profile.
void AddPath(base::TimeTicks timestamp, const std::vector<CodeEntry*>& path,
int src_line, bool update_stats);
- void CalculateTotalTicksAndSamplingRate();
+ void FinishProfile();
const char* title() const { return title_; }
const ProfileTree* top_down() const { return &top_down_; }
@@ -294,6 +304,8 @@ class CpuProfile {
void Print();
private:
+ void StreamPendingTraceEvents();
+
const char* title_;
bool record_samples_;
base::TimeTicks start_time_;
@@ -302,6 +314,7 @@ class CpuProfile {
List<base::TimeTicks> timestamps_;
ProfileTree top_down_;
CpuProfiler* const profiler_;
+ int streaming_next_sample_;
DISALLOW_COPY_AND_ASSIGN(CpuProfile);
};
« no previous file with comments | « src/profiler/cpu-profiler.cc ('k') | src/profiler/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698