summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/parsed_options.cc3
-rw-r--r--runtime/runtime.cc5
-rw-r--r--runtime/runtime.h6
-rw-r--r--runtime/runtime_options.def1
-rw-r--r--runtime/verifier/method_verifier.cc2
5 files changed, 15 insertions, 2 deletions
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 7383d477bb..a44e5a4b54 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -333,6 +333,9 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize
.IntoKey(M::UseStderrLogger)
.Define("-Xonly-use-system-oat-files")
.IntoKey(M::OnlyUseSystemOatFiles)
+ .Define("-Xverifier-logging-threshold=_")
+ .WithType<unsigned int>()
+ .IntoKey(M::VerifierLoggingThreshold)
.Ignore({
"-ea", "-da", "-enableassertions", "-disableassertions", "--runtime-arg", "-esa",
"-dsa", "-enablesystemassertions", "-disablesystemassertions", "-Xrs", "-Xint:_",
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index a81c4d0518..facebda953 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -273,7 +273,8 @@ Runtime::Runtime()
pruned_dalvik_cache_(false),
// Initially assume we perceive jank in case the process state is never updated.
process_state_(kProcessStateJankPerceptible),
- zygote_no_threads_(false) {
+ zygote_no_threads_(false),
+ verifier_logging_threshold_ms_(100) {
static_assert(Runtime::kCalleeSaveSize ==
static_cast<uint32_t>(CalleeSaveType::kLastCalleeSaveType), "Unexpected size");
@@ -1438,6 +1439,8 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
}
}
+ verifier_logging_threshold_ms_ = runtime_options.GetOrDefault(Opt::VerifierLoggingThreshold);
+
std::string error_msg;
java_vm_ = JavaVMExt::Create(this, runtime_options, &error_msg);
if (java_vm_.get() == nullptr) {
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 5f8a4eaefb..a98e8a81ed 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -779,6 +779,10 @@ class Runtime {
static constexpr int32_t kUnsetSdkVersion = 0u;
+ uint32_t GetVerifierLoggingThresholdMs() const {
+ return verifier_logging_threshold_ms_;
+ }
+
private:
static void InitPlatformSignalHandlers();
@@ -1088,6 +1092,8 @@ class Runtime {
std::unique_ptr<MemMap> protected_fault_page_;
+ uint32_t verifier_logging_threshold_ms_;
+
DISALLOW_COPY_AND_ASSIGN(Runtime);
};
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index 3f9a3229ca..ef21f9f9e0 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -152,5 +152,6 @@ RUNTIME_OPTIONS_KEY (unsigned int, GlobalRefAllocStackTraceLimit, 0) //
RUNTIME_OPTIONS_KEY (Unit, UseStderrLogger)
RUNTIME_OPTIONS_KEY (Unit, OnlyUseSystemOatFiles)
+RUNTIME_OPTIONS_KEY (unsigned int, VerifierLoggingThreshold, 100)
#undef RUNTIME_OPTIONS_KEY
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 01b6bf8f15..a1b8938eaa 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -439,7 +439,7 @@ MethodVerifier::FailureData MethodVerifier::VerifyMethod(Thread* self,
}
if (kTimeVerifyMethod) {
uint64_t duration_ns = NanoTime() - start_ns;
- if (duration_ns > MsToNs(100)) {
+ if (duration_ns > MsToNs(Runtime::Current()->GetVerifierLoggingThresholdMs())) {
LOG(WARNING) << "Verification of " << dex_file->PrettyMethod(method_idx)
<< " took " << PrettyDuration(duration_ns)
<< (IsLargeMethod(verifier.CodeItem()) ? " (large method)" : "");