Remove Trace.Pause/Resume.
Resume was never wired up anywhere, and the zygote-tracing functionality is untested.
Test: build
Change-Id: I5ae0a8132ebffcbdcfde77caee5bcab415d6f063
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index b7ac1e8..9ce4749 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -240,11 +240,6 @@
runtime->PreZygoteFork();
- if (Trace::GetMethodTracingMode() != TracingMode::kTracingInactive) {
- // Tracing active, pause it.
- Trace::Pause();
- }
-
// Grab thread before fork potentially makes Thread::pthread_key_self_ unusable.
return reinterpret_cast<jlong>(ThreadForEnv(env));
}
diff --git a/runtime/trace.cc b/runtime/trace.cc
index f6c36cf..ce955d8 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -517,106 +517,6 @@
}
}
-void Trace::Pause() {
- bool stop_alloc_counting = false;
- Runtime* runtime = Runtime::Current();
- Trace* the_trace = nullptr;
-
- Thread* const self = Thread::Current();
- pthread_t sampling_pthread = 0U;
- {
- MutexLock mu(self, *Locks::trace_lock_);
- if (the_trace_ == nullptr) {
- LOG(ERROR) << "Trace pause requested, but no trace currently running";
- return;
- } else {
- the_trace = the_trace_;
- sampling_pthread = sampling_pthread_;
- }
- }
-
- if (sampling_pthread != 0U) {
- {
- MutexLock mu(self, *Locks::trace_lock_);
- the_trace_ = nullptr;
- }
- CHECK_PTHREAD_CALL(pthread_join, (sampling_pthread, nullptr), "sampling thread shutdown");
- sampling_pthread_ = 0U;
- {
- MutexLock mu(self, *Locks::trace_lock_);
- the_trace_ = the_trace;
- }
- }
-
- if (the_trace != nullptr) {
- gc::ScopedGCCriticalSection gcs(self,
- gc::kGcCauseInstrumentation,
- gc::kCollectorTypeInstrumentation);
- ScopedSuspendAll ssa(__FUNCTION__);
- stop_alloc_counting = (the_trace->flags_ & Trace::kTraceCountAllocs) != 0;
-
- if (the_trace->trace_mode_ == TraceMode::kSampling) {
- MutexLock mu(self, *Locks::thread_list_lock_);
- runtime->GetThreadList()->ForEach(ClearThreadStackTraceAndClockBase, nullptr);
- } else {
- runtime->GetInstrumentation()->DisableMethodTracing(kTracerInstrumentationKey);
- runtime->GetInstrumentation()->RemoveListener(
- the_trace,
- instrumentation::Instrumentation::kMethodEntered |
- instrumentation::Instrumentation::kMethodExited |
- instrumentation::Instrumentation::kMethodUnwind);
- }
- }
-
- if (stop_alloc_counting) {
- // Can be racy since SetStatsEnabled is not guarded by any locks.
- Runtime::Current()->SetStatsEnabled(false);
- }
-}
-
-void Trace::Resume() {
- Thread* self = Thread::Current();
- Trace* the_trace;
- {
- MutexLock mu(self, *Locks::trace_lock_);
- if (the_trace_ == nullptr) {
- LOG(ERROR) << "No trace to resume (or sampling mode), ignoring this request";
- return;
- }
- the_trace = the_trace_;
- }
-
- Runtime* runtime = Runtime::Current();
-
- // Enable count of allocs if specified in the flags.
- bool enable_stats = (the_trace->flags_ & kTraceCountAllocs) != 0;
-
- {
- gc::ScopedGCCriticalSection gcs(self,
- gc::kGcCauseInstrumentation,
- gc::kCollectorTypeInstrumentation);
- ScopedSuspendAll ssa(__FUNCTION__);
-
- // Reenable.
- if (the_trace->trace_mode_ == TraceMode::kSampling) {
- CHECK_PTHREAD_CALL(pthread_create, (&sampling_pthread_, nullptr, &RunSamplingThread,
- reinterpret_cast<void*>(the_trace->interval_us_)), "Sampling profiler thread");
- } else {
- runtime->GetInstrumentation()->AddListener(the_trace,
- instrumentation::Instrumentation::kMethodEntered |
- instrumentation::Instrumentation::kMethodExited |
- instrumentation::Instrumentation::kMethodUnwind);
- // TODO: In full-PIC mode, we don't need to fully deopt.
- runtime->GetInstrumentation()->EnableMethodTracing(kTracerInstrumentationKey);
- }
- }
-
- // Can't call this when holding the mutator lock.
- if (enable_stats) {
- runtime->SetStatsEnabled(true);
- }
-}
-
TracingMode Trace::GetMethodTracingMode() {
MutexLock mu(Thread::Current(), *Locks::trace_lock_);
if (the_trace_ == nullptr) {
diff --git a/runtime/trace.h b/runtime/trace.h
index 1089962..582f756 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -156,9 +156,6 @@
REQUIRES(!Locks::mutator_lock_, !Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_,
!Locks::trace_lock_);
- static void Pause() REQUIRES(!Locks::trace_lock_, !Locks::thread_list_lock_);
- static void Resume() REQUIRES(!Locks::trace_lock_);
-
// Stop tracing. This will finish the trace and write it to file/send it via DDMS.
static void Stop()
REQUIRES(!Locks::mutator_lock_, !Locks::thread_list_lock_, !Locks::trace_lock_);