diff options
author | Sebastien Hertz <shertz@google.com> | 2015-04-01 16:34:17 +0200 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2015-05-07 18:03:58 +0200 |
commit | 0462c4c87c39db6cfcd338f323844738109ac3c9 (patch) | |
tree | 30776cd2fadab4100851640976c2b572d228d688 /runtime/trace.cc | |
parent | a6591ef95afa6bc9d89c0c6044635ec7a13d4c55 (diff) | |
download | art-0462c4c87c39db6cfcd338f323844738109ac3c9.tar.gz art-0462c4c87c39db6cfcd338f323844738109ac3c9.tar.bz2 art-0462c4c87c39db6cfcd338f323844738109ac3c9.zip |
Support multiple instrumentation clients
Changes Instrumentation::ConfigureStubs to support multiple clients
that need different levels of instrumenation. A client is identified
by a string key used to save the desired instrumentation level.
Also adds regression gtest instrumentation_test and some cleanup.
Bug: 19829329
Change-Id: I1fc24a86fcb7cb46d4be806895376c25cc0a0b3c
Diffstat (limited to 'runtime/trace.cc')
-rw-r--r-- | runtime/trace.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/trace.cc b/runtime/trace.cc index 9eca517dca..3b8feda2cd 100644 --- a/runtime/trace.cc +++ b/runtime/trace.cc @@ -126,6 +126,9 @@ Trace* volatile Trace::the_trace_ = nullptr; pthread_t Trace::sampling_pthread_ = 0U; std::unique_ptr<std::vector<mirror::ArtMethod*>> Trace::temp_stack_trace_; +// The key identifying the tracer to update instrumentation. +static constexpr const char* kTracerInstrumentationKey = "Tracer"; + static mirror::ArtMethod* DecodeTraceMethodId(uint32_t tmid) { return reinterpret_cast<mirror::ArtMethod*>(tmid & ~kTraceMethodActionMask); } @@ -393,7 +396,7 @@ void Trace::Start(const char* trace_filename, int trace_fd, size_t buffer_size, instrumentation::Instrumentation::kMethodExited | instrumentation::Instrumentation::kMethodUnwind); // TODO: In full-PIC mode, we don't need to fully deopt. - runtime->GetInstrumentation()->EnableMethodTracing(); + runtime->GetInstrumentation()->EnableMethodTracing(kTracerInstrumentationKey); } } } @@ -440,7 +443,7 @@ void Trace::StopTracing(bool finish_tracing, bool flush_file) { MutexLock mu(Thread::Current(), *Locks::thread_list_lock_); runtime->GetThreadList()->ForEach(ClearThreadStackTraceAndClockBase, nullptr); } else { - runtime->GetInstrumentation()->DisableMethodTracing(); + runtime->GetInstrumentation()->DisableMethodTracing(kTracerInstrumentationKey); runtime->GetInstrumentation()->RemoveListener( the_trace, instrumentation::Instrumentation::kMethodEntered | instrumentation::Instrumentation::kMethodExited | @@ -522,7 +525,7 @@ void Trace::Pause() { MutexLock mu(Thread::Current(), *Locks::thread_list_lock_); runtime->GetThreadList()->ForEach(ClearThreadStackTraceAndClockBase, nullptr); } else { - runtime->GetInstrumentation()->DisableMethodTracing(); + runtime->GetInstrumentation()->DisableMethodTracing(kTracerInstrumentationKey); runtime->GetInstrumentation()->RemoveListener(the_trace, instrumentation::Instrumentation::kMethodEntered | instrumentation::Instrumentation::kMethodExited | @@ -566,7 +569,7 @@ void Trace::Resume() { instrumentation::Instrumentation::kMethodExited | instrumentation::Instrumentation::kMethodUnwind); // TODO: In full-PIC mode, we don't need to fully deopt. - runtime->GetInstrumentation()->EnableMethodTracing(); + runtime->GetInstrumentation()->EnableMethodTracing(kTracerInstrumentationKey); } runtime->GetThreadList()->ResumeAll(); |