summaryrefslogtreecommitdiff
path: root/runtime/runtime_test.cc
diff options
context:
space:
mode:
author Stefano Cianciulli <scianciulli@google.com> 2024-08-21 14:17:59 +0000
committer Jiakai Zhang <jiakaiz@google.com> 2024-08-28 15:16:28 +0000
commitddbcd4956b29c28b37b04952788dfa5cf9e5a81e (patch)
tree8db1204b0ae59b2456c501fe1251d3d3f4dbc684 /runtime/runtime_test.cc
parentc005493d5638a26ed1dcf4dfb70527906be748e8 (diff)
Initialize metrics only for Zygote process or when forced via CLI arg
Bug: 357802879 Test: - 1. art/tools/buildbot-build.sh --target 2. art/tools/buildbot-sync.sh 3. art/tools/run-gtests.sh -j4 4. art/test/testrunner/testrunner.py --target --64 Change-Id: I49843f10e22ae69490950e806bdec5408a893ac9
Diffstat (limited to 'runtime/runtime_test.cc')
-rw-r--r--runtime/runtime_test.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc
index cd0c862d82..1faecf36a8 100644
--- a/runtime/runtime_test.cc
+++ b/runtime/runtime_test.cc
@@ -109,4 +109,32 @@ TEST_F(RuntimeTest, ElfAlignmentMismatch) {
EXPECT_EQ(kElfSegmentAlignment, elf_file->GetElfSegmentAlignmentFromFile());
}
+class RuntimeInitMetricsDefaultTest : public CommonRuntimeTest {};
+
+TEST_F(RuntimeInitMetricsDefaultTest, MetricsAreNotInitialized) {
+ ASSERT_FALSE(runtime_->AreMetricsInitialized());
+}
+
+class RuntimeInitMetricsZygoteTest : public CommonRuntimeTest {
+ void SetUpRuntimeOptions(RuntimeOptions* options) override {
+ CommonRuntimeTest::SetUpRuntimeOptions(options);
+ options->emplace_back(std::make_pair("-Xzygote", nullptr));
+ }
+};
+
+TEST_F(RuntimeInitMetricsZygoteTest, MetricsAreInitialized) {
+ ASSERT_TRUE(runtime_->AreMetricsInitialized());
+}
+
+class RuntimeInitMetricsForceEnableTest : public CommonRuntimeTest {
+ void SetUpRuntimeOptions(RuntimeOptions* options) override {
+ CommonRuntimeTest::SetUpRuntimeOptions(options);
+ options->emplace_back(std::make_pair("-Xmetrics-force-enable:true", nullptr));
+ }
+};
+
+TEST_F(RuntimeInitMetricsForceEnableTest, MetricsAreInitialized) {
+ ASSERT_TRUE(runtime_->AreMetricsInitialized());
+}
+
} // namespace art