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 #include "base/test/trace_event_analyzer.h" | 5 #include "base/test/trace_event_analyzer.h" |
6 | 6 |
| 7 #include <math.h> |
| 8 |
7 #include <algorithm> | 9 #include <algorithm> |
8 #include <math.h> | |
9 #include <set> | 10 #include <set> |
10 | 11 |
11 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/strings/pattern.h" | 14 #include "base/strings/pattern.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 | 16 |
16 namespace trace_analyzer { | 17 namespace trace_analyzer { |
17 | 18 |
18 // TraceEvent | 19 // TraceEvent |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 213 } |
213 | 214 |
214 Query Query::String(const std::string& str) { | 215 Query Query::String(const std::string& str) { |
215 return Query(str); | 216 return Query(str); |
216 } | 217 } |
217 | 218 |
218 Query Query::Double(double num) { | 219 Query Query::Double(double num) { |
219 return Query(num); | 220 return Query(num); |
220 } | 221 } |
221 | 222 |
222 Query Query::Int(int32 num) { | 223 Query Query::Int(int32_t num) { |
223 return Query(static_cast<double>(num)); | 224 return Query(static_cast<double>(num)); |
224 } | 225 } |
225 | 226 |
226 Query Query::Uint(uint32 num) { | 227 Query Query::Uint(uint32_t num) { |
227 return Query(static_cast<double>(num)); | 228 return Query(static_cast<double>(num)); |
228 } | 229 } |
229 | 230 |
230 Query Query::Bool(bool boolean) { | 231 Query Query::Bool(bool boolean) { |
231 return Query(boolean ? 1.0 : 0.0); | 232 return Query(boolean ? 1.0 : 0.0); |
232 } | 233 } |
233 | 234 |
234 Query Query::Phase(char phase) { | 235 Query Query::Phase(char phase) { |
235 return Query(static_cast<double>(phase)); | 236 return Query(static_cast<double>(phase)); |
236 } | 237 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 case OP_SUB: | 374 case OP_SUB: |
374 *num = lhs - rhs; | 375 *num = lhs - rhs; |
375 return true; | 376 return true; |
376 case OP_MUL: | 377 case OP_MUL: |
377 *num = lhs * rhs; | 378 *num = lhs * rhs; |
378 return true; | 379 return true; |
379 case OP_DIV: | 380 case OP_DIV: |
380 *num = lhs / rhs; | 381 *num = lhs / rhs; |
381 return true; | 382 return true; |
382 case OP_MOD: | 383 case OP_MOD: |
383 *num = static_cast<double>(static_cast<int64>(lhs) % | 384 *num = static_cast<double>(static_cast<int64_t>(lhs) % |
384 static_cast<int64>(rhs)); | 385 static_cast<int64_t>(rhs)); |
385 return true; | 386 return true; |
386 case OP_NEGATE: | 387 case OP_NEGATE: |
387 *num = -lhs; | 388 *num = -lhs; |
388 return true; | 389 return true; |
389 default: | 390 default: |
390 NOTREACHED(); | 391 NOTREACHED(); |
391 return false; | 392 return false; |
392 } | 393 } |
393 } | 394 } |
394 | 395 |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 end_position = (end_position < events.size()) ? end_position : events.size(); | 960 end_position = (end_position < events.size()) ? end_position : events.size(); |
960 size_t count = 0u; | 961 size_t count = 0u; |
961 for (size_t i = begin_position; i < end_position; ++i) { | 962 for (size_t i = begin_position; i < end_position; ++i) { |
962 if (query.Evaluate(*events.at(i))) | 963 if (query.Evaluate(*events.at(i))) |
963 ++count; | 964 ++count; |
964 } | 965 } |
965 return count; | 966 return count; |
966 } | 967 } |
967 | 968 |
968 } // namespace trace_analyzer | 969 } // namespace trace_analyzer |
OLD | NEW |