diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 17:24:36 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 17:24:36 +0000 |
commit | cc2c343ff3ef0e546c6a4788c182d29b4f8341eb (patch) | |
tree | c9d90b7ae6569cb549f7f91f7cee7636435ff5eb /chrome/renderer/user_script_slave.cc | |
parent | 7b032aa6098222270f9f78ede822e1256e672a08 (diff) | |
download | chromium_src-cc2c343ff3ef0e546c6a4788c182d29b4f8341eb.zip chromium_src-cc2c343ff3ef0e546c6a4788c182d29b4f8341eb.tar.gz chromium_src-cc2c343ff3ef0e546c6a4788c182d29b4f8341eb.tar.bz2 |
add some histograms to extensions
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/372005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/user_script_slave.cc')
-rw-r--r-- | chrome/renderer/user_script_slave.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc index 473cda8..9fff626 100644 --- a/chrome/renderer/user_script_slave.cc +++ b/chrome/renderer/user_script_slave.cc @@ -140,9 +140,11 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, if (location == UserScript::DOCUMENT_START) { num_css += script->css_scripts().size(); for (size_t j = 0; j < script->css_scripts().size(); ++j) { + PerfTimer insert_timer; UserScript::File& file = script->css_scripts()[j]; frame->insertStyleText( WebString::fromUTF8(file.GetContent().as_string()), WebString()); + UMA_HISTOGRAM_TIMES("Extensions.InjectCssTime", insert_timer.Elapsed()); } } if (script->run_location() == location) { @@ -179,9 +181,11 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, isolated_world_id = GetIsolatedWorldId(script->extension_id()); } + PerfTimer exec_timer; frame->executeScriptInIsolatedWorld( isolated_world_id, &sources.front(), sources.size(), EXTENSION_GROUP_CONTENT_SCRIPTS); + UMA_HISTOGRAM_TIMES("Extensions.InjectScriptTime", exec_timer.Elapsed()); } } @@ -189,10 +193,18 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, if (location == UserScript::DOCUMENT_START) { UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_CssCount", num_css); UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_ScriptCount", num_scripts); - UMA_HISTOGRAM_TIMES("Extensions.InjectStart_Time", timer.Elapsed()); - } else { + if (num_css || num_scripts) + UMA_HISTOGRAM_TIMES("Extensions.InjectStart_Time", timer.Elapsed()); + } else if (location == UserScript::DOCUMENT_END) { UMA_HISTOGRAM_COUNTS_100("Extensions.InjectEnd_ScriptCount", num_scripts); - UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); + if (num_scripts) + UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); + } else if (location == UserScript::DOCUMENT_IDLE) { + UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); + if (num_scripts) + UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); + } else { + NOTREACHED(); } LOG(INFO) << "Injected " << num_scripts << " scripts and " << num_css << |