diff options
author | sleffler@chromium.org <sleffler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 23:32:49 +0000 |
---|---|---|
committer | sleffler@chromium.org <sleffler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-15 23:32:49 +0000 |
commit | a86a3f9d9e6392f9ad39a59019ba2b1618cf78d5 (patch) | |
tree | ecd54cc5944dfb5c79d19651389e51578dbe6fd9 /base | |
parent | cd019bef4cd2890bbf2326d1f246a2a0568ba949 (diff) | |
download | chromium_src-a86a3f9d9e6392f9ad39a59019ba2b1618cf78d5.zip chromium_src-a86a3f9d9e6392f9ad39a59019ba2b1618cf78d5.tar.gz chromium_src-a86a3f9d9e6392f9ad39a59019ba2b1618cf78d5.tar.bz2 |
Enable system trace clock use on chrome os.
Enable CLOCK_SYSTEM_TRACE use when built with chromeos=1. Handle the
case of building for chrome os but running on a non-chromeos platform
by handling clock_gettime failure and falling back to HighResNow.
BUG=chromium-os:30502
TEST=base_unittests + verify chrome:tracing works w/ a chromeos=1 build on linux and on cros (using the correct clock in each case)
Change-Id: I1627e414524c04db27ddf2a62798a802ea440919
Review URL: https://chromiumcodereview.appspot.com/10384154
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/time_posix.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/base/time_posix.cc b/base/time_posix.cc index b8f1385..18203cf 100644 --- a/base/time_posix.cc +++ b/base/time_posix.cc @@ -228,7 +228,11 @@ TimeTicks TimeTicks::HighResNow() { return Now(); } -#if defined(OS_POSIX) && defined(CLOCK_SYSTEM_TRACE) +#if defined(OS_CHROMEOS) +// Force definition of the system trace clock; it is a chromeos-only api +// at the moment and surfacing it in the right place requires mucking +// with glibc et al. +#define CLOCK_SYSTEM_TRACE 11 // static TimeTicks TimeTicks::NowFromSystemTraceTime() { @@ -236,7 +240,7 @@ TimeTicks TimeTicks::NowFromSystemTraceTime() { struct timespec ts; if (clock_gettime(CLOCK_SYSTEM_TRACE, &ts) != 0) { - NOTREACHED() << "clock_gettime(CLOCK_SYSTEM_TRACE) failed."; + // NB: fall-back for a chrome os build running on linux return HighResNow(); } @@ -247,14 +251,14 @@ TimeTicks TimeTicks::NowFromSystemTraceTime() { return TimeTicks(absolute_micro); } -#else // !(defined(OS_POSIX) && defined(CLOCK_SYSTEM_TRACE)) +#else // !defined(OS_CHROMEOS) // static TimeTicks TimeTicks::NowFromSystemTraceTime() { return HighResNow(); } -#endif // defined(OS_POSIX) && defined(CLOCK_SYSTEM_TRACE) +#endif // defined(OS_CHROMEOS) #endif // !OS_MACOSX |