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

Side by Side Diff: Source/core/page/PerformanceUserTiming.cpp

Issue 23245004: Added UMA instrumentation for site-instrumented user timing marks and measures (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplified significantly and removed use tracking and lastMark UMAs Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/page/PerformanceUserTiming.h" 27 #include "core/page/PerformanceUserTiming.h"
28 28
29 #include "bindings/v8/ExceptionState.h" 29 #include "bindings/v8/ExceptionState.h"
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/page/Performance.h" 31 #include "core/page/Performance.h"
32 #include "core/page/PerformanceMark.h" 32 #include "core/page/PerformanceMark.h"
33 #include "core/page/PerformanceMeasure.h" 33 #include "core/page/PerformanceMeasure.h"
34 #include "core/platform/HistogramSupport.h"
34 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 namespace { 39 namespace {
39 40
40 typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap; 41 typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap;
41 static RestrictedKeyMap restrictedKeyMap() 42 static RestrictedKeyMap restrictedKeyMap()
42 { 43 {
43 DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ()); 44 DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 void UserTiming::mark(const String& markName, ExceptionState& es) 102 void UserTiming::mark(const String& markName, ExceptionState& es)
102 { 103 {
103 if (restrictedKeyMap().contains(markName)) { 104 if (restrictedKeyMap().contains(markName)) {
104 es.throwDOMException(SyntaxError, "'" + markName + "' is part of the Per formanceTiming interface, and cannot be used as a mark name."); 105 es.throwDOMException(SyntaxError, "'" + markName + "' is part of the Per formanceTiming interface, and cannot be used as a mark name.");
105 return; 106 return;
106 } 107 }
107 108
108 double startTime = m_performance->now(); 109 double startTime = m_performance->now();
109 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi me)); 110 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi me));
111 HistogramSupport::histogramCustomCounts("PLT.UserTiming_Mark", static_cast<i nt>(startTime), 0, 600000, 100);
110 } 112 }
111 113
112 void UserTiming::clearMarks(const String& markName) 114 void UserTiming::clearMarks(const String& markName)
113 { 115 {
114 clearPeformanceEntries(m_marksMap, markName); 116 clearPeformanceEntries(m_marksMap, markName);
115 } 117 }
116 118
117 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionSt ate& es) 119 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionSt ate& es)
118 { 120 {
119 if (m_marksMap.contains(markName)) 121 if (m_marksMap.contains(markName))
(...skipping 27 matching lines...) Expand all
147 } else { 149 } else {
148 endTime = findExistingMarkStartTime(endMark, es); 150 endTime = findExistingMarkStartTime(endMark, es);
149 if (es.hadException()) 151 if (es.hadException())
150 return; 152 return;
151 startTime = findExistingMarkStartTime(startMark, es); 153 startTime = findExistingMarkStartTime(startMark, es);
152 if (es.hadException()) 154 if (es.hadException())
153 return; 155 return;
154 } 156 }
155 157
156 insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName , startTime, endTime)); 158 insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName , startTime, endTime));
159 if (endTime >= startTime)
160 HistogramSupport::histogramCustomCounts("PLT.UserTiming_MeasureDuration" , static_cast<int>(endTime - startTime), 0, 600000, 100);
157 } 161 }
158 162
159 void UserTiming::clearMeasures(const String& measureName) 163 void UserTiming::clearMeasures(const String& measureName)
160 { 164 {
161 clearPeformanceEntries(m_measuresMap, measureName); 165 clearPeformanceEntries(m_measuresMap, measureName);
162 } 166 }
163 167
164 static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const Performanc eEntryMap& performanceEntryMap) 168 static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const Performanc eEntryMap& performanceEntryMap)
165 { 169 {
166 Vector<RefPtr<PerformanceEntry> > entries; 170 Vector<RefPtr<PerformanceEntry> > entries;
(...skipping 29 matching lines...) Expand all
196 { 200 {
197 return convertToEntrySequence(m_measuresMap); 201 return convertToEntrySequence(m_measuresMap);
198 } 202 }
199 203
200 Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) co nst 204 Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) co nst
201 { 205 {
202 return getEntrySequenceByName(m_measuresMap, name); 206 return getEntrySequenceByName(m_measuresMap, name);
203 } 207 }
204 208
205 } // namespace WebCore 209 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698