summaryrefslogtreecommitdiffstats
path: root/base/tracked_objects.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 23:05:01 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 23:05:01 +0000
commit90895d0f3265926221f00b3571332066a0bcb375 (patch)
treeee36e96f7bc1bfd52d0370cfc9324bee7ac1d631 /base/tracked_objects.h
parenta8c119da0066b18c472559dd80e58e9895d5ee06 (diff)
downloadchromium_src-90895d0f3265926221f00b3571332066a0bcb375.zip
chromium_src-90895d0f3265926221f00b3571332066a0bcb375.tar.gz
chromium_src-90895d0f3265926221f00b3571332066a0bcb375.tar.bz2
Support use of third party time function for about:profiler
This uses TCMalloc to provide a time function, allowing us to see how much memory was allocated on a single thread during the running of a task. The alternate time function is put in place only when a specific environment variable is detected during TCMalloc startup. This change currently is activated only in Windows/Linux, as it is based on changes TCMalloc (not used on Mac). We also create an infrastructure for using any alternate timer, to replace the "wall clock time," on a per-thread basis, in the about:profiler infrastructure. That interface may be used on other platforms, including scenarios where we have a per-thread-CPU-time function to replace the wall-clock timer. In all cases, when this alternate timer is activated, we lose the ability to calculated queueing time. Queueing time is based on a time snapshot taken on a second thread, and hence is not comparable to the alternate timer (when the alternate timer is engaged). r=rtenneti BUG=103321 Review URL: https://chromiumcodereview.appspot.com/9212025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/tracked_objects.h')
-rw-r--r--base/tracked_objects.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 96814f6..cd50594 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -17,6 +17,7 @@
#include "base/gtest_prod_util.h"
#include "base/lazy_instance.h"
#include "base/location.h"
+#include "base/profiler/alternate_timer.h"
#include "base/profiler/tracked_time.h"
#include "base/time.h"
#include "base/synchronization/lock.h"
@@ -467,6 +468,12 @@ class BASE_EXPORT ThreadData {
// the code).
static TrackedTime Now();
+ // Use the function |now| to provide current times, instead of calling the
+ // TrackedTime::Now() function. Since this alternate function is being used,
+ // the other time arguments (used for calculating queueing delay) will be
+ // ignored.
+ static void SetAlternateTimeSource(NowFunction* now);
+
// This function can be called at process termination to validate that thread
// cleanup routines have been called for at least some number of named
// threads.
@@ -543,6 +550,10 @@ class BASE_EXPORT ThreadData {
// ThreadData instances.
static void ShutdownSingleThreadedCleanup(bool leak);
+ // When non-null, this specifies an external function that supplies monotone
+ // increasing time functcion.
+ static NowFunction* now_function_;
+
// We use thread local store to identify which ThreadData to interact with.
static base::ThreadLocalStorage::StaticSlot tls_index_;