summaryrefslogtreecommitdiffstats
path: root/content/browser/child_process_launcher.cc
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-25 18:44:26 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-25 18:44:26 +0000
commit323fdc31d35310454e244f56e4f091fe55785bf5 (patch)
tree59cb60d7887faf154a916103ab2571bba7f2fc23 /content/browser/child_process_launcher.cc
parent20f0285469577429063f8d1c2a2bab33e2dfd65a (diff)
downloadchromium_src-323fdc31d35310454e244f56e4f091fe55785bf5.zip
chromium_src-323fdc31d35310454e244f56e4f091fe55785bf5.tar.gz
chromium_src-323fdc31d35310454e244f56e4f091fe55785bf5.tar.bz2
Revert 184213
> Revert 183407 > > Child process launch - Record process creation times. > > > > Added MPArch.ChildProcessLaunchFirst and MPArch.ChildProcessLaunchSubsequent > > histograms to ltrack all child process creation times. > > > > This replaces MPArch.RendererLaunchFirst and MPArch.RendererLaunchSubsequent > > histograms that were there earlier. > > https://code.google.com/p/chrome-browser/source/browse/trunk/src/chrome/browser/renderer_host/browser_render_process_host.cc?spec=svn27589&r=27589 > > > > BUG=167326 > > R=sky@chromium.org > > > > Review URL: https://chromiumcodereview.appspot.com/12255086 > > TBR=rtenneti@chromium.org > Review URL: https://codereview.chromium.org/12328066 TBR=rtenneti@chromium.org Review URL: https://codereview.chromium.org/12328088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/child_process_launcher.cc')
-rw-r--r--content/browser/child_process_launcher.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 1630fdd..19be81a 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -11,6 +11,7 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/histogram.h"
#include "base/process_util.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread.h"
@@ -112,7 +113,9 @@ class ChildProcessLauncher::Context
// |this_object| is NOT thread safe. Only use it to post a task back.
scoped_refptr<Context> this_object,
BrowserThread::ID client_thread_id,
+ const base::TimeTicks begin_launch_time,
base::ProcessHandle handle) {
+ RecordHistograms(begin_launch_time);
if (BrowserThread::CurrentlyOn(client_thread_id)) {
// This is always invoked on the UI thread which is commonly the
// |client_thread_id| so we can shortcut one PostTask.
@@ -147,6 +150,30 @@ class ChildProcessLauncher::Context
Terminate();
}
+ static void RecordHistograms(const base::TimeTicks begin_launch_time) {
+ base::TimeDelta launch_time = base::TimeTicks::Now() - begin_launch_time;
+ if (BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)) {
+ RecordLaunchHistograms(launch_time);
+ } else {
+ BrowserThread::PostTask(
+ BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
+ base::Bind(&ChildProcessLauncher::Context::RecordLaunchHistograms,
+ launch_time));
+ }
+ }
+
+ static void RecordLaunchHistograms(const base::TimeDelta launch_time) {
+ // Log the launch time, separating out the first one (which will likely be
+ // slower due to the rest of the browser initializing at the same time).
+ static bool done_first_launch = false;
+ if (done_first_launch) {
+ UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchSubsequent", launch_time);
+ } else {
+ UMA_HISTOGRAM_TIMES("MPArch.ChildProcessLaunchFirst", launch_time);
+ done_first_launch = true;
+ }
+ }
+
static void LaunchInternal(
// |this_object| is NOT thread safe. Only use it to post a task back.
scoped_refptr<Context> this_object,
@@ -163,6 +190,7 @@ class ChildProcessLauncher::Context
#endif
CommandLine* cmd_line) {
scoped_ptr<CommandLine> cmd_line_deleter(cmd_line);
+ base::TimeTicks begin_launch_time = base::TimeTicks::Now();
#if defined(OS_WIN)
base::ProcessHandle handle = StartProcessWithAccess(cmd_line, exposed_dir);
@@ -184,7 +212,7 @@ class ChildProcessLauncher::Context
StartSandboxedProcess(cmd_line->argv(), files_to_register,
base::Bind(&ChildProcessLauncher::Context::OnSandboxedProcessStarted,
- this_object, client_thread_id));
+ this_object, client_thread_id, begin_launch_time));
#elif defined(OS_POSIX)
base::ProcessHandle handle = base::kNullProcessHandle;
@@ -267,6 +295,8 @@ class ChildProcessLauncher::Context
}
#endif // else defined(OS_POSIX)
#if !defined(OS_ANDROID)
+ if (handle)
+ RecordHistograms(begin_launch_time);
BrowserThread::PostTask(
client_thread_id, FROM_HERE,
base::Bind(