| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 #ifndef BASE_PROFILER_SCOPED_PROFILE_H_ | 6 #ifndef BASE_PROFILER_SCOPED_PROFILE_H_ |
| 7 #define BASE_PROFILER_SCOPED_PROFILE_H_ | 7 #define BASE_PROFILER_SCOPED_PROFILE_H_ |
| 8 | 8 |
| 9 //------------------------------------------------------------------------------ | 9 //------------------------------------------------------------------------------ |
| 10 // ScopedProfile provides basic helper functions for profiling a short | 10 // ScopedProfile provides basic helper functions for profiling a short |
| 11 // region of code within a scope. It is separate from the related ThreadData | 11 // region of code within a scope. It is separate from the related ThreadData |
| 12 // class so that it can be included without much other cruft, and provide the | 12 // class so that it can be included without much other cruft, and provide the |
| 13 // macros listed below. | 13 // macros listed below. |
| 14 | 14 |
| 15 #include "base/base_export.h" | 15 #include "base/base_export.h" |
| 16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/profiler/tracked_time.h" | 17 #include "base/profiler/tracked_time.h" |
| 18 #include "base/tracked_objects.h" |
| 18 | 19 |
| 19 #if defined(GOOGLE_CHROME_BUILD) | 20 #if defined(GOOGLE_CHROME_BUILD) |
| 20 | 21 |
| 21 // We don't ship these profiled regions. This is for developer builds only. | 22 // We don't ship these profiled regions. This is for developer builds only. |
| 22 // It allows developers to do some profiling of their code, and see results on | 23 // It allows developers to do some profiling of their code, and see results on |
| 23 // their about:profiler page. | 24 // their about:profiler page. |
| 24 #define TRACK_RUN_IN_THIS_SCOPED_REGION_FOR_DEVELOPER_BUILDS(scope_name) \ | 25 #define TRACK_RUN_IN_THIS_SCOPED_REGION_FOR_DEVELOPER_BUILDS(scope_name) \ |
| 25 ((void)0) | 26 ((void)0) |
| 26 | 27 |
| 27 #else | 28 #else |
| (...skipping 22 matching lines...) Expand all Loading... |
| 50 class BASE_EXPORT ScopedProfile { | 51 class BASE_EXPORT ScopedProfile { |
| 51 public: | 52 public: |
| 52 explicit ScopedProfile(const Location& location); | 53 explicit ScopedProfile(const Location& location); |
| 53 ~ScopedProfile(); | 54 ~ScopedProfile(); |
| 54 | 55 |
| 55 // Stop tracing prior to the end destruction of the instance. | 56 // Stop tracing prior to the end destruction of the instance. |
| 56 void StopClockAndTally(); | 57 void StopClockAndTally(); |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 Births* birth_; // Place in code where tracking started. | 60 Births* birth_; // Place in code where tracking started. |
| 60 const TrackedTime start_of_run_; | 61 TaskStopwatch stopwatch_; |
| 61 | 62 |
| 62 DISALLOW_COPY_AND_ASSIGN(ScopedProfile); | 63 DISALLOW_COPY_AND_ASSIGN(ScopedProfile); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace tracked_objects | 66 } // namespace tracked_objects |
| 66 | 67 |
| 67 #endif // BASE_PROFILER_SCOPED_PROFILE_H_ | 68 #endif // BASE_PROFILER_SCOPED_PROFILE_H_ |
| OLD | NEW |