Get tracing parameters before aborting the ongoing trace
After forking, we abort any ongoing trace and start a new trace with a
new file so we can capture the child's trace as well. To start a new
trace we get the tracing parameters of the parent. We need to do this
before aborting the ongoing trace.
Bug: 259258187
Test: art/testrunner.py -t 689-zygote-jit-deopt
Change-Id: I230d063920ade605acaa37eaa6ab5964bc7b97ba
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index fb077e2..75506de 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -359,6 +359,8 @@
Trace::TraceOutputMode output_mode = Trace::GetOutputMode();
Trace::TraceMode trace_mode = Trace::GetMode();
size_t buffer_size = Trace::GetBufferSize();
+ int flags = Trace::GetFlags();
+ int interval = Trace::GetIntervalInMillis();
// Just drop it.
Trace::Abort();
@@ -386,10 +388,10 @@
std::string trace_file = StringPrintf("%s/%s.trace.bin", path, proc_name.c_str());
Trace::Start(trace_file.c_str(),
buffer_size,
- Trace::GetFlags(),
+ flags,
output_mode,
trace_mode,
- Trace::GetIntervalInMillis());
+ interval);
if (thread->IsExceptionPending()) {
ScopedObjectAccess soa(env);
thread->ClearException();
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 0de55fa..4e39eb3 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -1194,19 +1194,19 @@
int Trace::GetFlags() {
MutexLock mu(Thread::Current(), *Locks::trace_lock_);
- CHECK(the_trace_ != nullptr) << "Trace mode requested, but no trace currently running";
+ CHECK(the_trace_ != nullptr) << "Trace flags requested, but no trace currently running";
return the_trace_->flags_;
}
int Trace::GetIntervalInMillis() {
MutexLock mu(Thread::Current(), *Locks::trace_lock_);
- CHECK(the_trace_ != nullptr) << "Trace mode requested, but no trace currently running";
+ CHECK(the_trace_ != nullptr) << "Trace interval requested, but no trace currently running";
return the_trace_->interval_us_;
}
size_t Trace::GetBufferSize() {
MutexLock mu(Thread::Current(), *Locks::trace_lock_);
- CHECK(the_trace_ != nullptr) << "Trace mode requested, but no trace currently running";
+ CHECK(the_trace_ != nullptr) << "Trace buffer size requested, but no trace currently running";
return the_trace_->buffer_size_;
}