| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9806 | 9806 |
| 9807 | 9807 |
| 9808 void HStatistics::Initialize(CompilationInfo* info) { | 9808 void HStatistics::Initialize(CompilationInfo* info) { |
| 9809 if (info->shared_info().is_null()) return; | 9809 if (info->shared_info().is_null()) return; |
| 9810 source_size_ += info->shared_info()->SourceSize(); | 9810 source_size_ += info->shared_info()->SourceSize(); |
| 9811 } | 9811 } |
| 9812 | 9812 |
| 9813 | 9813 |
| 9814 void HStatistics::Print() { | 9814 void HStatistics::Print() { |
| 9815 PrintF("Timing results:\n"); | 9815 PrintF("Timing results:\n"); |
| 9816 int64_t sum = 0; | 9816 TimeDelta sum; |
| 9817 for (int i = 0; i < timing_.length(); ++i) { | 9817 for (int i = 0; i < times_.length(); ++i) { |
| 9818 sum += timing_[i]; | 9818 sum += times_[i]; |
| 9819 } | 9819 } |
| 9820 | 9820 |
| 9821 for (int i = 0; i < names_.length(); ++i) { | 9821 for (int i = 0; i < names_.length(); ++i) { |
| 9822 PrintF("%32s", names_[i]); | 9822 PrintF("%32s", names_[i]); |
| 9823 double ms = static_cast<double>(timing_[i]) / 1000; | 9823 double ms = times_[i].InMillisecondsF(); |
| 9824 double percent = static_cast<double>(timing_[i]) * 100 / sum; | 9824 double percent = times_[i].PercentOf(sum); |
| 9825 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); | 9825 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); |
| 9826 | 9826 |
| 9827 unsigned size = sizes_[i]; | 9827 unsigned size = sizes_[i]; |
| 9828 double size_percent = static_cast<double>(size) * 100 / total_size_; | 9828 double size_percent = static_cast<double>(size) * 100 / total_size_; |
| 9829 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); | 9829 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); |
| 9830 } | 9830 } |
| 9831 | 9831 |
| 9832 PrintF("----------------------------------------" | 9832 PrintF("----------------------------------------" |
| 9833 "---------------------------------------\n"); | 9833 "---------------------------------------\n"); |
| 9834 int64_t total = create_graph_ + optimize_graph_ + generate_code_; | 9834 TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; |
| 9835 PrintF("%32s %8.3f ms / %4.1f %% \n", | 9835 PrintF("%32s %8.3f ms / %4.1f %% \n", |
| 9836 "Create graph", | 9836 "Create graph", |
| 9837 static_cast<double>(create_graph_) / 1000, | 9837 create_graph_.InMillisecondsF(), |
| 9838 static_cast<double>(create_graph_) * 100 / total); | 9838 create_graph_.PercentOf(total)); |
| 9839 PrintF("%32s %8.3f ms / %4.1f %% \n", | 9839 PrintF("%32s %8.3f ms / %4.1f %% \n", |
| 9840 "Optimize graph", | 9840 "Optimize graph", |
| 9841 static_cast<double>(optimize_graph_) / 1000, | 9841 optimize_graph_.InMillisecondsF(), |
| 9842 static_cast<double>(optimize_graph_) * 100 / total); | 9842 optimize_graph_.PercentOf(total)); |
| 9843 PrintF("%32s %8.3f ms / %4.1f %% \n", | 9843 PrintF("%32s %8.3f ms / %4.1f %% \n", |
| 9844 "Generate and install code", | 9844 "Generate and install code", |
| 9845 static_cast<double>(generate_code_) / 1000, | 9845 generate_code_.InMillisecondsF(), |
| 9846 static_cast<double>(generate_code_) * 100 / total); | 9846 generate_code_.PercentOf(total)); |
| 9847 PrintF("----------------------------------------" | 9847 PrintF("----------------------------------------" |
| 9848 "---------------------------------------\n"); | 9848 "---------------------------------------\n"); |
| 9849 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n", | 9849 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n", |
| 9850 "Total", | 9850 "Total", |
| 9851 static_cast<double>(total) / 1000, | 9851 total.InMillisecondsF(), |
| 9852 static_cast<double>(total) / full_code_gen_); | 9852 total.TimesOf(full_code_gen_)); |
| 9853 | 9853 |
| 9854 double source_size_in_kb = static_cast<double>(source_size_) / 1024; | 9854 double source_size_in_kb = static_cast<double>(source_size_) / 1024; |
| 9855 double normalized_time = source_size_in_kb > 0 | 9855 double normalized_time = source_size_in_kb > 0 |
| 9856 ? (static_cast<double>(total) / 1000) / source_size_in_kb | 9856 ? total.InMillisecondsF() / source_size_in_kb |
| 9857 : 0; | 9857 : 0; |
| 9858 double normalized_size_in_kb = source_size_in_kb > 0 | 9858 double normalized_size_in_kb = source_size_in_kb > 0 |
| 9859 ? total_size_ / 1024 / source_size_in_kb | 9859 ? total_size_ / 1024 / source_size_in_kb |
| 9860 : 0; | 9860 : 0; |
| 9861 PrintF("%32s %8.3f ms %7.3f kB allocated\n", | 9861 PrintF("%32s %8.3f ms %7.3f kB allocated\n", |
| 9862 "Average per kB source", | 9862 "Average per kB source", |
| 9863 normalized_time, normalized_size_in_kb); | 9863 normalized_time, normalized_size_in_kb); |
| 9864 } | 9864 } |
| 9865 | 9865 |
| 9866 | 9866 |
| 9867 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { | 9867 void HStatistics::SaveTiming(const char* name, TimeDelta time, unsigned size) { |
| 9868 total_size_ += size; | 9868 total_size_ += size; |
| 9869 for (int i = 0; i < names_.length(); ++i) { | 9869 for (int i = 0; i < names_.length(); ++i) { |
| 9870 if (strcmp(names_[i], name) == 0) { | 9870 if (strcmp(names_[i], name) == 0) { |
| 9871 timing_[i] += ticks; | 9871 times_[i] += time; |
| 9872 sizes_[i] += size; | 9872 sizes_[i] += size; |
| 9873 return; | 9873 return; |
| 9874 } | 9874 } |
| 9875 } | 9875 } |
| 9876 names_.Add(name); | 9876 names_.Add(name); |
| 9877 timing_.Add(ticks); | 9877 times_.Add(time); |
| 9878 sizes_.Add(size); | 9878 sizes_.Add(size); |
| 9879 } | 9879 } |
| 9880 | 9880 |
| 9881 | 9881 |
| 9882 HPhase::~HPhase() { | 9882 HPhase::~HPhase() { |
| 9883 if (ShouldProduceTraceOutput()) { | 9883 if (ShouldProduceTraceOutput()) { |
| 9884 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9884 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9885 } | 9885 } |
| 9886 | 9886 |
| 9887 #ifdef DEBUG | 9887 #ifdef DEBUG |
| 9888 graph_->Verify(false); // No full verify. | 9888 graph_->Verify(false); // No full verify. |
| 9889 #endif | 9889 #endif |
| 9890 } | 9890 } |
| 9891 | 9891 |
| 9892 } } // namespace v8::internal | 9892 } } // namespace v8::internal |
| OLD | NEW |