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

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: update histograms.xml to be a bit clearer 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 797393003558096ec18e1e5dbc864c64dfc0c425..653d09c4caee83e947d5a18733f283eaf1f428ce 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -32,6 +32,7 @@
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourceLoader.h"
#include "core/inspector/InstanceCounters.h"
+#include "platform/Histogram.h"
#include "platform/Logging.h"
#include "platform/SharedBuffer.h"
#include "platform/TraceEvent.h"
@@ -302,6 +303,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)
@@ -684,6 +686,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);
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698