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

Side by Side Diff: src/base/platform/platform-win32.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 // Platform-specific code for Win32. 5 // Platform-specific code for Win32.
6 6
7 // Secure API functions are not available using MinGW with msvcrt.dll 7 // Secure API functions are not available using MinGW with msvcrt.dll
8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to 8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to
9 // disable definition of secure API functions in standard headers that 9 // disable definition of secure API functions in standard headers that
10 // would conflict with our own implementation. 10 // would conflict with our own implementation.
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect); 805 VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect);
806 } 806 }
807 807
808 808
809 void OS::Guard(void* address, const size_t size) { 809 void OS::Guard(void* address, const size_t size) {
810 DWORD oldprotect; 810 DWORD oldprotect;
811 VirtualProtect(address, size, PAGE_NOACCESS, &oldprotect); 811 VirtualProtect(address, size, PAGE_NOACCESS, &oldprotect);
812 } 812 }
813 813
814 814
815 void OS::Sleep(int milliseconds) { 815 void OS::Sleep(TimeDelta interval) {
816 ::Sleep(milliseconds); 816 ::Sleep(static_cast<DWORD>(interval.InMilliseconds()));
817 } 817 }
818 818
819 819
820 void OS::Abort() { 820 void OS::Abort() {
821 if (g_hard_abort) { 821 if (g_hard_abort) {
822 V8_IMMEDIATE_CRASH(); 822 V8_IMMEDIATE_CRASH();
823 } 823 }
824 // Make the MSVCRT do a silent abort. 824 // Make the MSVCRT do a silent abort.
825 raise(SIGABRT); 825 raise(SIGABRT);
826 } 826 }
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 } 1378 }
1379 1379
1380 1380
1381 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 1381 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
1382 BOOL result = TlsSetValue(static_cast<DWORD>(key), value); 1382 BOOL result = TlsSetValue(static_cast<DWORD>(key), value);
1383 USE(result); 1383 USE(result);
1384 DCHECK(result); 1384 DCHECK(result);
1385 } 1385 }
1386 1386
1387 1387
1388 1388 void Thread::YieldCPU() { ::Sleep(0); }
1389 void Thread::YieldCPU() {
1390 Sleep(0);
1391 }
1392
1393 } } // namespace v8::base 1389 } } // namespace v8::base
OLDNEW
« no previous file with comments | « src/base/platform/platform-posix.cc ('k') | src/cpu-profiler.cc » ('j') | src/cpu-profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698