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

Side by Side Diff: src/hydrogen.cc

Issue 23295034: 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: Fix windows build. 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
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 9761 matching lines...) Expand 10 before | Expand all | Expand 10 after
9772 9772
9773 9773
9774 void HStatistics::Initialize(CompilationInfo* info) { 9774 void HStatistics::Initialize(CompilationInfo* info) {
9775 if (info->shared_info().is_null()) return; 9775 if (info->shared_info().is_null()) return;
9776 source_size_ += info->shared_info()->SourceSize(); 9776 source_size_ += info->shared_info()->SourceSize();
9777 } 9777 }
9778 9778
9779 9779
9780 void HStatistics::Print() { 9780 void HStatistics::Print() {
9781 PrintF("Timing results:\n"); 9781 PrintF("Timing results:\n");
9782 int64_t sum = 0; 9782 TimeDelta sum;
9783 for (int i = 0; i < timing_.length(); ++i) { 9783 for (int i = 0; i < times_.length(); ++i) {
9784 sum += timing_[i]; 9784 sum += times_[i];
9785 } 9785 }
9786 9786
9787 for (int i = 0; i < names_.length(); ++i) { 9787 for (int i = 0; i < names_.length(); ++i) {
9788 PrintF("%32s", names_[i]); 9788 PrintF("%32s", names_[i]);
9789 double ms = static_cast<double>(timing_[i]) / 1000; 9789 double ms = times_[i].InMillisecondsF();
9790 double percent = static_cast<double>(timing_[i]) * 100 / sum; 9790 double percent = times_[i].PercentOf(sum);
9791 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); 9791 PrintF(" %8.3f ms / %4.1f %% ", ms, percent);
9792 9792
9793 unsigned size = sizes_[i]; 9793 unsigned size = sizes_[i];
9794 double size_percent = static_cast<double>(size) * 100 / total_size_; 9794 double size_percent = static_cast<double>(size) * 100 / total_size_;
9795 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); 9795 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent);
9796 } 9796 }
9797 9797
9798 PrintF("----------------------------------------" 9798 PrintF("----------------------------------------"
9799 "---------------------------------------\n"); 9799 "---------------------------------------\n");
9800 int64_t total = create_graph_ + optimize_graph_ + generate_code_; 9800 TimeDelta total = create_graph_ + optimize_graph_ + generate_code_;
9801 PrintF("%32s %8.3f ms / %4.1f %% \n", 9801 PrintF("%32s %8.3f ms / %4.1f %% \n",
9802 "Create graph", 9802 "Create graph",
9803 static_cast<double>(create_graph_) / 1000, 9803 create_graph_.InMillisecondsF(),
9804 static_cast<double>(create_graph_) * 100 / total); 9804 create_graph_.PercentOf(total));
9805 PrintF("%32s %8.3f ms / %4.1f %% \n", 9805 PrintF("%32s %8.3f ms / %4.1f %% \n",
9806 "Optimize graph", 9806 "Optimize graph",
9807 static_cast<double>(optimize_graph_) / 1000, 9807 optimize_graph_.InMillisecondsF(),
9808 static_cast<double>(optimize_graph_) * 100 / total); 9808 optimize_graph_.PercentOf(total));
9809 PrintF("%32s %8.3f ms / %4.1f %% \n", 9809 PrintF("%32s %8.3f ms / %4.1f %% \n",
9810 "Generate and install code", 9810 "Generate and install code",
9811 static_cast<double>(generate_code_) / 1000, 9811 generate_code_.InMillisecondsF(),
9812 static_cast<double>(generate_code_) * 100 / total); 9812 generate_code_.PercentOf(total));
9813 PrintF("----------------------------------------" 9813 PrintF("----------------------------------------"
9814 "---------------------------------------\n"); 9814 "---------------------------------------\n");
9815 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n", 9815 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n",
9816 "Total", 9816 "Total",
9817 static_cast<double>(total) / 1000, 9817 total.InMillisecondsF(),
9818 static_cast<double>(total) / full_code_gen_); 9818 total.TimesOf(full_code_gen_));
9819 9819
9820 double source_size_in_kb = static_cast<double>(source_size_) / 1024; 9820 double source_size_in_kb = static_cast<double>(source_size_) / 1024;
9821 double normalized_time = source_size_in_kb > 0 9821 double normalized_time = source_size_in_kb > 0
9822 ? (static_cast<double>(total) / 1000) / source_size_in_kb 9822 ? total.InMillisecondsF() / source_size_in_kb
9823 : 0; 9823 : 0;
9824 double normalized_size_in_kb = source_size_in_kb > 0 9824 double normalized_size_in_kb = source_size_in_kb > 0
9825 ? total_size_ / 1024 / source_size_in_kb 9825 ? total_size_ / 1024 / source_size_in_kb
9826 : 0; 9826 : 0;
9827 PrintF("%32s %8.3f ms %7.3f kB allocated\n", 9827 PrintF("%32s %8.3f ms %7.3f kB allocated\n",
9828 "Average per kB source", 9828 "Average per kB source",
9829 normalized_time, normalized_size_in_kb); 9829 normalized_time, normalized_size_in_kb);
9830 } 9830 }
9831 9831
9832 9832
9833 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { 9833 void HStatistics::SaveTiming(const char* name, TimeDelta time, unsigned size) {
9834 total_size_ += size; 9834 total_size_ += size;
9835 for (int i = 0; i < names_.length(); ++i) { 9835 for (int i = 0; i < names_.length(); ++i) {
9836 if (strcmp(names_[i], name) == 0) { 9836 if (strcmp(names_[i], name) == 0) {
9837 timing_[i] += ticks; 9837 times_[i] += time;
9838 sizes_[i] += size; 9838 sizes_[i] += size;
9839 return; 9839 return;
9840 } 9840 }
9841 } 9841 }
9842 names_.Add(name); 9842 names_.Add(name);
9843 timing_.Add(ticks); 9843 times_.Add(time);
9844 sizes_.Add(size); 9844 sizes_.Add(size);
9845 } 9845 }
9846 9846
9847 9847
9848 HPhase::~HPhase() { 9848 HPhase::~HPhase() {
9849 if (ShouldProduceTraceOutput()) { 9849 if (ShouldProduceTraceOutput()) {
9850 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9850 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9851 } 9851 }
9852 9852
9853 #ifdef DEBUG 9853 #ifdef DEBUG
9854 graph_->Verify(false); // No full verify. 9854 graph_->Verify(false); // No full verify.
9855 #endif 9855 #endif
9856 } 9856 }
9857 9857
9858 } } // namespace v8::internal 9858 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/lithium-allocator.cc » ('j') | src/time/elapsed-timer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698