OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Use trace_analyzer::Query and trace_analyzer::TraceAnalyzer to search for | 5 // Use trace_analyzer::Query and trace_analyzer::TraceAnalyzer to search for |
6 // specific trace events that were generated by the trace_event.h API. | 6 // specific trace events that were generated by the trace_event.h API. |
7 // | 7 // |
8 // Basic procedure: | 8 // Basic procedure: |
9 // - Get trace events JSON string from base::debug::TraceLog. | 9 // - Get trace events JSON string from base::trace_event::TraceLog. |
10 // - Create TraceAnalyzer with JSON string. | 10 // - Create TraceAnalyzer with JSON string. |
11 // - Call TraceAnalyzer::AssociateBeginEndEvents (optional). | 11 // - Call TraceAnalyzer::AssociateBeginEndEvents (optional). |
12 // - Call TraceAnalyzer::AssociateEvents (zero or more times). | 12 // - Call TraceAnalyzer::AssociateEvents (zero or more times). |
13 // - Call TraceAnalyzer::FindEvents with queries to find specific events. | 13 // - Call TraceAnalyzer::FindEvents with queries to find specific events. |
14 // | 14 // |
15 // A Query is a boolean expression tree that evaluates to true or false for a | 15 // A Query is a boolean expression tree that evaluates to true or false for a |
16 // given trace event. Queries can be combined into a tree using boolean, | 16 // given trace event. Queries can be combined into a tree using boolean, |
17 // arithmetic and comparison operators that refer to data of an individual trace | 17 // arithmetic and comparison operators that refer to data of an individual trace |
18 // event. | 18 // event. |
19 // | 19 // |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "base/trace_event/trace_event.h" | 82 #include "base/trace_event/trace_event.h" |
83 | 83 |
84 namespace base { | 84 namespace base { |
85 class Value; | 85 class Value; |
86 } | 86 } |
87 | 87 |
88 namespace trace_analyzer { | 88 namespace trace_analyzer { |
89 class QueryNode; | 89 class QueryNode; |
90 | 90 |
91 // trace_analyzer::TraceEvent is a more convenient form of the | 91 // trace_analyzer::TraceEvent is a more convenient form of the |
92 // base::debug::TraceEvent class to make tracing-based tests easier to write. | 92 // base::trace_event::TraceEvent class to make tracing-based tests easier to |
| 93 // write. |
93 struct TraceEvent { | 94 struct TraceEvent { |
94 // ProcessThreadID contains a Process ID and Thread ID. | 95 // ProcessThreadID contains a Process ID and Thread ID. |
95 struct ProcessThreadID { | 96 struct ProcessThreadID { |
96 ProcessThreadID() : process_id(0), thread_id(0) {} | 97 ProcessThreadID() : process_id(0), thread_id(0) {} |
97 ProcessThreadID(int process_id, int thread_id) | 98 ProcessThreadID(int process_id, int thread_id) |
98 : process_id(process_id), thread_id(thread_id) {} | 99 : process_id(process_id), thread_id(thread_id) {} |
99 bool operator< (const ProcessThreadID& rhs) const { | 100 bool operator< (const ProcessThreadID& rhs) const { |
100 if (process_id != rhs.process_id) | 101 if (process_id != rhs.process_id) |
101 return process_id < rhs.process_id; | 102 return process_id < rhs.process_id; |
102 return thread_id < rhs.thread_id; | 103 return thread_id < rhs.thread_id; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 697 |
697 // Count all matches. | 698 // Count all matches. |
698 static inline size_t CountMatches(const TraceEventVector& events, | 699 static inline size_t CountMatches(const TraceEventVector& events, |
699 const Query& query) { | 700 const Query& query) { |
700 return CountMatches(events, query, 0u, events.size()); | 701 return CountMatches(events, query, 0u, events.size()); |
701 } | 702 } |
702 | 703 |
703 } // namespace trace_analyzer | 704 } // namespace trace_analyzer |
704 | 705 |
705 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ | 706 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ |
OLD | NEW |