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

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

Issue 2576903004: ThreadTicks::Now support for Solaris (Closed)
Patch Set: Created 4 years 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 | no next file » | 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 // static 632 // static
633 bool TimeTicks::IsHighResolutionClockWorking() { 633 bool TimeTicks::IsHighResolutionClockWorking() {
634 return true; 634 return true;
635 } 635 }
636 636
637 #endif // V8_OS_WIN 637 #endif // V8_OS_WIN
638 638
639 639
640 bool ThreadTicks::IsSupported() { 640 bool ThreadTicks::IsSupported() {
641 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ 641 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
642 defined(V8_OS_MACOSX) || defined(V8_OS_ANDROID) 642 defined(V8_OS_MACOSX) || defined(V8_OS_ANDROID) || defined(V8_OS_SOLARIS)
lpy 2016/12/15 20:05:14 please correct the indentation, not sure how `git
mattloring 2016/12/15 20:07:45 This was the result of a git cl format. I can reve
643 return true; 643 return true;
644 #elif defined(V8_OS_WIN) 644 #elif defined(V8_OS_WIN)
645 return IsSupportedWin(); 645 return IsSupportedWin();
646 #else 646 #else
647 return false; 647 return false;
648 #endif 648 #endif
649 } 649 }
650 650
651 651
652 ThreadTicks ThreadTicks::Now() { 652 ThreadTicks ThreadTicks::Now() {
653 #if V8_OS_MACOSX 653 #if V8_OS_MACOSX
654 return ThreadTicks(ComputeThreadTicks()); 654 return ThreadTicks(ComputeThreadTicks());
655 #elif(defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ 655 #elif(defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
656 defined(V8_OS_ANDROID) 656 defined(V8_OS_ANDROID)
657 return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID)); 657 return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID));
658 #elif V8_OS_SOLARIS
659 return ThreadTicks(gethrvtime() / Time::kNanosecondsPerMicrosecond);
658 #elif V8_OS_WIN 660 #elif V8_OS_WIN
659 return ThreadTicks::GetForThread(::GetCurrentThread()); 661 return ThreadTicks::GetForThread(::GetCurrentThread());
660 #else 662 #else
661 UNREACHABLE(); 663 UNREACHABLE();
662 return ThreadTicks(); 664 return ThreadTicks();
663 #endif 665 #endif
664 } 666 }
665 667
666 668
667 #if V8_OS_WIN 669 #if V8_OS_WIN
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 DCHECK_GE(tsc_now, tsc_initial); 753 DCHECK_GE(tsc_now, tsc_initial);
752 uint64_t tsc_ticks = tsc_now - tsc_initial; 754 uint64_t tsc_ticks = tsc_now - tsc_initial;
753 tsc_ticks_per_second = tsc_ticks / elapsed_time_seconds; 755 tsc_ticks_per_second = tsc_ticks / elapsed_time_seconds;
754 756
755 return tsc_ticks_per_second; 757 return tsc_ticks_per_second;
756 } 758 }
757 #endif // V8_OS_WIN 759 #endif // V8_OS_WIN
758 760
759 } // namespace base 761 } // namespace base
760 } // namespace v8 762 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698