| 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 // 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::debug::TraceLog. |
| 10 // - Create TraceAnalyzer with JSON string. | 10 // - Create TraceAnalyzer with JSON string. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 // Compare with the given string pattern. Only works with == and != operators. | 247 // Compare with the given string pattern. Only works with == and != operators. |
| 248 // Example: Query(EVENT_NAME) == Query::Pattern("MyEvent*") | 248 // Example: Query(EVENT_NAME) == Query::Pattern("MyEvent*") |
| 249 static Query Pattern(const std::string& pattern); | 249 static Query Pattern(const std::string& pattern); |
| 250 | 250 |
| 251 // Common queries: | 251 // Common queries: |
| 252 | 252 |
| 253 // Find BEGIN events that have a corresponding END event. | 253 // Find BEGIN events that have a corresponding END event. |
| 254 static Query MatchBeginWithEnd() { | 254 static Query MatchBeginWithEnd() { |
| 255 return (Query(EVENT_PHASE) == | 255 return (Query(EVENT_PHASE) == |
| 256 Query::Phase(base::debug::TRACE_EVENT_PHASE_BEGIN)) && | 256 Query::Phase(TRACE_EVENT_PHASE_BEGIN)) && |
| 257 Query(EVENT_HAS_OTHER); | 257 Query(EVENT_HAS_OTHER); |
| 258 } | 258 } |
| 259 | 259 |
| 260 // Find BEGIN events of given |name| which also have associated END events. | 260 // Find BEGIN events of given |name| which also have associated END events. |
| 261 static Query MatchBeginName(const std::string& name) { | 261 static Query MatchBeginName(const std::string& name) { |
| 262 return (Query(EVENT_NAME) == name) && MatchBeginWithEnd(); | 262 return (Query(EVENT_NAME) == name) && MatchBeginWithEnd(); |
| 263 } | 263 } |
| 264 | 264 |
| 265 // Match given Process ID and Thread ID. | 265 // Match given Process ID and Thread ID. |
| 266 static Query MatchThread(const TraceEvent::ProcessThreadID& thread) { | 266 static Query MatchThread(const TraceEvent::ProcessThreadID& thread) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 std::map<TraceEvent::ProcessThreadID, std::string> thread_names_; | 472 std::map<TraceEvent::ProcessThreadID, std::string> thread_names_; |
| 473 std::vector<TraceEvent> raw_events_; | 473 std::vector<TraceEvent> raw_events_; |
| 474 bool allow_assocation_changes_; | 474 bool allow_assocation_changes_; |
| 475 | 475 |
| 476 DISALLOW_COPY_AND_ASSIGN(TraceAnalyzer); | 476 DISALLOW_COPY_AND_ASSIGN(TraceAnalyzer); |
| 477 }; | 477 }; |
| 478 | 478 |
| 479 } // namespace trace_analyzer | 479 } // namespace trace_analyzer |
| 480 | 480 |
| 481 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ | 481 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ |
| OLD | NEW |