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 9941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9952 for (int i = 0; i < names_.length(); ++i) { | 9952 for (int i = 0; i < names_.length(); ++i) { |
9953 PrintF("%30s", names_[i]); | 9953 PrintF("%30s", names_[i]); |
9954 double ms = static_cast<double>(timing_[i]) / 1000; | 9954 double ms = static_cast<double>(timing_[i]) / 1000; |
9955 double percent = static_cast<double>(timing_[i]) * 100 / sum; | 9955 double percent = static_cast<double>(timing_[i]) * 100 / sum; |
9956 PrintF(" - %7.3f ms / %4.1f %% ", ms, percent); | 9956 PrintF(" - %7.3f ms / %4.1f %% ", ms, percent); |
9957 | 9957 |
9958 unsigned size = sizes_[i]; | 9958 unsigned size = sizes_[i]; |
9959 double size_percent = static_cast<double>(size) * 100 / total_size_; | 9959 double size_percent = static_cast<double>(size) * 100 / total_size_; |
9960 PrintF(" %8u bytes / %4.1f %%\n", size, size_percent); | 9960 PrintF(" %8u bytes / %4.1f %%\n", size, size_percent); |
9961 } | 9961 } |
9962 double source_size_in_kb = static_cast<double>(source_size_) / 1024; | 9962 |
9963 double normalized_time = source_size_in_kb > 0 | 9963 PrintF("---------------------------------------------------------------\n"); |
9964 ? (static_cast<double>(sum) / 1000) / source_size_in_kb | 9964 int64_t total = create_graph_ + optimize_graph_ + generate_code_; |
9965 : 0; | 9965 PrintF("%30s - %7.3f ms / %4.1f %% \n", |
9966 double normalized_bytes = source_size_in_kb > 0 | 9966 "Create graph", |
9967 ? total_size_ / source_size_in_kb | 9967 static_cast<double>(create_graph_) / 1000, |
9968 : 0; | 9968 static_cast<double>(create_graph_) * 100 / total); |
9969 PrintF("%30s - %7.3f ms %7.3f bytes\n", "Sum", | 9969 PrintF("%30s - %7.3f ms / %4.1f %% \n", |
9970 normalized_time, normalized_bytes); | 9970 "Optimize graph", |
| 9971 static_cast<double>(optimize_graph_) / 1000, |
| 9972 static_cast<double>(optimize_graph_) * 100 / total); |
| 9973 PrintF("%30s - %7.3f ms / %4.1f %% \n", |
| 9974 "Generate and install code", |
| 9975 static_cast<double>(generate_code_) / 1000, |
| 9976 static_cast<double>(generate_code_) * 100 / total); |
9971 PrintF("---------------------------------------------------------------\n"); | 9977 PrintF("---------------------------------------------------------------\n"); |
9972 PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n", | 9978 PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n", |
9973 "Total", | 9979 "Total", |
9974 static_cast<double>(total_) / 1000, | 9980 static_cast<double>(total) / 1000, |
9975 static_cast<double>(total_) / full_code_gen_); | 9981 static_cast<double>(total) / full_code_gen_); |
| 9982 |
| 9983 double source_size_in_kb = static_cast<double>(source_size_) / 1024; |
| 9984 double normalized_time = source_size_in_kb > 0 |
| 9985 ? (static_cast<double>(total) / 1000) / source_size_in_kb |
| 9986 : 0; |
| 9987 double normalized_size_in_kb = source_size_in_kb > 0 |
| 9988 ? total_size_ / 1024 / source_size_in_kb |
| 9989 : 0; |
| 9990 PrintF("%30s - %7.3f ms %7.3f kB allocated\n", |
| 9991 "Average per kB source", |
| 9992 normalized_time, normalized_size_in_kb); |
9976 } | 9993 } |
9977 | 9994 |
9978 | 9995 |
9979 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { | 9996 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { |
9980 if (name == HPhase::kFullCodeGen) { | 9997 if (name == HPhase::kFullCodeGen) { |
9981 full_code_gen_ += ticks; | 9998 full_code_gen_ += ticks; |
9982 } else if (name == HPhase::kTotal) { | |
9983 total_ += ticks; | |
9984 } else { | 9999 } else { |
9985 total_size_ += size; | 10000 total_size_ += size; |
9986 for (int i = 0; i < names_.length(); ++i) { | 10001 for (int i = 0; i < names_.length(); ++i) { |
9987 if (names_[i] == name) { | 10002 if (names_[i] == name) { |
9988 timing_[i] += ticks; | 10003 timing_[i] += ticks; |
9989 sizes_[i] += size; | 10004 sizes_[i] += size; |
9990 return; | 10005 return; |
9991 } | 10006 } |
9992 } | 10007 } |
9993 names_.Add(name); | 10008 names_.Add(name); |
9994 timing_.Add(ticks); | 10009 timing_.Add(ticks); |
9995 sizes_.Add(size); | 10010 sizes_.Add(size); |
9996 } | 10011 } |
9997 } | 10012 } |
9998 | 10013 |
9999 | 10014 |
10000 const char* const HPhase::kFullCodeGen = "Full code generator"; | 10015 const char* const HPhase::kFullCodeGen = "Full code generator"; |
10001 const char* const HPhase::kTotal = "Total"; | |
10002 | |
10003 | 10016 |
10004 void HPhase::Begin(const char* name, | 10017 void HPhase::Begin(const char* name, |
10005 HGraph* graph, | 10018 HGraph* graph, |
10006 LChunk* chunk, | 10019 LChunk* chunk, |
10007 LAllocator* allocator) { | 10020 LAllocator* allocator) { |
10008 name_ = name; | 10021 name_ = name; |
10009 graph_ = graph; | 10022 graph_ = graph; |
10010 chunk_ = chunk; | 10023 chunk_ = chunk; |
10011 allocator_ = allocator; | 10024 allocator_ = allocator; |
10012 if (allocator != NULL && chunk_ == NULL) { | 10025 if (allocator != NULL && chunk_ == NULL) { |
(...skipping 22 matching lines...) Expand all Loading... |
10035 } | 10048 } |
10036 } | 10049 } |
10037 | 10050 |
10038 #ifdef DEBUG | 10051 #ifdef DEBUG |
10039 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10052 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10040 if (allocator_ != NULL) allocator_->Verify(); | 10053 if (allocator_ != NULL) allocator_->Verify(); |
10041 #endif | 10054 #endif |
10042 } | 10055 } |
10043 | 10056 |
10044 } } // namespace v8::internal | 10057 } } // namespace v8::internal |
OLD | NEW |