Index: components/test/run_all_perftests.cc |
diff --git a/components/test/run_all_perftests.cc b/components/test/run_all_perftests.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7cafbbe7621762c23296144935989db9d5c937d1 |
--- /dev/null |
+++ b/components/test/run_all_perftests.cc |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <memory> |
+ |
+#include "base/memory/ptr_util.h" |
+#include "base/test/launcher/unit_test_launcher.h" |
+#include "base/test/perf_log.h" |
+#include "components/test/components_test_suit.h" |
+ |
+class ComponentsPerfTestSuite : public ComponentsTestSuite { |
+ public: |
+ ComponentsPerfTestSuite(int argc, char** argv) |
+ : ComponentsTestSuite(argc, argv) {} |
+ |
+ void Initialize() final { |
+ ComponentsTestSuite::Initialize(); |
+ CHECK(base::InitPerfLog()); |
+ } |
+ |
+ void Shutdown() final { |
+ base::FinalizePerfLog(); |
+ ComponentsTestSuite::Shutdown(); |
+ } |
+}; |
+ |
+int main(int argc, char** argv) { |
+ auto test_suite = base::MakeUnique<ComponentsPerfTestSuite>(argc, argv); |
+ // Raise to high priority to have more precise measurements. Since we don't |
+ // aim at 1% precision, it is not necessary to run at realtime level. |
+ if (!base::debug::BeingDebugged()) |
+ base::RaiseProcessToHighPriority(); |
+ return base::LaunchUnitTestsSerially( |
+ argc, argv, CreateCallbackForLaunch(std::move(test_suite))); |
+} |