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

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

Issue 7982007: add "did it run on GPU" check to frame_rate_tests.cc using AutomationProxy tracing feature (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added templated TraceEvent::GetArgAsIntType Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // Returns absolute duration in microseconds between this event and other 125 // Returns absolute duration in microseconds between this event and other
126 // event. Returns false if has_other_event() is false. 126 // event. Returns false if has_other_event() is false.
127 bool GetAbsTimeToOtherEvent(double* duration) const; 127 bool GetAbsTimeToOtherEvent(double* duration) const;
128 128
129 // Return the argument value if it exists and it is a string. 129 // Return the argument value if it exists and it is a string.
130 bool GetArgAsString(const std::string& name, std::string* arg) const; 130 bool GetArgAsString(const std::string& name, std::string* arg) const;
131 // Return the argument value if it exists and it is a number. 131 // Return the argument value if it exists and it is a number.
132 bool GetArgAsNumber(const std::string& name, double* arg) const; 132 bool GetArgAsNumber(const std::string& name, double* arg) const;
133 133
134 // If you need an argument as a certain integer type, you can use this method
135 // to get it and cast it to your type.
nduca 2011/11/01 19:17:49 Copy the way base-value works? GetArgAsBool/etc. T
jbates 2011/11/03 00:51:07 Done. Actually since queries already verify the ex
136 // For example:
137 // MyEnum my_enum;
138 // bool found = event.GetArgAsIntType("the_enum", &my_enum);
139 template<class INTEGER_TYPE>
140 bool GetArgAsIntType(const std::string& name, INTEGER_TYPE* arg) const {
141 double arg_double;
142 if (GetArgAsNumber(name, &arg_double)) {
143 // Certain compilers don't allow casting directly from double to enums.
144 int64 arg_int = static_cast<int64>(arg_double);
145 *arg = static_cast<INTEGER_TYPE>(arg_int);
146 return true;
147 }
148 return false;
149 }
150
134 // Process ID and Thread ID. 151 // Process ID and Thread ID.
135 ProcessThreadID thread; 152 ProcessThreadID thread;
136 153
137 // Time since epoch in microseconds. 154 // Time since epoch in microseconds.
138 // Stored as double to match its JSON representation. 155 // Stored as double to match its JSON representation.
139 double timestamp; 156 double timestamp;
140 157
141 base::debug::TraceEventPhase phase; 158 base::debug::TraceEventPhase phase;
142 159
143 std::string category; 160 std::string category;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 std::map<TraceEvent::ProcessThreadID, std::string> thread_names_; 456 std::map<TraceEvent::ProcessThreadID, std::string> thread_names_;
440 std::vector<TraceEvent> raw_events_; 457 std::vector<TraceEvent> raw_events_;
441 bool allow_assocation_changes_; 458 bool allow_assocation_changes_;
442 459
443 DISALLOW_COPY_AND_ASSIGN(TraceAnalyzer); 460 DISALLOW_COPY_AND_ASSIGN(TraceAnalyzer);
444 }; 461 };
445 462
446 } // namespace trace_analyzer 463 } // namespace trace_analyzer
447 464
448 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ 465 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/test/perf/frame_rate/frame_rate_tests.cc » ('j') | chrome/test/perf/frame_rate/frame_rate_tests.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698