• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_COMMON_PROFILING_H_
6 #define CHROME_COMMON_PROFILING_H_
7 
8 #include "build/build_config.h"
9 
10 #include "base/basictypes.h"
11 #include "base/debug/profiler.h"
12 
13 // The Profiling class manages the interaction with a sampling based profiler.
14 // Its function is controlled by the kProfilingAtStart, kProfilingFile, and
15 // kProfilingFlush command line values.
16 // All of the API should only be called from the main thread of the process.
17 class Profiling {
18  public:
19   // Called early in a process' life to allow profiling of startup time.
20   // the presence of kProfilingAtStart is checked.
21   static void ProcessStarted();
22 
23   // Start profiling.
24   static void Start();
25 
26   // Stop profiling and write out profiling file.
27   static void Stop();
28 
29   // Returns true if the process is being profiled.
30   static bool BeingProfiled();
31 
32   // Toggle profiling on/off.
33   static void Toggle();
34 
35  private:
36   // Do not instantiate this class.
37   Profiling();
38 
39   DISALLOW_COPY_AND_ASSIGN(Profiling);
40 };
41 
42 #endif  // CHROME_COMMON_PROFILING_H_
43