Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Side by Side Diff: base/test/trace_event_analyzer.h

Issue 1544113002: Switch to standard integer types in base/test/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/test/thread_test_helper.h ('k') | base/test/trace_event_analyzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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::trace_event::TraceLog. 9 // - Get trace events JSON string from base::trace_event::TraceLog.
10 // - Create TraceAnalyzer with JSON string. 10 // - Create TraceAnalyzer with JSON string.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 78
79 #include <stddef.h>
80 #include <stdint.h>
81
79 #include <map> 82 #include <map>
80 83
84 #include "base/macros.h"
81 #include "base/memory/ref_counted.h" 85 #include "base/memory/ref_counted.h"
82 #include "base/trace_event/trace_event.h" 86 #include "base/trace_event/trace_event.h"
83 87
84 namespace base { 88 namespace base {
85 class Value; 89 class Value;
86 } 90 }
87 91
88 namespace trace_analyzer { 92 namespace trace_analyzer {
89 class QueryNode; 93 class QueryNode;
90 94
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ~Query(); 180 ~Query();
177 181
178 //////////////////////////////////////////////////////////////// 182 ////////////////////////////////////////////////////////////////
179 // Query literal values 183 // Query literal values
180 184
181 // Compare with the given string. 185 // Compare with the given string.
182 static Query String(const std::string& str); 186 static Query String(const std::string& str);
183 187
184 // Compare with the given number. 188 // Compare with the given number.
185 static Query Double(double num); 189 static Query Double(double num);
186 static Query Int(int32 num); 190 static Query Int(int32_t num);
187 static Query Uint(uint32 num); 191 static Query Uint(uint32_t num);
188 192
189 // Compare with the given bool. 193 // Compare with the given bool.
190 static Query Bool(bool boolean); 194 static Query Bool(bool boolean);
191 195
192 // Compare with the given phase. 196 // Compare with the given phase.
193 static Query Phase(char phase); 197 static Query Phase(char phase);
194 198
195 // Compare with the given string pattern. Only works with == and != operators. 199 // Compare with the given string pattern. Only works with == and != operators.
196 // Example: Query(EVENT_NAME) == Query::Pattern("MyEvent*") 200 // Example: Query(EVENT_NAME) == Query::Pattern("MyEvent*")
197 static Query Pattern(const std::string& pattern); 201 static Query Pattern(const std::string& pattern);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 Query operator||(const Query& rhs) const; 403 Query operator||(const Query& rhs) const;
400 Query operator!() const; 404 Query operator!() const;
401 405
402 // Arithmetic operators: 406 // Arithmetic operators:
403 // Following operators are applied to double arguments: 407 // Following operators are applied to double arguments:
404 Query operator+(const Query& rhs) const; 408 Query operator+(const Query& rhs) const;
405 Query operator-(const Query& rhs) const; 409 Query operator-(const Query& rhs) const;
406 Query operator*(const Query& rhs) const; 410 Query operator*(const Query& rhs) const;
407 Query operator/(const Query& rhs) const; 411 Query operator/(const Query& rhs) const;
408 Query operator-() const; 412 Query operator-() const;
409 // Mod operates on int64 args (doubles are casted to int64 beforehand): 413 // Mod operates on int64_t args (doubles are casted to int64_t beforehand):
410 Query operator%(const Query& rhs) const; 414 Query operator%(const Query& rhs) const;
411 415
412 // Return true if the given event matches this query tree. 416 // Return true if the given event matches this query tree.
413 // This is a recursive method that walks the query tree. 417 // This is a recursive method that walks the query tree.
414 bool Evaluate(const TraceEvent& event) const; 418 bool Evaluate(const TraceEvent& event) const;
415 419
416 private: 420 private:
417 enum TraceEventMember { 421 enum TraceEventMember {
418 EVENT_INVALID, 422 EVENT_INVALID,
419 EVENT_PID, 423 EVENT_PID,
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 701
698 // Count all matches. 702 // Count all matches.
699 static inline size_t CountMatches(const TraceEventVector& events, 703 static inline size_t CountMatches(const TraceEventVector& events,
700 const Query& query) { 704 const Query& query) {
701 return CountMatches(events, query, 0u, events.size()); 705 return CountMatches(events, query, 0u, events.size());
702 } 706 }
703 707
704 } // namespace trace_analyzer 708 } // namespace trace_analyzer
705 709
706 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ 710 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_
OLDNEW
« no previous file with comments | « base/test/thread_test_helper.h ('k') | base/test/trace_event_analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698