Index: src/optimizing-compiler-thread.cc |
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc |
index ec302badab116162f0865159e534cc995364a9ef..d0cc167041931939a787912f7c3b884994e6d4a0 100644 |
--- a/src/optimizing-compiler-thread.cc |
+++ b/src/optimizing-compiler-thread.cc |
@@ -43,13 +43,22 @@ void OptimizingCompilerThread::Run() { |
#endif |
Isolate::SetIsolateThreadLocals(isolate_, NULL); |
+ int64_t epoch = 0; |
+ if (FLAG_trace_parallel_recompilation) epoch = OS::Ticks(); |
+ |
while (true) { |
input_queue_semaphore_->Wait(); |
if (Acquire_Load(&stop_thread_)) { |
stop_semaphore_->Signal(); |
+ if (FLAG_trace_parallel_recompilation) { |
+ time_spent_total_ = OS::Ticks() - epoch; |
+ } |
return; |
} |
+ int64_t compiling_start = 0; |
+ if (FLAG_trace_parallel_recompilation) compiling_start = OS::Ticks(); |
+ |
Heap::RelocationLock relocation_lock(isolate_->heap()); |
OptimizingCompiler* optimizing_compiler = NULL; |
input_queue_.Dequeue(&optimizing_compiler); |
@@ -64,6 +73,10 @@ void OptimizingCompilerThread::Run() { |
output_queue_.Enqueue(optimizing_compiler); |
isolate_->stack_guard()->RequestCodeReadyEvent(); |
+ |
+ if (FLAG_trace_parallel_recompilation) { |
+ time_spent_compiling_ += OS::Ticks() - compiling_start; |
+ } |
} |
} |
@@ -72,6 +85,13 @@ void OptimizingCompilerThread::Stop() { |
Release_Store(&stop_thread_, static_cast<AtomicWord>(true)); |
input_queue_semaphore_->Signal(); |
stop_semaphore_->Wait(); |
+ |
+ if (FLAG_trace_parallel_recompilation) { |
+ double compile_time = static_cast<double>(time_spent_compiling_); |
+ double total_time = static_cast<double>(time_spent_total_); |
+ double percentage = (compile_time * 100) / total_time; |
+ PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage); |
+ } |
} |