Chromium Code Reviews| 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 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 | 37 |
| 38 #define PASTE_LINE_NUMBER_ON_NAME(name, line) name##line | 38 #define PASTE_LINE_NUMBER_ON_NAME(name, line) name##line |
| 39 | 39 |
| 40 #define LINE_BASED_VARIABLE_NAME_FOR_PROFILING \ | 40 #define LINE_BASED_VARIABLE_NAME_FOR_PROFILING \ |
| 41 PASTE_LINE_NUMBER_ON_NAME(some_profiler_variable_, __LINE__) | 41 PASTE_LINE_NUMBER_ON_NAME(some_profiler_variable_, __LINE__) |
| 42 | 42 |
| 43 #define TRACK_RUN_IN_IPC_HANDLER(dispatch_function_name) \ | 43 #define TRACK_RUN_IN_IPC_HANDLER(dispatch_function_name) \ |
| 44 ::tracked_objects::ScopedProfile some_tracking_variable_name( \ | 44 ::tracked_objects::ScopedProfile some_tracking_variable_name( \ |
| 45 FROM_HERE_WITH_EXPLICIT_FUNCTION(#dispatch_function_name)) | 45 FROM_HERE_WITH_EXPLICIT_FUNCTION(#dispatch_function_name)) |
| 46 | 46 |
| 47 // Profiled region for developer and official builds. It allows developers to do | |
| 48 // profiling of their code, and see results on their about:profiler page and in | |
| 49 // Google-internal server-side tools. | |
| 50 #define TRACK_RUN_IN_THIS_SCOPED_REGION(scope_name) \ | |
| 51 TRACK_RUN_IN_IPC_HANDLER(scope_name) | |
|
Ilya Sherman
2014/09/24 23:38:01
It looks like all of the macros in this file could
vadimt
2014/09/25 00:21:21
Done.
| |
| 52 | |
| 47 | 53 |
| 48 namespace tracked_objects { | 54 namespace tracked_objects { |
| 49 class Births; | 55 class Births; |
| 50 | 56 |
| 51 class BASE_EXPORT ScopedProfile { | 57 class BASE_EXPORT ScopedProfile { |
| 52 public: | 58 public: |
| 53 explicit ScopedProfile(const Location& location); | 59 explicit ScopedProfile(const Location& location); |
| 54 ~ScopedProfile(); | 60 ~ScopedProfile(); |
| 55 | 61 |
| 56 // Stop tracing prior to the end destruction of the instance. | 62 // Stop tracing prior to the end destruction of the instance. |
| 57 void StopClockAndTally(); | 63 void StopClockAndTally(); |
| 58 | 64 |
| 59 private: | 65 private: |
| 60 Births* birth_; // Place in code where tracking started. | 66 Births* birth_; // Place in code where tracking started. |
| 61 TaskStopwatch stopwatch_; | 67 TaskStopwatch stopwatch_; |
| 62 | 68 |
| 63 DISALLOW_COPY_AND_ASSIGN(ScopedProfile); | 69 DISALLOW_COPY_AND_ASSIGN(ScopedProfile); |
| 64 }; | 70 }; |
| 65 | 71 |
| 66 } // namespace tracked_objects | 72 } // namespace tracked_objects |
| 67 | 73 |
| 68 #endif // BASE_PROFILER_SCOPED_PROFILE_H_ | 74 #endif // BASE_PROFILER_SCOPED_PROFILE_H_ |
| OLD | NEW |