Add more systracing everywhere
Added to:
JIT
DexFile functions
Oat file manager
Added helper ScopedTrace to prevent errors and reduce excess code.
Bug: 27502458
(cherry picked from commit dabdc0fe183d4684f3cf4d70cb09d318cff81b42)
Change-Id: Ifaeff8913d79eefc797380987d13cc00456266f8
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index ea26d58..9ae179f 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -16,14 +16,13 @@
#include "oat_file_manager.h"
-#define ATRACE_TAG ATRACE_TAG_DALVIK
-#include <cutils/trace.h>
#include <memory>
#include <queue>
#include <vector>
#include "base/logging.h"
#include "base/stl_util.h"
+#include "base/systrace.h"
#include "class_linker.h"
#include "dex_file-inl.h"
#include "gc/scoped_gc_critical_section.h"
@@ -299,6 +298,7 @@
jobjectArray dex_elements,
const OatFile** out_oat_file,
std::vector<std::string>* error_msgs) {
+ ScopedTrace trace(__FUNCTION__);
CHECK(dex_location != nullptr);
CHECK(error_msgs != nullptr);
@@ -388,14 +388,15 @@
ScopedSuspendAll ssa("Add image space");
runtime->GetHeap()->AddSpace(image_space.get());
}
- ATRACE_BEGIN(StringPrintf("Adding image space for location %s", dex_location).c_str());
- added_image_space = runtime->GetClassLinker()->AddImageSpace(image_space.get(),
- h_loader,
- dex_elements,
- dex_location,
- /*out*/&dex_files,
- /*out*/&temp_error_msg);
- ATRACE_END();
+ {
+ ScopedTrace trace2(StringPrintf("Adding image space for location %s", dex_location));
+ added_image_space = runtime->GetClassLinker()->AddImageSpace(image_space.get(),
+ h_loader,
+ dex_elements,
+ dex_location,
+ /*out*/&dex_files,
+ /*out*/&temp_error_msg);
+ }
if (added_image_space) {
// Successfully added image space to heap, release the map so that it does not get
// freed.