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

Side by Side Diff: src/base/platform/time.cc

Issue 2106243002: Enable ThreadTicks on Windows. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 4 years, 5 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 | « no previous file | test/unittests/base/platform/time-unittest.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/base/platform/time.h" 5 #include "src/base/platform/time.h"
6 6
7 #if V8_OS_POSIX 7 #if V8_OS_POSIX
8 #include <fcntl.h> // for O_RDONLY 8 #include <fcntl.h> // for O_RDONLY
9 #include <sys/time.h> 9 #include <sys/time.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 611
612 612
613 // static 613 // static
614 bool TimeTicks::IsHighResolutionClockWorking() { 614 bool TimeTicks::IsHighResolutionClockWorking() {
615 return true; 615 return true;
616 } 616 }
617 617
618 #endif // V8_OS_WIN 618 #endif // V8_OS_WIN
619 619
620 620
621 // TODO(lpy): For windows ThreadTicks implementation,
622 // see http://crbug.com/v8/5000
623 bool ThreadTicks::IsSupported() { 621 bool ThreadTicks::IsSupported() {
624 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ 622 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
625 defined(V8_OS_MACOSX) || defined(V8_OS_ANDROID) 623 defined(V8_OS_MACOSX) || defined(V8_OS_ANDROID)
626 return true; 624 return true;
625 #elif defined(V8_OS_WIN)
626 return IsSupportedWin();
627 #else 627 #else
628 return false; 628 return false;
629 #endif 629 #endif
630 } 630 }
631 631
632 632
633 ThreadTicks ThreadTicks::Now() { 633 ThreadTicks ThreadTicks::Now() {
634 #if V8_OS_MACOSX 634 #if V8_OS_MACOSX
635 return ThreadTicks(ComputeThreadTicks()); 635 return ThreadTicks(ComputeThreadTicks());
636 #elif(defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ 636 #elif(defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
637 defined(V8_OS_ANDROID) 637 defined(V8_OS_ANDROID)
638 return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID)); 638 return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID));
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 DCHECK_GE(tsc_now, tsc_initial); 732 DCHECK_GE(tsc_now, tsc_initial);
733 uint64_t tsc_ticks = tsc_now - tsc_initial; 733 uint64_t tsc_ticks = tsc_now - tsc_initial;
734 tsc_ticks_per_second = tsc_ticks / elapsed_time_seconds; 734 tsc_ticks_per_second = tsc_ticks / elapsed_time_seconds;
735 735
736 return tsc_ticks_per_second; 736 return tsc_ticks_per_second;
737 } 737 }
738 #endif // V8_OS_WIN 738 #endif // V8_OS_WIN
739 739
740 } // namespace base 740 } // namespace base
741 } // namespace v8 741 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/base/platform/time-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698