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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp

Issue 2341333003: Use chromium trace_event implementation in blink (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (exceptionState.hadException()) 163 if (exceptionState.hadException())
164 return nullptr; 164 return nullptr;
165 } 165 }
166 166
167 // User timing events are stored as integer milliseconds from the start of 167 // User timing events are stored as integer milliseconds from the start of
168 // navigation, whereas trace events accept double seconds based off of 168 // navigation, whereas trace events accept double seconds based off of
169 // CurrentTime::monotonicallyIncreasingTime(). 169 // CurrentTime::monotonicallyIncreasingTime().
170 double startTimeMonotonic = m_performance->timeOrigin() + startTime / 1000.0 ; 170 double startTimeMonotonic = m_performance->timeOrigin() + startTime / 1000.0 ;
171 double endTimeMonotonic = m_performance->timeOrigin() + endTime / 1000.0; 171 double endTimeMonotonic = m_performance->timeOrigin() + endTime / 1000.0;
172 172
173 TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0("blink.user_timing", m easureName.utf8().data(), WTF::StringHash::hash(measureName), startTimeMonotonic ); 173 TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0("blink.user_timing", m easureName.utf8().data(), WTF::StringHash::hash(measureName), TraceEvent::toTrac eTimestamp(startTimeMonotonic));
174 TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0("blink.user_timing", mea sureName.utf8().data(), WTF::StringHash::hash(measureName), endTimeMonotonic); 174 TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0("blink.user_timing", mea sureName.utf8().data(), WTF::StringHash::hash(measureName), TraceEvent::toTraceT imestamp(endTimeMonotonic));
175 175
176 PerformanceEntry* entry = PerformanceMeasure::create(measureName, startTime, endTime); 176 PerformanceEntry* entry = PerformanceMeasure::create(measureName, startTime, endTime);
177 insertPerformanceEntry(m_measuresMap, *entry); 177 insertPerformanceEntry(m_measuresMap, *entry);
178 if (endTime >= startTime) { 178 if (endTime >= startTime) {
179 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, measureDurationHis togram, new CustomCountHistogram("PLT.UserTiming_MeasureDuration", 0, 600000, 10 0)); 179 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, measureDurationHis togram, new CustomCountHistogram("PLT.UserTiming_MeasureDuration", 0, 600000, 10 0));
180 measureDurationHistogram.count(static_cast<int>(endTime - startTime)); 180 measureDurationHistogram.count(static_cast<int>(endTime - startTime));
181 } 181 }
182 return entry; 182 return entry;
183 } 183 }
184 184
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 DEFINE_TRACE(UserTiming) 231 DEFINE_TRACE(UserTiming)
232 { 232 {
233 visitor->trace(m_performance); 233 visitor->trace(m_performance);
234 visitor->trace(m_marksMap); 234 visitor->trace(m_marksMap);
235 visitor->trace(m_measuresMap); 235 visitor->trace(m_measuresMap);
236 } 236 }
237 237
238 } // namespace blink 238 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintTiming.cpp ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698