| 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::debug::TraceLog. |
| 10 // - Create TraceAnalyzer with JSON string. | 10 // - Create TraceAnalyzer with JSON string. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // Step 4: analyze events, such as checking durations. | 68 // Step 4: analyze events, such as checking durations. |
| 69 // for (size_t i = 0; i < events.size(); ++i) { | 69 // for (size_t i = 0; i < events.size(); ++i) { |
| 70 // double duration; | 70 // double duration; |
| 71 // EXPECT_TRUE(events[i].GetAbsTimeToOtherEvent(&duration)); | 71 // EXPECT_TRUE(events[i].GetAbsTimeToOtherEvent(&duration)); |
| 72 // EXPECT_LT(duration, 1000000.0/60.0); // expect less than 1/60 second. | 72 // EXPECT_LT(duration, 1000000.0/60.0); // expect less than 1/60 second. |
| 73 // } | 73 // } |
| 74 | 74 |
| 75 | 75 |
| 76 #ifndef BASE_TEST_TRACE_EVENT_ANALYZER_H_ | 76 #ifndef BASE_TEST_TRACE_EVENT_ANALYZER_H_ |
| 77 #define BASE_TEST_TRACE_EVENT_ANALYZER_H_ | 77 #define BASE_TEST_TRACE_EVENT_ANALYZER_H_ |
| 78 #pragma once | |
| 79 | 78 |
| 80 #include <map> | 79 #include <map> |
| 81 | 80 |
| 82 #include "base/debug/trace_event.h" | 81 #include "base/debug/trace_event.h" |
| 83 #include "base/memory/ref_counted.h" | 82 #include "base/memory/ref_counted.h" |
| 84 | 83 |
| 85 namespace base { | 84 namespace base { |
| 86 class Value; | 85 class Value; |
| 87 } | 86 } |
| 88 | 87 |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 600 |
| 602 // Count all matches. | 601 // Count all matches. |
| 603 static inline size_t CountMatches(const TraceEventVector& events, | 602 static inline size_t CountMatches(const TraceEventVector& events, |
| 604 const Query& query) { | 603 const Query& query) { |
| 605 return CountMatches(events, query, 0u, events.size()); | 604 return CountMatches(events, query, 0u, events.size()); |
| 606 } | 605 } |
| 607 | 606 |
| 608 } // namespace trace_analyzer | 607 } // namespace trace_analyzer |
| 609 | 608 |
| 610 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ | 609 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ |
| OLD | NEW |