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

Side by Side Diff: src/base/platform/platform-posix.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 POSIX goes here. This is not a platform on its 5 // Platform-specific code for POSIX goes here. This is not a platform on its
6 // own, but contains the parts which are the same across the POSIX platforms 6 // own, but contains the parts which are the same across the POSIX platforms
7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX.
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 #endif 212 #endif
213 return reinterpret_cast<void*>(raw_addr); 213 return reinterpret_cast<void*>(raw_addr);
214 } 214 }
215 215
216 216
217 size_t OS::AllocateAlignment() { 217 size_t OS::AllocateAlignment() {
218 return static_cast<size_t>(sysconf(_SC_PAGESIZE)); 218 return static_cast<size_t>(sysconf(_SC_PAGESIZE));
219 } 219 }
220 220
221 221
222 void OS::Sleep(int milliseconds) { 222 void OS::Sleep(TimeDelta interval) {
223 useconds_t ms = static_cast<useconds_t>(milliseconds); 223 usleep(static_cast<useconds_t>(interval.InMicroseconds()));
224 usleep(1000 * ms);
225 } 224 }
226 225
227 226
228 void OS::Abort() { 227 void OS::Abort() {
229 if (g_hard_abort) { 228 if (g_hard_abort) {
230 V8_IMMEDIATE_CRASH(); 229 V8_IMMEDIATE_CRASH();
231 } 230 }
232 // Redirect to std abort to signal abnormal program termination. 231 // Redirect to std abort to signal abnormal program termination.
233 abort(); 232 abort();
234 } 233 }
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 755
757 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 756 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
758 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); 757 pthread_key_t pthread_key = LocalKeyToPthreadKey(key);
759 int result = pthread_setspecific(pthread_key, value); 758 int result = pthread_setspecific(pthread_key, value);
760 DCHECK_EQ(0, result); 759 DCHECK_EQ(0, result);
761 USE(result); 760 USE(result);
762 } 761 }
763 762
764 763
765 } } // namespace v8::base 764 } } // namespace v8::base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698