Slightly improved Hydrogen stats output for long-running compilations.

Replaced a scary pointer comparison by strcmp on the way.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13510 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fa06b21e
...@@ -10229,29 +10229,31 @@ void HStatistics::Print() { ...@@ -10229,29 +10229,31 @@ void HStatistics::Print() {
PrintF("%30s", names_[i]); PrintF("%30s", names_[i]);
double ms = static_cast<double>(timing_[i]) / 1000; double ms = static_cast<double>(timing_[i]) / 1000;
double percent = static_cast<double>(timing_[i]) * 100 / sum; double percent = static_cast<double>(timing_[i]) * 100 / sum;
PrintF(" - %7.3f ms / %4.1f %% ", ms, percent); PrintF(" - %8.3f ms / %4.1f %% ", ms, percent);
unsigned size = sizes_[i]; unsigned size = sizes_[i];
double size_percent = static_cast<double>(size) * 100 / total_size_; double size_percent = static_cast<double>(size) * 100 / total_size_;
PrintF(" %8u bytes / %4.1f %%\n", size, size_percent); PrintF(" %9u bytes / %4.1f %%\n", size, size_percent);
} }
PrintF("---------------------------------------------------------------\n"); PrintF("----------------------------------------"
"---------------------------------------\n");
int64_t total = create_graph_ + optimize_graph_ + generate_code_; int64_t total = create_graph_ + optimize_graph_ + generate_code_;
PrintF("%30s - %7.3f ms / %4.1f %% \n", PrintF("%30s - %8.3f ms / %4.1f %% \n",
"Create graph", "Create graph",
static_cast<double>(create_graph_) / 1000, static_cast<double>(create_graph_) / 1000,
static_cast<double>(create_graph_) * 100 / total); static_cast<double>(create_graph_) * 100 / total);
PrintF("%30s - %7.3f ms / %4.1f %% \n", PrintF("%30s - %8.3f ms / %4.1f %% \n",
"Optimize graph", "Optimize graph",
static_cast<double>(optimize_graph_) / 1000, static_cast<double>(optimize_graph_) / 1000,
static_cast<double>(optimize_graph_) * 100 / total); static_cast<double>(optimize_graph_) * 100 / total);
PrintF("%30s - %7.3f ms / %4.1f %% \n", PrintF("%30s - %8.3f ms / %4.1f %% \n",
"Generate and install code", "Generate and install code",
static_cast<double>(generate_code_) / 1000, static_cast<double>(generate_code_) / 1000,
static_cast<double>(generate_code_) * 100 / total); static_cast<double>(generate_code_) * 100 / total);
PrintF("---------------------------------------------------------------\n"); PrintF("----------------------------------------"
PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n", "---------------------------------------\n");
PrintF("%30s - %8.3f ms (%.1f times slower than full code gen)\n",
"Total", "Total",
static_cast<double>(total) / 1000, static_cast<double>(total) / 1000,
static_cast<double>(total) / full_code_gen_); static_cast<double>(total) / full_code_gen_);
...@@ -10263,7 +10265,7 @@ void HStatistics::Print() { ...@@ -10263,7 +10265,7 @@ void HStatistics::Print() {
double normalized_size_in_kb = source_size_in_kb > 0 double normalized_size_in_kb = source_size_in_kb > 0
? total_size_ / 1024 / source_size_in_kb ? total_size_ / 1024 / source_size_in_kb
: 0; : 0;
PrintF("%30s - %7.3f ms %7.3f kB allocated\n", PrintF("%30s - %8.3f ms %7.3f kB allocated\n",
"Average per kB source", "Average per kB source",
normalized_time, normalized_size_in_kb); normalized_time, normalized_size_in_kb);
} }
...@@ -10275,7 +10277,7 @@ void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { ...@@ -10275,7 +10277,7 @@ void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) {
} else { } else {
total_size_ += size; total_size_ += size;
for (int i = 0; i < names_.length(); ++i) { for (int i = 0; i < names_.length(); ++i) {
if (names_[i] == name) { if (strcmp(names_[i], name) == 0) {
timing_[i] += ticks; timing_[i] += ticks;
sizes_[i] += size; sizes_[i] += size;
return; return;
......
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