| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Intel Inc. All rights reserved. | 2 * Copyright (C) 2012 Intel Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void UserTiming::mark(const String& markName, ExceptionState& exceptionState) | 102 void UserTiming::mark(const String& markName, ExceptionState& exceptionState) |
| 103 { | 103 { |
| 104 if (restrictedKeyMap().contains(markName)) { | 104 if (restrictedKeyMap().contains(markName)) { |
| 105 exceptionState.throwDOMException(SyntaxError, "'" + markName + "' is par
t of the PerformanceTiming interface, and cannot be used as a mark name."); | 105 exceptionState.throwDOMException(SyntaxError, "'" + markName + "' is par
t of the PerformanceTiming interface, and cannot be used as a mark name."); |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 | 108 |
| 109 TRACE_EVENT_COPY_MARK("blink.user_timing", markName.utf8().data()); | 109 TRACE_EVENT_COPY_MARK("blink.user_timing", markName.utf8().data()); |
| 110 double startTime = m_performance->now(); | 110 double startTime = m_performance->now(); |
| 111 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi
me)); | 111 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi
me)); |
| 112 blink::Platform::current()->histogramCustomCounts("PLT.UserTiming_Mark", sta
tic_cast<int>(startTime), 0, 600000, 100); | 112 Platform::current()->histogramCustomCounts("PLT.UserTiming_Mark", static_cas
t<int>(startTime), 0, 600000, 100); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void UserTiming::clearMarks(const String& markName) | 115 void UserTiming::clearMarks(const String& markName) |
| 116 { | 116 { |
| 117 clearPeformanceEntries(m_marksMap, markName); | 117 clearPeformanceEntries(m_marksMap, markName); |
| 118 } | 118 } |
| 119 | 119 |
| 120 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionSt
ate& exceptionState) | 120 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionSt
ate& exceptionState) |
| 121 { | 121 { |
| 122 if (m_marksMap.contains(markName)) | 122 if (m_marksMap.contains(markName)) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // navigation, whereas trace events accept double seconds based off of | 160 // navigation, whereas trace events accept double seconds based off of |
| 161 // CurrentTime::monotonicallyIncreasingTime(). | 161 // CurrentTime::monotonicallyIncreasingTime(). |
| 162 double startTimeMonotonic = m_performance->timing()->integerMillisecondsToMo
notonicTime(startTime + m_performance->timing()->navigationStart()); | 162 double startTimeMonotonic = m_performance->timing()->integerMillisecondsToMo
notonicTime(startTime + m_performance->timing()->navigationStart()); |
| 163 double endTimeMonotonic = m_performance->timing()->integerMillisecondsToMono
tonicTime(endTime + m_performance->timing()->navigationStart()); | 163 double endTimeMonotonic = m_performance->timing()->integerMillisecondsToMono
tonicTime(endTime + m_performance->timing()->navigationStart()); |
| 164 | 164 |
| 165 TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0("blink.user_timing", m
easureName.utf8().data(), WTF::StringHash::hash(measureName), startTimeMonotonic
); | 165 TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0("blink.user_timing", m
easureName.utf8().data(), WTF::StringHash::hash(measureName), startTimeMonotonic
); |
| 166 TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0("blink.user_timing", mea
sureName.utf8().data(), WTF::StringHash::hash(measureName), endTimeMonotonic); | 166 TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0("blink.user_timing", mea
sureName.utf8().data(), WTF::StringHash::hash(measureName), endTimeMonotonic); |
| 167 | 167 |
| 168 insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName
, startTime, endTime)); | 168 insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName
, startTime, endTime)); |
| 169 if (endTime >= startTime) | 169 if (endTime >= startTime) |
| 170 blink::Platform::current()->histogramCustomCounts("PLT.UserTiming_Measur
eDuration", static_cast<int>(endTime - startTime), 0, 600000, 100); | 170 Platform::current()->histogramCustomCounts("PLT.UserTiming_MeasureDurati
on", static_cast<int>(endTime - startTime), 0, 600000, 100); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void UserTiming::clearMeasures(const String& measureName) | 173 void UserTiming::clearMeasures(const String& measureName) |
| 174 { | 174 { |
| 175 clearPeformanceEntries(m_measuresMap, measureName); | 175 clearPeformanceEntries(m_measuresMap, measureName); |
| 176 } | 176 } |
| 177 | 177 |
| 178 static PerformanceEntryVector convertToEntrySequence(const PerformanceEntryMap&
performanceEntryMap) | 178 static PerformanceEntryVector convertToEntrySequence(const PerformanceEntryMap&
performanceEntryMap) |
| 179 { | 179 { |
| 180 PerformanceEntryVector entries; | 180 PerformanceEntryVector entries; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 DEFINE_TRACE(UserTiming) | 219 DEFINE_TRACE(UserTiming) |
| 220 { | 220 { |
| 221 visitor->trace(m_performance); | 221 visitor->trace(m_performance); |
| 222 visitor->trace(m_marksMap); | 222 visitor->trace(m_marksMap); |
| 223 visitor->trace(m_measuresMap); | 223 visitor->trace(m_measuresMap); |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace blink | 226 } // namespace blink |
| OLD | NEW |