Chromium Code Reviews| 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..74ddebb349a5fd97cc253fca333f612bf772a311 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( |
|
Primiano Tucci (use gerrit)
2016/07/01 11:34:29
If this is really what you need it's ok. But if yo
Paweł Hajdan Jr.
2016/07/01 12:47:32
Yeah, it's OK for now. I can take another look if
|
| + 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."; |
|
Primiano Tucci (use gerrit)
2016/07/01 11:34:30
maybe move this error logging to the Dump method a
Paweł Hajdan Jr.
2016/07/01 12:47:32
This is consistent with above code. I think as an
|
| + } |
| + } |
| } |
| void TestLauncher::OnLaunchTestProcessFinished( |