diff options
author | sleffler@chromium.org <sleffler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 20:56:43 +0000 |
---|---|---|
committer | sleffler@chromium.org <sleffler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 20:56:43 +0000 |
commit | 190f13f73accbebd0e715c9f09db2f1c42b582ca (patch) | |
tree | 64cc444f1864f9a1cd1c81c6bb05940592883d88 /base/time.h | |
parent | 2883287341c88da630585e227dbd94c624258cf9 (diff) | |
download | chromium_src-190f13f73accbebd0e715c9f09db2f1c42b582ca.zip chromium_src-190f13f73accbebd0e715c9f09db2f1c42b582ca.tar.gz chromium_src-190f13f73accbebd0e715c9f09db2f1c42b582ca.tar.bz2 |
Add interface to system trace clock.
Add TimeTicks::NowFromSystemTraceTime to return the current system trace
event clock (falling back to TimeTicks::HighResNow when not supported).
On systems where the system trace clock is available this allows
system and chrome events to be stamped with a common clock (eliminating
post-processing time shift adjustment that can be hard).
BUG=chromium-os:27809
TEST=unit tests + collect trace data on chrome os w/ kernel that supports clock_gettime(CLOCK_SYSTEM_TRACE)
Change-Id: Ia6a500bd13a6f09c49052a1dd1421027960d8dea
Review URL: http://codereview.chromium.org/10257020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time.h')
-rw-r--r-- | base/time.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/base/time.h b/base/time.h index 8590e99..5eac215 100644 --- a/base/time.h +++ b/base/time.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -482,6 +482,13 @@ class BASE_EXPORT TimeTicks { // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. static TimeTicks HighResNow(); + // Returns the current system trace time or, if none is defined, the current + // high-res time (i.e. HighResNow()). On systems where a global trace clock + // is defined, timestamping TraceEvents's with this value guarantees + // synchronization between events collected inside chrome and events + // collected outside (e.g. kernel, X server). + static TimeTicks NowFromSystemTraceTime(); + #if defined(OS_WIN) // Get the absolute value of QPC time drift. For testing. static int64 GetQPCDriftMicroseconds(); |