Reviewers: danno,

Message:
ptal

Description:
[turbofan] add absolute peak to stats

[email protected]

BUG=

Please review this at https://codereview.chromium.org/676693002/

Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+33, -10 lines):
  M src/compilation-statistics.h
  M src/compilation-statistics.cc
  M src/compiler/pipeline.cc
  M src/compiler/pipeline-statistics.h
  M src/compiler/pipeline-statistics.cc


Index: src/compilation-statistics.cc
diff --git a/src/compilation-statistics.cc b/src/compilation-statistics.cc
index eb5b60c5cb182ccb11e3d0f59d630f080e6779a7..2686ff74edb28d646c23dc03db4fe9220ae717f5 100644
--- a/src/compilation-statistics.cc
+++ b/src/compilation-statistics.cc
@@ -47,7 +47,8 @@ void CompilationStatistics::RecordTotalStats(size_t source_size, void CompilationStatistics::BasicStats::Accumulate(const BasicStats& stats) {
   delta_ += stats.delta_;
   total_allocated_bytes_ += stats.total_allocated_bytes_;
-  if (stats.max_allocated_bytes_ > max_allocated_bytes_) {
+ if (stats.absolute_max_allocated_bytes_ > absolute_max_allocated_bytes_) {
+    absolute_max_allocated_bytes_ = stats.absolute_max_allocated_bytes_;
     max_allocated_bytes_ = stats.max_allocated_bytes_;
     function_name_ = stats.function_name_;
   }
@@ -66,9 +67,12 @@ static void WriteLine(std::ostream& os, const char* name,
       static_cast<double>(stats.total_allocated_bytes_ * 100) /
       static_cast<double>(total_stats.total_allocated_bytes_);
   base::OS::SNPrintF(buffer, kBufferSize,
- "%28s %10.3f ms / %5.1f %% %10u total / %5.1f %% %10u max",
+                     "%28s %10.3f ms / %5.1f %%"
+                     "%10u total / %5.1f %% "
+                     "%10u max %10u abs_max",
                      name, ms, percent, stats.total_allocated_bytes_,
-                     size_percent, stats.max_allocated_bytes_);
+                     size_percent, stats.max_allocated_bytes_,
+                     stats.absolute_max_allocated_bytes_);

   os << buffer;
   if (stats.function_name_.size() > 0) {
@@ -79,8 +83,8 @@ static void WriteLine(std::ostream& os, const char* name,


 static void WriteFullLine(std::ostream& os) {
-  os << "-----------------------------------------------"
-        "-----------------------------------------------\n";
+  os << "--------------------------------------------------------"
+        "--------------------------------------------------------\n";
 }


@@ -92,8 +96,8 @@ static void WriteHeader(std::ostream& os) {


 static void WritePhaseKindBreak(std::ostream& os) {
-  os << "                             ------------------"
-        "-----------------------------------------------\n";
+  os << "                             ---------------------------"
+        "--------------------------------------------------------\n";
 }


Index: src/compilation-statistics.h
diff --git a/src/compilation-statistics.h b/src/compilation-statistics.h
index 62fefe3d732a6c2c3e357cc3730428e426801055..45ffb9b8231cbc6e4b470aafb1cbfd2acd34b07c 100644
--- a/src/compilation-statistics.h
+++ b/src/compilation-statistics.h
@@ -22,13 +22,17 @@ class CompilationStatistics FINAL : public Malloced {

   class BasicStats {
    public:
-    BasicStats() : total_allocated_bytes_(0), max_allocated_bytes_(0) {}
+    BasicStats()
+        : total_allocated_bytes_(0),
+          max_allocated_bytes_(0),
+          absolute_max_allocated_bytes_(0) {}

     void Accumulate(const BasicStats& stats);

     base::TimeDelta delta_;
     size_t total_allocated_bytes_;
     size_t max_allocated_bytes_;
+    size_t absolute_max_allocated_bytes_;
     std::string function_name_;
   };

Index: src/compiler/pipeline-statistics.cc
diff --git a/src/compiler/pipeline-statistics.cc b/src/compiler/pipeline-statistics.cc index 45408b5e9835d82abd95c85df743941a19c4c316..e58c3965784fc6c2a1f8b5e0c45be1a0e612e8ec 100644
--- a/src/compiler/pipeline-statistics.cc
+++ b/src/compiler/pipeline-statistics.cc
@@ -16,6 +16,10 @@ void PipelineStatistics::CommonStats::Begin(
   scope_.Reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_));
   timer_.Start();
   outer_zone_initial_size_ = pipeline_stats->OuterZoneSize();
+  allocated_bytes_at_start_ =
+      outer_zone_initial_size_ -
+      pipeline_stats->total_stats_.outer_zone_initial_size_ +
+      pipeline_stats->zone_pool_->GetCurrentAllocatedBytes();
 }


@@ -28,6 +32,8 @@ void PipelineStatistics::CommonStats::End(
   size_t outer_zone_diff =
       pipeline_stats->OuterZoneSize() - outer_zone_initial_size_;
diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes();
+  diff->absolute_max_allocated_bytes_ =
+      diff->max_allocated_bytes_ + allocated_bytes_at_start_;
   diff->total_allocated_bytes_ =
       outer_zone_diff + scope_->GetTotalAllocatedBytes();
   scope_.Reset(NULL);
Index: src/compiler/pipeline-statistics.h
diff --git a/src/compiler/pipeline-statistics.h b/src/compiler/pipeline-statistics.h index 972a71064654f97d0e03fa80806e4957105ab5fa..01cc9de9d13c64d3a025c55a352b6659e23ad1db 100644
--- a/src/compiler/pipeline-statistics.h
+++ b/src/compiler/pipeline-statistics.h
@@ -39,6 +39,7 @@ class PipelineStatistics : public Malloced {
     SmartPointer<ZonePool::StatsScope> scope_;
     base::ElapsedTimer timer_;
     size_t outer_zone_initial_size_;
+    size_t allocated_bytes_at_start_;
   };

   bool InPhaseKind() { return !phase_kind_stats_.scope_.is_empty(); }
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 609de0670b16d6795c323efae90afa8f3ff7b7db..47896a8e65e37081377f4036efc41f0771c6db28 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -181,7 +181,7 @@ Handle<Code> Pipeline::GenerateCode() {
   SmartPointer<PipelineStatistics> pipeline_statistics;
   if (FLAG_turbo_stats) {
     pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool));
-    pipeline_statistics->BeginPhaseKind("create graph");
+    pipeline_statistics->BeginPhaseKind("graph creation");
   }

   if (FLAG_trace_turbo) {
@@ -348,7 +348,7 @@ Handle<Code> Pipeline::GenerateCode() {
   }

   if (!pipeline_statistics.is_empty()) {
-    pipeline_statistics->BeginPhaseKind("code generation");
+    pipeline_statistics->BeginPhaseKind("block building");
   }

   source_positions.RemoveDecorator();
@@ -452,6 +452,10 @@ Handle<Code> Pipeline::GenerateCode(PipelineStatistics* pipeline_statistics,
                                  &sequence);
   }

+  if (pipeline_statistics != NULL) {
+    pipeline_statistics->BeginPhaseKind("register allocation");
+  }
+
   // Allocate registers.
   Frame frame;
   {
@@ -478,6 +482,10 @@ Handle<Code> Pipeline::GenerateCode(PipelineStatistics* pipeline_statistics,
        << sequence;
   }

+  if (pipeline_statistics != NULL) {
+    pipeline_statistics->BeginPhaseKind("code generation");
+  }
+
   // Generate native sequence.
   Handle<Code> code;
   {


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to