Remove bottom-up CPU profile
authoryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 15 Mar 2013 12:46:45 +0000 (12:46 +0000)
committeryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 15 Mar 2013 12:46:45 +0000 (12:46 +0000)
Bottom-up view of CPU profile can be restored based on top-down profile data. So there is no need to spend resources on creating both of them inside V8.

BUG=None

Review URL: https://codereview.chromium.org/12825003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13958 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

include/v8-profiler.h
src/api.cc
src/cpu-profiler.cc
src/profile-generator.cc
src/profile-generator.h
test/cctest/test-cpu-profiler.cc

index c9eab3f..32a35fd 100644 (file)
@@ -116,9 +116,8 @@ class V8EXPORT CpuProfileNode {
 
 
 /**
- * CpuProfile contains a CPU profile in a form of two call trees:
- *  - top-down (from main() down to functions that do all the work);
- *  - bottom-up call graph (in backward direction).
+ * CpuProfile contains a CPU profile in a form of top-down call tree
+ * (from main() down to functions that do all the work).
  */
 class V8EXPORT CpuProfile {
  public:
@@ -128,9 +127,6 @@ class V8EXPORT CpuProfile {
   /** Returns CPU profile title. */
   Handle<String> GetTitle() const;
 
-  /** Returns the root node of the bottom up call tree. */
-  const CpuProfileNode* GetBottomUpRoot() const;
-
   /** Returns the root node of the top down call tree. */
   const CpuProfileNode* GetTopDownRoot() const;
 
index 47928a6..d2c1402 100644 (file)
@@ -6498,14 +6498,6 @@ Handle<String> CpuProfile::GetTitle() const {
 }
 
 
-const CpuProfileNode* CpuProfile::GetBottomUpRoot() const {
-  i::Isolate* isolate = i::Isolate::Current();
-  IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot");
-  const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
-  return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root());
-}
-
-
 const CpuProfileNode* CpuProfile::GetTopDownRoot() const {
   i::Isolate* isolate = i::Isolate::Current();
   IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot");
index 7d56b8d..15edc1e 100644 (file)
@@ -39,7 +39,6 @@
 namespace v8 {
 namespace internal {
 
-static const int kEventsBufferSize = 256 * KB;
 static const int kTickSamplesBufferChunkSize = 64 * KB;
 static const int kTickSamplesBufferChunksCount = 16;
 static const int kProfilerStackSize = 64 * KB;
index a51de78..2bf1724 100644 (file)
@@ -468,19 +468,16 @@ void ProfileTree::ShortPrint() {
 
 void CpuProfile::AddPath(const Vector<CodeEntry*>& path) {
   top_down_.AddPathFromEnd(path);
-  bottom_up_.AddPathFromStart(path);
 }
 
 
 void CpuProfile::CalculateTotalTicks() {
   top_down_.CalculateTotalTicks();
-  bottom_up_.CalculateTotalTicks();
 }
 
 
 void CpuProfile::SetActualSamplingRate(double actual_sampling_rate) {
   top_down_.SetTickRatePerMs(actual_sampling_rate);
-  bottom_up_.SetTickRatePerMs(actual_sampling_rate);
 }
 
 
@@ -488,7 +485,6 @@ CpuProfile* CpuProfile::FilteredClone(int security_token_id) {
   ASSERT(security_token_id != TokenEnumerator::kNoSecurityToken);
   CpuProfile* clone = new CpuProfile(title_, uid_);
   clone->top_down_.FilteredClone(&top_down_, security_token_id);
-  clone->bottom_up_.FilteredClone(&bottom_up_, security_token_id);
   return clone;
 }
 
@@ -496,16 +492,12 @@ CpuProfile* CpuProfile::FilteredClone(int security_token_id) {
 void CpuProfile::ShortPrint() {
   OS::Print("top down ");
   top_down_.ShortPrint();
-  OS::Print("bottom up ");
-  bottom_up_.ShortPrint();
 }
 
 
 void CpuProfile::Print() {
   OS::Print("[Top down]:\n");
   top_down_.Print();
-  OS::Print("[Bottom up]:\n");
-  bottom_up_.Print();
 }
 
 
index 8315f79..b128dad 100644 (file)
@@ -222,7 +222,6 @@ class CpuProfile {
   INLINE(const char* title() const) { return title_; }
   INLINE(unsigned uid() const) { return uid_; }
   INLINE(const ProfileTree* top_down() const) { return &top_down_; }
-  INLINE(const ProfileTree* bottom_up() const) { return &bottom_up_; }
 
   void UpdateTicksScale();
 
@@ -233,7 +232,6 @@ class CpuProfile {
   const char* title_;
   unsigned uid_;
   ProfileTree top_down_;
-  ProfileTree bottom_up_;
 
   DISALLOW_COPY_AND_ASSIGN(CpuProfile);
 };
index 2236f30..75e594e 100644 (file)
@@ -211,31 +211,6 @@ TEST(TickEvents) {
   const i::List<ProfileNode*>* top_down_ddd_children =
       top_down_stub_children->last()->children();
   CHECK_EQ(0, top_down_ddd_children->length());
-
-  const i::List<ProfileNode*>* bottom_up_root_children_unsorted =
-      profile->bottom_up()->root()->children();
-  CHECK_EQ(3, bottom_up_root_children_unsorted->length());
-  i::List<ProfileNode*> bottom_up_root_children(3);
-  bottom_up_root_children.AddAll(*bottom_up_root_children_unsorted);
-  bottom_up_root_children.Sort(&CompareProfileNodes);
-  CHECK_EQ("5", bottom_up_root_children[0]->entry()->name());
-  CHECK_EQ("bbb", bottom_up_root_children[1]->entry()->name());
-  CHECK_EQ("ddd", bottom_up_root_children[2]->entry()->name());
-  const i::List<ProfileNode*>* bottom_up_stub_children =
-      bottom_up_root_children[0]->children();
-  CHECK_EQ(1, bottom_up_stub_children->length());
-  CHECK_EQ("bbb", bottom_up_stub_children->last()->entry()->name());
-  const i::List<ProfileNode*>* bottom_up_bbb_children =
-      bottom_up_root_children[1]->children();
-  CHECK_EQ(0, bottom_up_bbb_children->length());
-  const i::List<ProfileNode*>* bottom_up_ddd_children =
-      bottom_up_root_children[2]->children();
-  CHECK_EQ(1, bottom_up_ddd_children->length());
-  CHECK_EQ("5", bottom_up_ddd_children->last()->entry()->name());
-  const i::List<ProfileNode*>* bottom_up_ddd_stub_children =
-      bottom_up_ddd_children->last()->children();
-  CHECK_EQ(1, bottom_up_ddd_stub_children->length());
-  CHECK_EQ("bbb", bottom_up_ddd_stub_children->last()->entry()->name());
 }