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

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher-tracer.cc

Issue 2637123002: Revert of [complier] Enable parallel eager inner function compilation with compiler dispatcher. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-tracer.h ('k') | src/flag-definitions.h » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" 5 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h"
6 6
7 #include "src/isolate.h" 7 #include "src/isolate.h"
8 #include "src/utils.h" 8 #include "src/utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 21 matching lines...) Expand all
32 switch (scope_id_) { 32 switch (scope_id_) {
33 case ScopeID::kPrepareToParse: 33 case ScopeID::kPrepareToParse:
34 tracer_->RecordPrepareToParse(elapsed); 34 tracer_->RecordPrepareToParse(elapsed);
35 break; 35 break;
36 case ScopeID::kParse: 36 case ScopeID::kParse:
37 tracer_->RecordParse(elapsed, num_); 37 tracer_->RecordParse(elapsed, num_);
38 break; 38 break;
39 case ScopeID::kFinalizeParsing: 39 case ScopeID::kFinalizeParsing:
40 tracer_->RecordFinalizeParsing(elapsed); 40 tracer_->RecordFinalizeParsing(elapsed);
41 break; 41 break;
42 case ScopeID::kAnalyze:
43 tracer_->RecordAnalyze(elapsed);
44 break;
45 case ScopeID::kPrepareToCompile: 42 case ScopeID::kPrepareToCompile:
46 tracer_->RecordPrepareToCompile(elapsed); 43 tracer_->RecordPrepareToCompile(elapsed);
47 break; 44 break;
48 case ScopeID::kCompile: 45 case ScopeID::kCompile:
49 tracer_->RecordCompile(elapsed, num_); 46 tracer_->RecordCompile(elapsed, num_);
50 break; 47 break;
51 case ScopeID::kFinalizeCompiling: 48 case ScopeID::kFinalizeCompiling:
52 tracer_->RecordFinalizeCompiling(elapsed); 49 tracer_->RecordFinalizeCompiling(elapsed);
53 break; 50 break;
54 } 51 }
55 } 52 }
56 53
57 // static 54 // static
58 const char* CompilerDispatcherTracer::Scope::Name(ScopeID scope_id) { 55 const char* CompilerDispatcherTracer::Scope::Name(ScopeID scope_id) {
59 switch (scope_id) { 56 switch (scope_id) {
60 case ScopeID::kPrepareToParse: 57 case ScopeID::kPrepareToParse:
61 return "V8.BackgroundCompile_PrepareToParse"; 58 return "V8.BackgroundCompile_PrepareToParse";
62 case ScopeID::kParse: 59 case ScopeID::kParse:
63 return "V8.BackgroundCompile_Parse"; 60 return "V8.BackgroundCompile_Parse";
64 case ScopeID::kFinalizeParsing: 61 case ScopeID::kFinalizeParsing:
65 return "V8.BackgroundCompile_FinalizeParsing"; 62 return "V8.BackgroundCompile_FinalizeParsing";
66 case ScopeID::kAnalyze:
67 return "V8.BackgroundCompile_Analyze";
68 case ScopeID::kPrepareToCompile: 63 case ScopeID::kPrepareToCompile:
69 return "V8.BackgroundCompile_PrepareToCompile"; 64 return "V8.BackgroundCompile_PrepareToCompile";
70 case ScopeID::kCompile: 65 case ScopeID::kCompile:
71 return "V8.BackgroundCompile_Compile"; 66 return "V8.BackgroundCompile_Compile";
72 case ScopeID::kFinalizeCompiling: 67 case ScopeID::kFinalizeCompiling:
73 return "V8.BackgroundCompile_FinalizeCompiling"; 68 return "V8.BackgroundCompile_FinalizeCompiling";
74 } 69 }
75 UNREACHABLE(); 70 UNREACHABLE();
76 return nullptr; 71 return nullptr;
77 } 72 }
(...skipping 17 matching lines...) Expand all
95 size_t source_length) { 90 size_t source_length) {
96 base::LockGuard<base::Mutex> lock(&mutex_); 91 base::LockGuard<base::Mutex> lock(&mutex_);
97 parse_events_.Push(std::make_pair(source_length, duration_ms)); 92 parse_events_.Push(std::make_pair(source_length, duration_ms));
98 } 93 }
99 94
100 void CompilerDispatcherTracer::RecordFinalizeParsing(double duration_ms) { 95 void CompilerDispatcherTracer::RecordFinalizeParsing(double duration_ms) {
101 base::LockGuard<base::Mutex> lock(&mutex_); 96 base::LockGuard<base::Mutex> lock(&mutex_);
102 finalize_parsing_events_.Push(duration_ms); 97 finalize_parsing_events_.Push(duration_ms);
103 } 98 }
104 99
105 void CompilerDispatcherTracer::RecordAnalyze(double duration_ms) {
106 base::LockGuard<base::Mutex> lock(&mutex_);
107 analyze_events_.Push(duration_ms);
108 }
109
110 void CompilerDispatcherTracer::RecordPrepareToCompile(double duration_ms) { 100 void CompilerDispatcherTracer::RecordPrepareToCompile(double duration_ms) {
111 base::LockGuard<base::Mutex> lock(&mutex_); 101 base::LockGuard<base::Mutex> lock(&mutex_);
112 prepare_compile_events_.Push(duration_ms); 102 prepare_compile_events_.Push(duration_ms);
113 } 103 }
114 104
115 void CompilerDispatcherTracer::RecordCompile(double duration_ms, 105 void CompilerDispatcherTracer::RecordCompile(double duration_ms,
116 size_t ast_size_in_bytes) { 106 size_t ast_size_in_bytes) {
117 base::LockGuard<base::Mutex> lock(&mutex_); 107 base::LockGuard<base::Mutex> lock(&mutex_);
118 compile_events_.Push(std::make_pair(ast_size_in_bytes, duration_ms)); 108 compile_events_.Push(std::make_pair(ast_size_in_bytes, duration_ms));
119 } 109 }
(...skipping 11 matching lines...) Expand all
131 double CompilerDispatcherTracer::EstimateParseInMs(size_t source_length) const { 121 double CompilerDispatcherTracer::EstimateParseInMs(size_t source_length) const {
132 base::LockGuard<base::Mutex> lock(&mutex_); 122 base::LockGuard<base::Mutex> lock(&mutex_);
133 return Estimate(parse_events_, source_length); 123 return Estimate(parse_events_, source_length);
134 } 124 }
135 125
136 double CompilerDispatcherTracer::EstimateFinalizeParsingInMs() const { 126 double CompilerDispatcherTracer::EstimateFinalizeParsingInMs() const {
137 base::LockGuard<base::Mutex> lock(&mutex_); 127 base::LockGuard<base::Mutex> lock(&mutex_);
138 return Average(finalize_parsing_events_); 128 return Average(finalize_parsing_events_);
139 } 129 }
140 130
141 double CompilerDispatcherTracer::EstimateAnalyzeInMs() const {
142 base::LockGuard<base::Mutex> lock(&mutex_);
143 return Average(analyze_events_);
144 }
145
146 double CompilerDispatcherTracer::EstimatePrepareToCompileInMs() const { 131 double CompilerDispatcherTracer::EstimatePrepareToCompileInMs() const {
147 base::LockGuard<base::Mutex> lock(&mutex_); 132 base::LockGuard<base::Mutex> lock(&mutex_);
148 return Average(prepare_compile_events_); 133 return Average(prepare_compile_events_);
149 } 134 }
150 135
151 double CompilerDispatcherTracer::EstimateCompileInMs( 136 double CompilerDispatcherTracer::EstimateCompileInMs(
152 size_t ast_size_in_bytes) const { 137 size_t ast_size_in_bytes) const {
153 base::LockGuard<base::Mutex> lock(&mutex_); 138 base::LockGuard<base::Mutex> lock(&mutex_);
154 return Estimate(compile_events_, ast_size_in_bytes); 139 return Estimate(compile_events_, ast_size_in_bytes);
155 } 140 }
156 141
157 double CompilerDispatcherTracer::EstimateFinalizeCompilingInMs() const { 142 double CompilerDispatcherTracer::EstimateFinalizeCompilingInMs() const {
158 base::LockGuard<base::Mutex> lock(&mutex_); 143 base::LockGuard<base::Mutex> lock(&mutex_);
159 return Average(finalize_compiling_events_); 144 return Average(finalize_compiling_events_);
160 } 145 }
161 146
162 void CompilerDispatcherTracer::DumpStatistics() const { 147 void CompilerDispatcherTracer::DumpStatistics() const {
163 PrintF( 148 PrintF(
164 "CompilerDispatcherTracer: " 149 "CompilerDispatcherTracer: "
165 "prepare_parsing=%.2lfms parsing=%.2lfms/kb finalize_parsing=%.2lfms " 150 "prepare_parsing=%.2lfms parsing=%.2lfms/kb finalize_parsing=%.2lfms "
166 "analyze=%.2lfms prepare_compiling=%.2lfms compiling=%.2lfms/kb " 151 "prepare_compiling=%.2lfms compiling=%.2lfms/kb "
167 "finalize_compiling=%.2lfms\n", 152 "finalize_compilig=%.2lfms\n",
168 EstimatePrepareToParseInMs(), EstimateParseInMs(1 * KB), 153 EstimatePrepareToParseInMs(), EstimateParseInMs(1 * KB),
169 EstimateFinalizeParsingInMs(), EstimateAnalyzeInMs(), 154 EstimateFinalizeParsingInMs(), EstimatePrepareToCompileInMs(),
170 EstimatePrepareToCompileInMs(), EstimateCompileInMs(1 * KB), 155 EstimateCompileInMs(1 * KB), EstimateFinalizeCompilingInMs());
171 EstimateFinalizeCompilingInMs());
172 } 156 }
173 157
174 double CompilerDispatcherTracer::Average( 158 double CompilerDispatcherTracer::Average(
175 const base::RingBuffer<double>& buffer) { 159 const base::RingBuffer<double>& buffer) {
176 if (buffer.Count() == 0) return 0.0; 160 if (buffer.Count() == 0) return 0.0;
177 double sum = buffer.Sum([](double a, double b) { return a + b; }, 0.0); 161 double sum = buffer.Sum([](double a, double b) { return a + b; }, 0.0);
178 return sum / buffer.Count(); 162 return sum / buffer.Count();
179 } 163 }
180 164
181 double CompilerDispatcherTracer::Estimate( 165 double CompilerDispatcherTracer::Estimate(
182 const base::RingBuffer<std::pair<size_t, double>>& buffer, size_t num) { 166 const base::RingBuffer<std::pair<size_t, double>>& buffer, size_t num) {
183 if (buffer.Count() == 0) return kEstimatedRuntimeWithoutData; 167 if (buffer.Count() == 0) return kEstimatedRuntimeWithoutData;
184 std::pair<size_t, double> sum = buffer.Sum( 168 std::pair<size_t, double> sum = buffer.Sum(
185 [](std::pair<size_t, double> a, std::pair<size_t, double> b) { 169 [](std::pair<size_t, double> a, std::pair<size_t, double> b) {
186 return std::make_pair(a.first + b.first, a.second + b.second); 170 return std::make_pair(a.first + b.first, a.second + b.second);
187 }, 171 },
188 std::make_pair(0, 0.0)); 172 std::make_pair(0, 0.0));
189 return num * (sum.second / sum.first); 173 return num * (sum.second / sum.first);
190 } 174 }
191 175
192 } // namespace internal 176 } // namespace internal
193 } // namespace v8 177 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-tracer.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698