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

Side by Side Diff: src/optimizing-compile-dispatcher.cc

Issue 1118533003: Make CPU profiler do not hog 100% of CPU. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do not use Sleep on Windows Created 5 years, 7 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/optimizing-compile-dispatcher.h" 5 #include "src/optimizing-compile-dispatcher.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/base/atomicops.h" 9 #include "src/base/atomicops.h"
10 #include "src/full-codegen.h" 10 #include "src/full-codegen.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 DisallowHeapAllocation no_allocation; 56 DisallowHeapAllocation no_allocation;
57 DisallowHandleAllocation no_handles; 57 DisallowHandleAllocation no_handles;
58 DisallowHandleDereference no_deref; 58 DisallowHandleDereference no_deref;
59 59
60 OptimizingCompileDispatcher* dispatcher = 60 OptimizingCompileDispatcher* dispatcher =
61 isolate_->optimizing_compile_dispatcher(); 61 isolate_->optimizing_compile_dispatcher();
62 { 62 {
63 TimerEventScope<TimerEventRecompileConcurrent> timer(isolate_); 63 TimerEventScope<TimerEventRecompileConcurrent> timer(isolate_);
64 64
65 if (dispatcher->recompilation_delay_ != 0) { 65 if (dispatcher->recompilation_delay_ != 0) {
66 base::OS::Sleep(dispatcher->recompilation_delay_); 66 base::OS::Sleep(base::TimeDelta::FromMilliseconds(
67 dispatcher->recompilation_delay_));
67 } 68 }
68 69
69 dispatcher->CompileNext(dispatcher->NextInput(true)); 70 dispatcher->CompileNext(dispatcher->NextInput(true));
70 } 71 }
71 { 72 {
72 base::LockGuard<base::Mutex> lock_guard(&dispatcher->ref_count_mutex_); 73 base::LockGuard<base::Mutex> lock_guard(&dispatcher->ref_count_mutex_);
73 if (--dispatcher->ref_count_ == 0) { 74 if (--dispatcher->ref_count_ == 0) {
74 dispatcher->ref_count_zero_.NotifyOne(); 75 dispatcher->ref_count_zero_.NotifyOne();
75 } 76 }
76 } 77 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 info->closure()->PrintName(); 351 info->closure()->PrintName();
351 PrintF(", AST id %d]\n", info->osr_ast_id().ToInt()); 352 PrintF(", AST id %d]\n", info->osr_ast_id().ToInt());
352 } 353 }
353 DisposeOptimizedCompileJob(stale, false); 354 DisposeOptimizedCompileJob(stale, false);
354 } 355 }
355 osr_buffer_[osr_buffer_cursor_] = job; 356 osr_buffer_[osr_buffer_cursor_] = job;
356 osr_buffer_cursor_ = (osr_buffer_cursor_ + 1) % osr_buffer_capacity_; 357 osr_buffer_cursor_ = (osr_buffer_cursor_ + 1) % osr_buffer_capacity_;
357 } 358 }
358 } 359 }
359 } // namespace v8::internal 360 } // namespace v8::internal
OLDNEW
« src/cpu-profiler.cc ('K') | « src/cpu-profiler.cc ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698