| 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/debug/scoped_thread_heap_usage.h" |
| 16 #include "base/location.h" | 17 #include "base/location.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/profiler/tracked_time.h" | 19 #include "base/profiler/tracked_time.h" |
| 19 #include "base/tracked_objects.h" | 20 #include "base/tracked_objects.h" |
| 20 | 21 |
| 21 #define PASTE_LINE_NUMBER_ON_NAME(name, line) name##line | 22 #define PASTE_LINE_NUMBER_ON_NAME(name, line) name##line |
| 22 | 23 |
| 23 #define LINE_BASED_VARIABLE_NAME_FOR_PROFILING \ | 24 #define LINE_BASED_VARIABLE_NAME_FOR_PROFILING \ |
| 24 PASTE_LINE_NUMBER_ON_NAME(some_profiler_variable_, __LINE__) | 25 PASTE_LINE_NUMBER_ON_NAME(some_profiler_variable_, __LINE__) |
| 25 | 26 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 50 DISABLED, // Do nothing. | 51 DISABLED, // Do nothing. |
| 51 ENABLED // Create and tally a task. | 52 ENABLED // Create and tally a task. |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 ScopedProfile(const Location& location, Mode mode); | 55 ScopedProfile(const Location& location, Mode mode); |
| 55 ~ScopedProfile(); | 56 ~ScopedProfile(); |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 Births* birth_; // Place in code where tracking started. | 59 Births* birth_; // Place in code where tracking started. |
| 59 TaskStopwatch stopwatch_; | 60 TaskStopwatch stopwatch_; |
| 61 base::debug::HeapUsageTracker heap_usage_; |
| 60 | 62 |
| 61 DISALLOW_COPY_AND_ASSIGN(ScopedProfile); | 63 DISALLOW_COPY_AND_ASSIGN(ScopedProfile); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 } // namespace tracked_objects | 66 } // namespace tracked_objects |
| 65 | 67 |
| 66 #endif // BASE_PROFILER_SCOPED_PROFILE_H_ | 68 #endif // BASE_PROFILER_SCOPED_PROFILE_H_ |
| OLD | NEW |