Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/hydrogen.cc

Issue 23469013: Reland "Add Chromium-style TimeDelta, Time and TimeTicks classes, and a new ElapsedTimer class." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9797 matching lines...) Expand 10 before | Expand all | Expand 10 after
9808 9808
9809 9809
9810 void HStatistics::Initialize(CompilationInfo* info) { 9810 void HStatistics::Initialize(CompilationInfo* info) {
9811 if (info->shared_info().is_null()) return; 9811 if (info->shared_info().is_null()) return;
9812 source_size_ += info->shared_info()->SourceSize(); 9812 source_size_ += info->shared_info()->SourceSize();
9813 } 9813 }
9814 9814
9815 9815
9816 void HStatistics::Print() { 9816 void HStatistics::Print() {
9817 PrintF("Timing results:\n"); 9817 PrintF("Timing results:\n");
9818 int64_t sum = 0; 9818 TimeDelta sum;
9819 for (int i = 0; i < timing_.length(); ++i) { 9819 for (int i = 0; i < times_.length(); ++i) {
9820 sum += timing_[i]; 9820 sum += times_[i];
9821 } 9821 }
9822 9822
9823 for (int i = 0; i < names_.length(); ++i) { 9823 for (int i = 0; i < names_.length(); ++i) {
9824 PrintF("%32s", names_[i]); 9824 PrintF("%32s", names_[i]);
9825 double ms = static_cast<double>(timing_[i]) / 1000; 9825 double ms = times_[i].InMillisecondsF();
9826 double percent = static_cast<double>(timing_[i]) * 100 / sum; 9826 double percent = times_[i].PercentOf(sum);
9827 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); 9827 PrintF(" %8.3f ms / %4.1f %% ", ms, percent);
9828 9828
9829 unsigned size = sizes_[i]; 9829 unsigned size = sizes_[i];
9830 double size_percent = static_cast<double>(size) * 100 / total_size_; 9830 double size_percent = static_cast<double>(size) * 100 / total_size_;
9831 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); 9831 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent);
9832 } 9832 }
9833 9833
9834 PrintF("----------------------------------------" 9834 PrintF("----------------------------------------"
9835 "---------------------------------------\n"); 9835 "---------------------------------------\n");
9836 int64_t total = create_graph_ + optimize_graph_ + generate_code_; 9836 TimeDelta total = create_graph_ + optimize_graph_ + generate_code_;
9837 PrintF("%32s %8.3f ms / %4.1f %% \n", 9837 PrintF("%32s %8.3f ms / %4.1f %% \n",
9838 "Create graph", 9838 "Create graph",
9839 static_cast<double>(create_graph_) / 1000, 9839 create_graph_.InMillisecondsF(),
9840 static_cast<double>(create_graph_) * 100 / total); 9840 create_graph_.PercentOf(total));
9841 PrintF("%32s %8.3f ms / %4.1f %% \n", 9841 PrintF("%32s %8.3f ms / %4.1f %% \n",
9842 "Optimize graph", 9842 "Optimize graph",
9843 static_cast<double>(optimize_graph_) / 1000, 9843 optimize_graph_.InMillisecondsF(),
9844 static_cast<double>(optimize_graph_) * 100 / total); 9844 optimize_graph_.PercentOf(total));
9845 PrintF("%32s %8.3f ms / %4.1f %% \n", 9845 PrintF("%32s %8.3f ms / %4.1f %% \n",
9846 "Generate and install code", 9846 "Generate and install code",
9847 static_cast<double>(generate_code_) / 1000, 9847 generate_code_.InMillisecondsF(),
9848 static_cast<double>(generate_code_) * 100 / total); 9848 generate_code_.PercentOf(total));
9849 PrintF("----------------------------------------" 9849 PrintF("----------------------------------------"
9850 "---------------------------------------\n"); 9850 "---------------------------------------\n");
9851 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n", 9851 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n",
9852 "Total", 9852 "Total",
9853 static_cast<double>(total) / 1000, 9853 total.InMillisecondsF(),
9854 static_cast<double>(total) / full_code_gen_); 9854 total.TimesOf(full_code_gen_));
9855 9855
9856 double source_size_in_kb = static_cast<double>(source_size_) / 1024; 9856 double source_size_in_kb = static_cast<double>(source_size_) / 1024;
9857 double normalized_time = source_size_in_kb > 0 9857 double normalized_time = source_size_in_kb > 0
9858 ? (static_cast<double>(total) / 1000) / source_size_in_kb 9858 ? total.InMillisecondsF() / source_size_in_kb
9859 : 0; 9859 : 0;
9860 double normalized_size_in_kb = source_size_in_kb > 0 9860 double normalized_size_in_kb = source_size_in_kb > 0
9861 ? total_size_ / 1024 / source_size_in_kb 9861 ? total_size_ / 1024 / source_size_in_kb
9862 : 0; 9862 : 0;
9863 PrintF("%32s %8.3f ms %7.3f kB allocated\n", 9863 PrintF("%32s %8.3f ms %7.3f kB allocated\n",
9864 "Average per kB source", 9864 "Average per kB source",
9865 normalized_time, normalized_size_in_kb); 9865 normalized_time, normalized_size_in_kb);
9866 } 9866 }
9867 9867
9868 9868
9869 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { 9869 void HStatistics::SaveTiming(const char* name, TimeDelta time, unsigned size) {
9870 total_size_ += size; 9870 total_size_ += size;
9871 for (int i = 0; i < names_.length(); ++i) { 9871 for (int i = 0; i < names_.length(); ++i) {
9872 if (strcmp(names_[i], name) == 0) { 9872 if (strcmp(names_[i], name) == 0) {
9873 timing_[i] += ticks; 9873 times_[i] += time;
9874 sizes_[i] += size; 9874 sizes_[i] += size;
9875 return; 9875 return;
9876 } 9876 }
9877 } 9877 }
9878 names_.Add(name); 9878 names_.Add(name);
9879 timing_.Add(ticks); 9879 times_.Add(time);
9880 sizes_.Add(size); 9880 sizes_.Add(size);
9881 } 9881 }
9882 9882
9883 9883
9884 HPhase::~HPhase() { 9884 HPhase::~HPhase() {
9885 if (ShouldProduceTraceOutput()) { 9885 if (ShouldProduceTraceOutput()) {
9886 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9886 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9887 } 9887 }
9888 9888
9889 #ifdef DEBUG 9889 #ifdef DEBUG
9890 graph_->Verify(false); // No full verify. 9890 graph_->Verify(false); // No full verify.
9891 #endif 9891 #endif
9892 } 9892 }
9893 9893
9894 } } // namespace v8::internal 9894 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698