OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 10211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10222 PrintF("Timing results:\n"); | 10222 PrintF("Timing results:\n"); |
10223 int64_t sum = 0; | 10223 int64_t sum = 0; |
10224 for (int i = 0; i < timing_.length(); ++i) { | 10224 for (int i = 0; i < timing_.length(); ++i) { |
10225 sum += timing_[i]; | 10225 sum += timing_[i]; |
10226 } | 10226 } |
10227 | 10227 |
10228 for (int i = 0; i < names_.length(); ++i) { | 10228 for (int i = 0; i < names_.length(); ++i) { |
10229 PrintF("%30s", names_[i]); | 10229 PrintF("%30s", names_[i]); |
10230 double ms = static_cast<double>(timing_[i]) / 1000; | 10230 double ms = static_cast<double>(timing_[i]) / 1000; |
10231 double percent = static_cast<double>(timing_[i]) * 100 / sum; | 10231 double percent = static_cast<double>(timing_[i]) * 100 / sum; |
10232 PrintF(" - %7.3f ms / %4.1f %% ", ms, percent); | 10232 PrintF(" - %8.3f ms / %4.1f %% ", ms, percent); |
10233 | 10233 |
10234 unsigned size = sizes_[i]; | 10234 unsigned size = sizes_[i]; |
10235 double size_percent = static_cast<double>(size) * 100 / total_size_; | 10235 double size_percent = static_cast<double>(size) * 100 / total_size_; |
10236 PrintF(" %8u bytes / %4.1f %%\n", size, size_percent); | 10236 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); |
10237 } | 10237 } |
10238 | 10238 |
10239 PrintF("---------------------------------------------------------------\n"); | 10239 PrintF("----------------------------------------" |
| 10240 "---------------------------------------\n"); |
10240 int64_t total = create_graph_ + optimize_graph_ + generate_code_; | 10241 int64_t total = create_graph_ + optimize_graph_ + generate_code_; |
10241 PrintF("%30s - %7.3f ms / %4.1f %% \n", | 10242 PrintF("%30s - %8.3f ms / %4.1f %% \n", |
10242 "Create graph", | 10243 "Create graph", |
10243 static_cast<double>(create_graph_) / 1000, | 10244 static_cast<double>(create_graph_) / 1000, |
10244 static_cast<double>(create_graph_) * 100 / total); | 10245 static_cast<double>(create_graph_) * 100 / total); |
10245 PrintF("%30s - %7.3f ms / %4.1f %% \n", | 10246 PrintF("%30s - %8.3f ms / %4.1f %% \n", |
10246 "Optimize graph", | 10247 "Optimize graph", |
10247 static_cast<double>(optimize_graph_) / 1000, | 10248 static_cast<double>(optimize_graph_) / 1000, |
10248 static_cast<double>(optimize_graph_) * 100 / total); | 10249 static_cast<double>(optimize_graph_) * 100 / total); |
10249 PrintF("%30s - %7.3f ms / %4.1f %% \n", | 10250 PrintF("%30s - %8.3f ms / %4.1f %% \n", |
10250 "Generate and install code", | 10251 "Generate and install code", |
10251 static_cast<double>(generate_code_) / 1000, | 10252 static_cast<double>(generate_code_) / 1000, |
10252 static_cast<double>(generate_code_) * 100 / total); | 10253 static_cast<double>(generate_code_) * 100 / total); |
10253 PrintF("---------------------------------------------------------------\n"); | 10254 PrintF("----------------------------------------" |
10254 PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n", | 10255 "---------------------------------------\n"); |
| 10256 PrintF("%30s - %8.3f ms (%.1f times slower than full code gen)\n", |
10255 "Total", | 10257 "Total", |
10256 static_cast<double>(total) / 1000, | 10258 static_cast<double>(total) / 1000, |
10257 static_cast<double>(total) / full_code_gen_); | 10259 static_cast<double>(total) / full_code_gen_); |
10258 | 10260 |
10259 double source_size_in_kb = static_cast<double>(source_size_) / 1024; | 10261 double source_size_in_kb = static_cast<double>(source_size_) / 1024; |
10260 double normalized_time = source_size_in_kb > 0 | 10262 double normalized_time = source_size_in_kb > 0 |
10261 ? (static_cast<double>(total) / 1000) / source_size_in_kb | 10263 ? (static_cast<double>(total) / 1000) / source_size_in_kb |
10262 : 0; | 10264 : 0; |
10263 double normalized_size_in_kb = source_size_in_kb > 0 | 10265 double normalized_size_in_kb = source_size_in_kb > 0 |
10264 ? total_size_ / 1024 / source_size_in_kb | 10266 ? total_size_ / 1024 / source_size_in_kb |
10265 : 0; | 10267 : 0; |
10266 PrintF("%30s - %7.3f ms %7.3f kB allocated\n", | 10268 PrintF("%30s - %8.3f ms %7.3f kB allocated\n", |
10267 "Average per kB source", | 10269 "Average per kB source", |
10268 normalized_time, normalized_size_in_kb); | 10270 normalized_time, normalized_size_in_kb); |
10269 } | 10271 } |
10270 | 10272 |
10271 | 10273 |
10272 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { | 10274 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { |
10273 if (name == HPhase::kFullCodeGen) { | 10275 if (name == HPhase::kFullCodeGen) { |
10274 full_code_gen_ += ticks; | 10276 full_code_gen_ += ticks; |
10275 } else { | 10277 } else { |
10276 total_size_ += size; | 10278 total_size_ += size; |
10277 for (int i = 0; i < names_.length(); ++i) { | 10279 for (int i = 0; i < names_.length(); ++i) { |
10278 if (names_[i] == name) { | 10280 if (strcmp(names_[i], name) == 0) { |
10279 timing_[i] += ticks; | 10281 timing_[i] += ticks; |
10280 sizes_[i] += size; | 10282 sizes_[i] += size; |
10281 return; | 10283 return; |
10282 } | 10284 } |
10283 } | 10285 } |
10284 names_.Add(name); | 10286 names_.Add(name); |
10285 timing_.Add(ticks); | 10287 timing_.Add(ticks); |
10286 sizes_.Add(size); | 10288 sizes_.Add(size); |
10287 } | 10289 } |
10288 } | 10290 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10324 } | 10326 } |
10325 } | 10327 } |
10326 | 10328 |
10327 #ifdef DEBUG | 10329 #ifdef DEBUG |
10328 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10330 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10329 if (allocator_ != NULL) allocator_->Verify(); | 10331 if (allocator_ != NULL) allocator_->Verify(); |
10330 #endif | 10332 #endif |
10331 } | 10333 } |
10332 | 10334 |
10333 } } // namespace v8::internal | 10335 } } // namespace v8::internal |
OLD | NEW |