security/sandbox/chromium/base/profiler/alternate_timer.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/sandbox/chromium/base/profiler/alternate_timer.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +// This is a glue file, which allows third party code to call into our profiler
     1.9 +// without having to include most any functions from base.
    1.10 +
    1.11 +#ifndef BASE_PROFILER_ALTERNATE_TIMER_H_
    1.12 +#define BASE_PROFILER_ALTERNATE_TIMER_H_
    1.13 +
    1.14 +#include "base/base_export.h"
    1.15 +
    1.16 +namespace tracked_objects {
    1.17 +
    1.18 +enum TimeSourceType {
    1.19 +  TIME_SOURCE_TYPE_WALL_TIME,
    1.20 +  TIME_SOURCE_TYPE_TCMALLOC
    1.21 +};
    1.22 +
    1.23 +// Provide type for an alternate timer function.
    1.24 +typedef unsigned int NowFunction();
    1.25 +
    1.26 +// Environment variable name that is used to activate alternate timer profiling
    1.27 +// (such as using TCMalloc allocations to provide a pseudo-timer) for tasks
    1.28 +// instead of wall clock profiling.
    1.29 +BASE_EXPORT extern const char kAlternateProfilerTime[];
    1.30 +
    1.31 +// Set an alternate timer function to replace the OS time function when
    1.32 +// profiling.  Typically this is called by an allocator that is providing a
    1.33 +// function that indicates how much memory has been allocated on any given
    1.34 +// thread.
    1.35 +BASE_EXPORT void SetAlternateTimeSource(NowFunction* now_function,
    1.36 +                                        TimeSourceType type);
    1.37 +
    1.38 +// Gets the pointer to a function that was set via SetAlternateTimeSource().
    1.39 +// Returns NULL if no set was done prior to calling GetAlternateTimeSource.
    1.40 +NowFunction* GetAlternateTimeSource();
    1.41 +
    1.42 +// Returns the type of the currently set time source.
    1.43 +BASE_EXPORT TimeSourceType GetTimeSourceType();
    1.44 +
    1.45 +}  // namespace tracked_objects
    1.46 +
    1.47 +#endif  // BASE_PROFILER_ALTERNATE_TIMER_H_

mercurial