Commit 89885c8a authored by dcarney@chromium.org's avatar dcarney@chromium.org

[turbofan] add absolute peak to stats

R=danno@chromium.org

BUG=

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

Cr-Commit-Position: refs/heads/master@{#24892}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24892 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 82581534
......@@ -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";
}
......
......@@ -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_;
};
......
......@@ -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);
......
......@@ -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(); }
......
......@@ -157,7 +157,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) {
......@@ -326,7 +326,7 @@ Handle<Code> Pipeline::GenerateCode() {
}
if (!pipeline_statistics.is_empty()) {
pipeline_statistics->BeginPhaseKind("code generation");
pipeline_statistics->BeginPhaseKind("block building");
}
source_positions.RemoveDecorator();
......@@ -430,6 +430,10 @@ Handle<Code> Pipeline::GenerateCode(PipelineStatistics* pipeline_statistics,
tcf << AsC1V("CodeGen", schedule, source_positions, &sequence);
}
if (pipeline_statistics != NULL) {
pipeline_statistics->BeginPhaseKind("register allocation");
}
// Allocate registers.
Frame frame;
{
......@@ -457,6 +461,10 @@ Handle<Code> Pipeline::GenerateCode(PipelineStatistics* pipeline_statistics,
<< sequence;
}
if (pipeline_statistics != NULL) {
pipeline_statistics->BeginPhaseKind("code generation");
}
// Generate native sequence.
Handle<Code> code;
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment