diff options
author | 2017-12-07 19:32:48 -0800 | |
---|---|---|
committer | 2017-12-08 12:22:36 -0800 | |
commit | 9b827ab7e63cf8b24987e75186434348d0dbf4e8 (patch) | |
tree | 7be2f4c9a19d809d8c77e2d516fbd2b62f41c672 | |
parent | c654816053ae07fb1f129d705e94b76e59f37454 (diff) |
ART: Clean up ATRACE use
Remove old ATRACE_BEGIN & _END pairs, where possible. Remove
ATRACE_CALL and replace it with ScopedTrace.
Remove utils/Trace.h include.
Test: m
Change-Id: I3a5123202f4e373074bfe0f7359ee6c60a70352a
-rw-r--r-- | compiler/driver/compiler_driver.cc | 10 | ||||
-rw-r--r-- | runtime/base/systrace.h | 1 | ||||
-rw-r--r-- | runtime/gc/heap.cc | 3 | ||||
-rw-r--r-- | runtime/thread_list.cc | 7 |
4 files changed, 9 insertions, 12 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 3bba9ef4ae..129c5d8e23 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -1612,7 +1612,7 @@ class ResolveClassFieldsAndMethodsVisitor : public CompilationVisitor { : manager_(manager) {} void Visit(size_t class_def_index) OVERRIDE REQUIRES(!Locks::mutator_lock_) { - ATRACE_CALL(); + ScopedTrace trace(__FUNCTION__); Thread* const self = Thread::Current(); jobject jclass_loader = manager_->GetClassLoader(); const DexFile& dex_file = *manager_->GetDexFile(); @@ -1957,7 +1957,7 @@ class VerifyClassVisitor : public CompilationVisitor { : manager_(manager), log_level_(log_level) {} virtual void Visit(size_t class_def_index) REQUIRES(!Locks::mutator_lock_) OVERRIDE { - ATRACE_CALL(); + ScopedTrace trace(__FUNCTION__); ScopedObjectAccess soa(Thread::Current()); const DexFile& dex_file = *manager_->GetDexFile(); const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index); @@ -2086,7 +2086,7 @@ class SetVerifiedClassVisitor : public CompilationVisitor { explicit SetVerifiedClassVisitor(const ParallelCompilationManager* manager) : manager_(manager) {} virtual void Visit(size_t class_def_index) REQUIRES(!Locks::mutator_lock_) OVERRIDE { - ATRACE_CALL(); + ScopedTrace trace(__FUNCTION__); ScopedObjectAccess soa(Thread::Current()); const DexFile& dex_file = *manager_->GetDexFile(); const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index); @@ -2150,7 +2150,7 @@ class InitializeClassVisitor : public CompilationVisitor { explicit InitializeClassVisitor(const ParallelCompilationManager* manager) : manager_(manager) {} void Visit(size_t class_def_index) OVERRIDE { - ATRACE_CALL(); + ScopedTrace trace(__FUNCTION__); jobject jclass_loader = manager_->GetClassLoader(); const DexFile& dex_file = *manager_->GetDexFile(); const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index); @@ -2666,7 +2666,7 @@ class CompileClassVisitor : public CompilationVisitor { explicit CompileClassVisitor(const ParallelCompilationManager* manager) : manager_(manager) {} virtual void Visit(size_t class_def_index) REQUIRES(!Locks::mutator_lock_) OVERRIDE { - ATRACE_CALL(); + ScopedTrace trace(__FUNCTION__); const DexFile& dex_file = *manager_->GetDexFile(); const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index); ClassLinker* class_linker = manager_->GetClassLinker(); diff --git a/runtime/base/systrace.h b/runtime/base/systrace.h index 08ab93d232..dc2206e420 100644 --- a/runtime/base/systrace.h +++ b/runtime/base/systrace.h @@ -19,7 +19,6 @@ #define ATRACE_TAG ATRACE_TAG_DALVIK #include <cutils/trace.h> -#include <utils/Trace.h> #include <sstream> #include <string> diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 91f1ff6ace..f7be4c8d5a 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -800,12 +800,11 @@ void Heap::IncrementDisableThreadFlip(Thread* self) { bool has_waited = false; uint64_t wait_start = NanoTime(); if (thread_flip_running_) { - ATRACE_BEGIN("IncrementDisableThreadFlip"); + ScopedTrace trace("IncrementDisableThreadFlip"); while (thread_flip_running_) { has_waited = true; thread_flip_cond_->Wait(self); } - ATRACE_END(); } ++disable_thread_flip_count_; if (has_waited) { diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index 8754819e09..e43b9f4b96 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -365,11 +365,11 @@ size_t ThreadList::RunCheckpoint(Closure* checkpoint_function, Closure* callback // Run the checkpoint on the suspended threads. for (const auto& thread : suspended_count_modified_threads) { if (!thread->IsSuspended()) { - if (ATRACE_ENABLED()) { + ScopedTrace trace([&]() { std::ostringstream oss; thread->ShortDump(oss); - ATRACE_BEGIN((std::string("Waiting for suspension of thread ") + oss.str()).c_str()); - } + return std::string("Waiting for suspension of thread ") + oss.str(); + }); // Busy wait until the thread is suspended. const uint64_t start_time = NanoTime(); do { @@ -378,7 +378,6 @@ size_t ThreadList::RunCheckpoint(Closure* checkpoint_function, Closure* callback const uint64_t total_delay = NanoTime() - start_time; // Shouldn't need to wait for longer than 1000 microseconds. constexpr uint64_t kLongWaitThreshold = MsToNs(1); - ATRACE_END(); if (UNLIKELY(total_delay > kLongWaitThreshold)) { LOG(WARNING) << "Long wait of " << PrettyDuration(total_delay) << " for " << *thread << " suspension!"; |