| Index: base/test/launcher/test_launcher.cc
|
| diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
|
| index cfd08fbc49ca6d89c121076eddc3c5d60b125550..c23dc8cb542a3bc4762eea7479d9ce38be3a7ae8 100644
|
| --- a/base/test/launcher/test_launcher.cc
|
| +++ b/base/test/launcher/test_launcher.cc
|
| @@ -31,6 +31,7 @@
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/test/gtest_util.h"
|
| +#include "base/test/launcher/test_launcher_tracer.h"
|
| #include "base/test/launcher/test_results_tracker.h"
|
| #include "base/test/sequenced_worker_pool_owner.h"
|
| #include "base/test/test_switches.h"
|
| @@ -90,6 +91,9 @@ LazyInstance<std::map<ProcessHandle, CommandLine> > g_live_processes
|
| = LAZY_INSTANCE_INITIALIZER;
|
| LazyInstance<Lock> g_live_processes_lock = LAZY_INSTANCE_INITIALIZER;
|
|
|
| +// Performance trace generator.
|
| +LazyInstance<TestLauncherTracer> g_tracer = LAZY_INSTANCE_INITIALIZER;
|
| +
|
| #if defined(OS_POSIX)
|
| // Self-pipe that makes it possible to do complex shutdown handling
|
| // outside of the signal handler.
|
| @@ -253,6 +257,8 @@ int LaunchChildTestProcessWithOptions(
|
| TimeDelta timeout,
|
| const TestLauncher::GTestProcessLaunchedCallback& launched_callback,
|
| bool* was_timeout) {
|
| + TimeTicks start_time(TimeTicks::Now());
|
| +
|
| #if defined(OS_POSIX)
|
| // Make sure an option we rely on is present - see LaunchChildGTestProcess.
|
| DCHECK(options.new_process_group);
|
| @@ -344,6 +350,9 @@ int LaunchChildTestProcessWithOptions(
|
| g_live_processes.Get().erase(process.Handle());
|
| }
|
|
|
| + g_tracer.Get().RecordProcessExecution(start_time,
|
| + TimeTicks::Now() - start_time);
|
| +
|
| return exit_code;
|
| }
|
|
|
| @@ -1034,6 +1043,13 @@ void TestLauncher::MaybeSaveSummaryAsJSON() {
|
| LOG(ERROR) << "Failed to save test launcher output summary.";
|
| }
|
| }
|
| + if (command_line->HasSwitch(switches::kTestLauncherTrace)) {
|
| + FilePath trace_path(
|
| + command_line->GetSwitchValuePath(switches::kTestLauncherTrace));
|
| + if (!g_tracer.Get().Dump(trace_path)) {
|
| + LOG(ERROR) << "Failed to save test launcher trace.";
|
| + }
|
| + }
|
| }
|
|
|
| void TestLauncher::OnLaunchTestProcessFinished(
|
|
|