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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 1987013002: Add UMA to track time between preload discovery and reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@preload_timing_uma
Patch Set: Include preloads generated by LinkLoader Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 91175f1b88a4f02ed950e3580d0a8d5bad26be3c..7720d8e06a55b4c37f3410c0e007ce8e8bf8e8a5 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -33,6 +33,7 @@
#include "core/fetch/ResourceLoader.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InstanceCounters.h"
+#include "platform/Histogram.h"
#include "platform/Logging.h"
#include "platform/SharedBuffer.h"
#include "platform/TraceEvent.h"
@@ -303,6 +304,7 @@ Resource::Resource(const ResourceRequest& request, Type type, const ResourceLoad
, m_decodedSize(0)
, m_overheadSize(calculateOverheadSize())
, m_preloadCount(0)
+ , m_preloadDiscoveryTime(0.0)
, m_cacheIdentifier(MemoryCache::defaultCacheIdentifier())
, m_preloadResult(PreloadNotReferenced)
, m_type(type)
@@ -693,6 +695,12 @@ void Resource::willAddClientOrObserver()
m_preloadResult = PreloadReferencedWhileLoading;
else
m_preloadResult = PreloadReferenced;
+
+ if (m_preloadDiscoveryTime) {
+ int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncreasingTime() - m_preloadDiscoveryTime));
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram, ("PreloadScanner.ReferenceTime", 0, 10000, 50));
+ preloadDiscoveryHistogram.count(timeSinceDiscovery);
+ }
}
if (!hasClientsOrObservers())
memoryCache()->makeLive(this);

Powered by Google App Engine
This is Rietveld 408576698