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.h" | |
11 | 12 |
12 namespace tracing { | 13 namespace tracing { |
13 | 14 |
15 // Called from UI thread. | |
14 // Begin tracing specified categories on the browser. | 16 // Begin tracing specified categories on the browser. |
15 // |categories| is a comma-delimited list of category wildcards. | 17 // |categories| is a comma-delimited list of category wildcards. A category can |
16 // A category can have an optional '-' prefix to make it an excluded category. | 18 // have an optional '-' prefix to make it an excluded category. Either all |
17 // Either all categories must be included or all must be excluded. | 19 // categories must be included or all must be excluded. |
18 // | 20 // |
19 // Example: BeginTracing("test_MyTest*"); | 21 // Example: BeginTracing("test_MyTest*"); |
20 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); | 22 // Example: BeginTracing("test_MyTest*,test_OtherStuff"); |
21 // Example: BeginTracing("-excluded_category1,-excluded_category2"); | 23 // Example: BeginTracing("-excluded_category1,-excluded_category2"); |
22 // | 24 // |
23 // See base/debug/trace_event.h for documentation of included and excluded | 25 // See base/debug/trace_event.h for documentation of included and excluded |
24 // categories. | 26 // categories. |
25 bool BeginTracing(const std::string& categories) WARN_UNUSED_RESULT; | 27 bool BeginTracing(const std::string& categories) WARN_UNUSED_RESULT; |
26 | 28 |
29 // Called from UI thread. | |
30 // Specify a watch event in order to use the WaitForWatchEvent function. | |
31 // After |num_occurrences| of the given event have been seen on a particular | |
32 // process, WaitForWatchEvent will return. | |
33 bool BeginTracingWithWatch(const std::string& categories, | |
34 const char* category_name, | |
sky
2012/08/29 16:05:09
Can all the args be const std::string& ? Simpler f
jbates
2012/08/29 21:14:12
Done.
| |
35 const char* event_name, | |
36 int num_occurrences) WARN_UNUSED_RESULT; | |
37 | |
38 // Called from UI thread. | |
39 // Wait on the event set with BeginTracingWithWatch. If non-zero, return after | |
40 // |timeout| regardless of watch event notification. Returns true if watch event | |
41 // occurred, false if it timed out. | |
42 bool WaitForWatchEvent(base::TimeDelta timeout) WARN_UNUSED_RESULT; | |
43 | |
44 // Called from UI thread. | |
27 // End trace and collect the trace output as a json string. | 45 // End trace and collect the trace output as a json string. |
28 bool EndTracing(std::string* json_trace_output) WARN_UNUSED_RESULT; | 46 bool EndTracing(std::string* json_trace_output) WARN_UNUSED_RESULT; |
29 | 47 |
30 } // namespace tracing | 48 } // namespace tracing |
31 | 49 |
32 #endif // CHROME_TEST_BASE_TRACING_H_ | 50 #endif // CHROME_TEST_BASE_TRACING_H_ |
OLD | NEW |