| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 double double_num = 0.0; | 87 double double_num = 0.0; |
| 88 if (it.value().GetAsString(&str)) | 88 if (it.value().GetAsString(&str)) |
| 89 arg_strings[it.key()] = str; | 89 arg_strings[it.key()] = str; |
| 90 else if (it.value().GetAsInteger(&int_num)) | 90 else if (it.value().GetAsInteger(&int_num)) |
| 91 arg_numbers[it.key()] = static_cast<double>(int_num); | 91 arg_numbers[it.key()] = static_cast<double>(int_num); |
| 92 else if (it.value().GetAsBoolean(&boolean)) | 92 else if (it.value().GetAsBoolean(&boolean)) |
| 93 arg_numbers[it.key()] = static_cast<double>(boolean ? 1 : 0); | 93 arg_numbers[it.key()] = static_cast<double>(boolean ? 1 : 0); |
| 94 else if (it.value().GetAsDouble(&double_num)) | 94 else if (it.value().GetAsDouble(&double_num)) |
| 95 arg_numbers[it.key()] = double_num; | 95 arg_numbers[it.key()] = double_num; |
| 96 else { | 96 else { |
| 97 LOG(ERROR) << "Value type of argument is not supported: " << | 97 LOG(WARNING) << "Value type of argument is not supported: " << |
| 98 static_cast<int>(it.value().GetType()); | 98 static_cast<int>(it.value().GetType()); |
| 99 return false; // Invalid trace event JSON format. | 99 continue; // Skip non-supported arguments. |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 double TraceEvent::GetAbsTimeToOtherEvent() const { | 106 double TraceEvent::GetAbsTimeToOtherEvent() const { |
| 107 return fabs(other_event->timestamp - timestamp); | 107 return fabs(other_event->timestamp - timestamp); |
| 108 } | 108 } |
| 109 | 109 |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 end_position = (end_position < events.size()) ? end_position : events.size(); | 954 end_position = (end_position < events.size()) ? end_position : events.size(); |
| 955 size_t count = 0u; | 955 size_t count = 0u; |
| 956 for (size_t i = begin_position; i < end_position; ++i) { | 956 for (size_t i = begin_position; i < end_position; ++i) { |
| 957 if (query.Evaluate(*events.at(i))) | 957 if (query.Evaluate(*events.at(i))) |
| 958 ++count; | 958 ++count; |
| 959 } | 959 } |
| 960 return count; | 960 return count; |
| 961 } | 961 } |
| 962 | 962 |
| 963 } // namespace trace_analyzer | 963 } // namespace trace_analyzer |
| OLD | NEW |