| 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 #ifndef CHROME_TEST_BASE_TRACING_H_ | 5 #ifndef CHROME_TEST_BASE_TRACING_H_ |
| 6 #define CHROME_TEST_BASE_TRACING_H_ | 6 #define CHROME_TEST_BASE_TRACING_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "base/trace_event/trace_config.h" |
| 12 | 13 |
| 13 namespace tracing { | 14 namespace tracing { |
| 14 | 15 |
| 15 // Called from UI thread. | 16 // Called from UI thread. |
| 16 // Begin tracing specified category_patterns on the browser. | 17 // Begin tracing specified category_patterns on the browser. |
| 18 // |trace_config| specifies the configuration for tracing. This includes the |
| 19 // list of categories enabled, tracing modes and memory dumps configuration. |
| 20 // |
| 21 // See base/trace_event/trace_config.h for documentation of configurations. |
| 22 bool BeginTracing(const base::trace_event::TraceConfig& trace_config) |
| 23 WARN_UNUSED_RESULT; |
| 24 |
| 25 // Called from UI thread. |
| 26 // Specify a watch event in order to use the WaitForWatchEvent function. |
| 27 // After |num_occurrences| of the given event have been seen on a particular |
| 28 // process, WaitForWatchEvent will return. |
| 17 // |category_patterns| is a comma-delimited list of category wildcards. | 29 // |category_patterns| is a comma-delimited list of category wildcards. |
| 18 // A category pattern can have an optional '-' prefix to make categories with | 30 // A category pattern can have an optional '-' prefix to make categories with |
| 19 // matching categorys excluded. Either all category_patterns must be included | 31 // matching categorys excluded. Either all category_patterns must be included |
| 20 // or all must be excluded. | 32 // or all must be excluded. |
| 21 // | 33 // |
| 22 // Example: BeginTracing("test_MyTest*"); | 34 // Examples: "test_MyTest*", "test_MyTest*,test_OtherStuff", |
| 23 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); | 35 // "-excluded_category1,-excluded_category2" |
| 24 // Example: BeginTracing("-excluded_category1,-excluded_category2"); | |
| 25 // | |
| 26 // See base/trace_event/trace_event.h for documentation of included and excluded | |
| 27 // category_patterns. | |
| 28 bool BeginTracing(const std::string& category_patterns) WARN_UNUSED_RESULT; | |
| 29 | |
| 30 // Called from UI thread. | |
| 31 // Specify a watch event in order to use the WaitForWatchEvent function. | |
| 32 // After |num_occurrences| of the given event have been seen on a particular | |
| 33 // process, WaitForWatchEvent will return. | |
| 34 bool BeginTracingWithWatch(const std::string& category_patterns, | 36 bool BeginTracingWithWatch(const std::string& category_patterns, |
| 35 const std::string& category_name, | 37 const std::string& category_name, |
| 36 const std::string& event_name, | 38 const std::string& event_name, |
| 37 int num_occurrences) WARN_UNUSED_RESULT; | 39 int num_occurrences) WARN_UNUSED_RESULT; |
| 38 | 40 |
| 39 // Called from UI thread. | 41 // Called from UI thread. |
| 40 // Wait on the event set with BeginTracingWithWatch. If non-zero, return after | 42 // Wait on the event set with BeginTracingWithWatch. If non-zero, return after |
| 41 // |timeout| regardless of watch event notification. Returns true if watch event | 43 // |timeout| regardless of watch event notification. Returns true if watch event |
| 42 // occurred, false if it timed out. | 44 // occurred, false if it timed out. |
| 43 bool WaitForWatchEvent(base::TimeDelta timeout) WARN_UNUSED_RESULT; | 45 bool WaitForWatchEvent(base::TimeDelta timeout) WARN_UNUSED_RESULT; |
| 44 | 46 |
| 45 // Called from UI thread. | 47 // Called from UI thread. |
| 46 // End trace and collect the trace output as a json string. | 48 // End trace and collect the trace output as a json string. |
| 47 bool EndTracing(std::string* json_trace_output) WARN_UNUSED_RESULT; | 49 bool EndTracing(std::string* json_trace_output) WARN_UNUSED_RESULT; |
| 48 | 50 |
| 49 } // namespace tracing | 51 } // namespace tracing |
| 50 | 52 |
| 51 #endif // CHROME_TEST_BASE_TRACING_H_ | 53 #endif // CHROME_TEST_BASE_TRACING_H_ |
| OLD | NEW |