summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2016-02-17 12:48:29 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-17 20:49:31 +0000
commit731d1b482499dbea3752ae464f5cc612103c27b1 (patch)
tree77cb122076c014535f0a66461a8515ef8036afa3
parent9146a0bb0109a907c7d61ee3b19642c57bbcbf87 (diff)
downloadchromium_src-731d1b482499dbea3752ae464f5cc612103c27b1.zip
chromium_src-731d1b482499dbea3752ae464f5cc612103c27b1.tar.gz
chromium_src-731d1b482499dbea3752ae464f5cc612103c27b1.tar.bz2
[Extensions] Add UMA for whether the ExtensionApiFrameIdMap cache is hit
The ExtensionApiFrameIdMap is used to determine information about a frame on the IO thread, and can make a jump to the UI thread in cases when information is not cached. This jump can be expensive, and determining how often it happens can influence future decisions about whether to use it or not. Add UMA to get some knowledge. BUG=None Review URL: https://codereview.chromium.org/1697753002 Cr-Commit-Position: refs/heads/master@{#375975}
-rw-r--r--extensions/browser/extension_api_frame_id_map.cc9
-rw-r--r--tools/metrics/histograms/histograms.xml8
2 files changed, 15 insertions, 2 deletions
diff --git a/extensions/browser/extension_api_frame_id_map.cc b/extensions/browser/extension_api_frame_id_map.cc
index b7ae5ea..5ce80d2 100644
--- a/extensions/browser/extension_api_frame_id_map.cc
+++ b/extensions/browser/extension_api_frame_id_map.cc
@@ -6,6 +6,7 @@
#include <tuple>
+#include "base/metrics/histogram_macros.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
@@ -261,14 +262,18 @@ bool ExtensionApiFrameIdMap::GetCachedFrameDataOnIO(int render_process_id,
base::AutoLock lock(frame_data_map_lock_);
FrameDataMap::const_iterator frame_id_iter = frame_data_map_.find(
RenderFrameIdKey(render_process_id, frame_routing_id));
+ bool found = false;
if (frame_id_iter != frame_data_map_.end()) {
// This is very likely to happen because CacheFrameId() is called as soon
// as the frame is created.
*frame_data_out = frame_id_iter->second;
- return true;
+ found = true;
}
- return false;
+ // TODO(devlin): Depending on how the data looks, this may be removable after
+ // a few cycles. Check back in M52 to see if it's still needed.
+ UMA_HISTOGRAM_BOOLEAN("Extensions.ExtensionFrameMapCacheHit", found);
+ return found;
}
void ExtensionApiFrameIdMap::CacheFrameData(content::RenderFrameHost* rfh) {
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 4ff0012..ccf3c6c 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -12723,6 +12723,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
+<histogram name="Extensions.ExtensionFrameMapCacheHit" units="Boolean">
+ <owner>rdevlin.cronin@chromium.org</owner>
+ <summary>
+ True if the cache of the extension frame map was hit during access on the IO
+ thread.
+ </summary>
+</histogram>
+
<histogram name="Extensions.ExtensionHostMonitoring.MaxActiveLoading">
<owner>rdevlin.cronin@chromium.org</owner>
<summary>