diff options
| -rw-r--r-- | runtime/native/dalvik_system_ZygoteHooks.cc | 5 | ||||
| -rw-r--r-- | runtime/trace.cc | 100 | ||||
| -rw-r--r-- | runtime/trace.h | 3 |
3 files changed, 0 insertions, 108 deletions
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc index b7ac1e8fe3..9ce47490e7 100644 --- a/runtime/native/dalvik_system_ZygoteHooks.cc +++ b/runtime/native/dalvik_system_ZygoteHooks.cc @@ -240,11 +240,6 @@ static jlong ZygoteHooks_nativePreFork(JNIEnv* env, jclass) { 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 f6c36cf989..ce955d8991 100644 --- a/runtime/trace.cc +++ b/runtime/trace.cc @@ -517,106 +517,6 @@ void Trace::Shutdown() { } } -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 108996231d..582f756ca9 100644 --- a/runtime/trace.h +++ b/runtime/trace.h @@ -156,9 +156,6 @@ class Trace final : public instrumentation::InstrumentationListener { 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_); |