diff options
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index ac3c39219e..568d500563 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -223,13 +223,6 @@ void CheckConstants() { CHECK_EQ(mirror::Array::kFirstElementOffset, mirror::Array::FirstElementOffset()); } -metrics::ReportingConfig ParseMetricsReportingConfig(const RuntimeArgumentMap& args) { - using M = RuntimeArgumentMap; - return { - .dump_to_logcat = args.Exists(M::WriteMetricsToLog), - }; -} - } // namespace Runtime::Runtime() @@ -1716,8 +1709,7 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { // Class-roots are setup, we can now finish initializing the JniIdManager. GetJniIdManager()->Init(self); - metrics_reporter_ = - metrics::MetricsReporter::Create(ParseMetricsReportingConfig(runtime_options), &metrics_); + InitMetrics(runtime_options); // Runtime initialization is largely done now. // We load plugins first since that can modify the runtime state slightly. @@ -1817,6 +1809,13 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { return true; } +void Runtime::InitMetrics(const RuntimeArgumentMap& runtime_options) { + auto metrics_config = metrics::ReportingConfig::FromRuntimeArguments(runtime_options); + if (metrics_config.ReportingEnabled()) { + metrics_reporter_ = metrics::MetricsReporter::Create(metrics_config, GetMetrics()); + } +} + bool Runtime::EnsurePluginLoaded(const char* plugin_name, std::string* error_msg) { // Is the plugin already loaded? for (const Plugin& p : plugins_) { |