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

Side by Side Diff: base/time/time.h

Issue 69393002: Enable Time::ThreadNow() on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/time/time_posix.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 // Time represents an absolute point in time, internally represented as 5 // Time represents an absolute point in time, internally represented as
6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC)
7 // (See http://crbug.com/14734). System-dependent clock interface routines are 7 // (See http://crbug.com/14734). System-dependent clock interface routines are
8 // defined in time_PLATFORM.cc. 8 // defined in time_PLATFORM.cc.
9 // 9 //
10 // TimeDelta represents a duration of time, internally represented in 10 // TimeDelta represents a duration of time, internally represented in
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // is hardware dependent and may or may not return sub-millisecond 542 // is hardware dependent and may or may not return sub-millisecond
543 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND 543 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND
544 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. 544 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED.
545 static TimeTicks HighResNow(); 545 static TimeTicks HighResNow();
546 546
547 static bool IsHighResNowFastAndReliable(); 547 static bool IsHighResNowFastAndReliable();
548 548
549 // Returns true if ThreadNow() is supported on this system. 549 // Returns true if ThreadNow() is supported on this system.
550 static bool IsThreadNowSupported() { 550 static bool IsThreadNowSupported() {
551 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ 551 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
552 (defined(OS_MACOSX) && !defined(OS_IOS)) 552 (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID)
553 return true; 553 return true;
554 #else 554 #else
555 return false; 555 return false;
556 #endif 556 #endif
557 } 557 }
558 558
559 // Returns thread-specific CPU-time on systems that support this feature. 559 // Returns thread-specific CPU-time on systems that support this feature.
560 // Needs to be guarded with a call to IsThreadNowSupported(). Use this timer 560 // Needs to be guarded with a call to IsThreadNowSupported(). Use this timer
561 // to (approximately) measure how much time the calling thread spent doing 561 // to (approximately) measure how much time the calling thread spent doing
562 // actual work vs. being de-scheduled. May return bogus results if the thread 562 // actual work vs. being de-scheduled. May return bogus results if the thread
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 #endif 684 #endif
685 }; 685 };
686 686
687 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 687 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
688 return TimeTicks(t.ticks_ + delta_); 688 return TimeTicks(t.ticks_ + delta_);
689 } 689 }
690 690
691 } // namespace base 691 } // namespace base
692 692
693 #endif // BASE_TIME_TIME_H_ 693 #endif // BASE_TIME_TIME_H_
OLDNEW
« no previous file with comments | « no previous file | base/time/time_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698