asargent@chromium.org | e3333cc | 2009-03-10 06:26:28 +0900 | [diff] [blame] | 1 | // Copyright (c) 2009 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 | // An abstraction for functions used to control execution time profiling. |
| 6 | // All methods are effectively no-ops unless this program is being run through |
| 7 | // a supported tool (currently only Quantify, a companion tool to Purify) |
| 8 | |
| 9 | #ifndef BASE_PROFILER_H__ |
| 10 | #define BASE_PROFILER_H__ |
| 11 | |
| 12 | #include "base/basictypes.h" |
| 13 | |
| 14 | namespace base { |
| 15 | |
| 16 | class Profiler { |
| 17 | public: |
| 18 | // Starts or resumes recording. |
| 19 | static void StartRecording(); |
| 20 | |
| 21 | // Stops recording until StartRecording is called or the program exits. |
| 22 | static void StopRecording(); |
| 23 | |
| 24 | // Throw away data collected so far. This can be useful to call before |
| 25 | // your first call to StartRecording, for instance to avoid counting any |
| 26 | // time in application startup. |
| 27 | static void ClearData(); |
| 28 | |
| 29 | // Sets the name of the current thread for display in the profiler's UI. |
| 30 | static void SetThreadName(const char *name); |
| 31 | |
| 32 | private: |
| 33 | DISALLOW_IMPLICIT_CONSTRUCTORS(Profiler); |
| 34 | }; |
| 35 | |
| 36 | } // namespace base |
| 37 | |
| 38 | #endif // BASE_PROFILER_H__ |