summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2017-06-02 15:34:55 -0700
committer Andreas Gampe <agampe@google.com> 2017-06-05 21:19:22 +0000
commitd2c03b558e469fefb32ebdcb1e200a33d814cf53 (patch)
treeb76a03e045773f242726bd07846edb509b0b3ef5
parente59cb816470be6bc8129fa59b192109402f7b6ab (diff)
ART: Add method names to lock-contention samples
Obfuscators and optimizers will strip reliable source info from dex files, making the traditional source file name and line number emitted in lock-contention samples not very useful. Add the method names to the sample. While this significantly increases the size of the sample, it allows mapping obfuscated code back to the source, pinpointing the involved locks. Contention samples: Before: [com.google.android.gms,1,main,956,:com.google.android.gms,6,AssetManager.java,-2,100] After: [com.google.android.gms,1,main,956,:com.google.android.gms,6,bzv com.google.android.chimera.container.ConfigurationManager.b(),AssetManager.java,-2,int android.content.res.AssetManager.getStringBlockCount(),100] Bug: 62241642 Test: m Test: m test-art-host Test: Device boots Test: Manual inspection of reports Change-Id: I8d7a65e16e022d53aba1ced2fdb202f24bced516
-rw-r--r--runtime/monitor_android.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/monitor_android.cc b/runtime/monitor_android.cc
index 7ba36529fc..74623dab31 100644
--- a/runtime/monitor_android.cc
+++ b/runtime/monitor_android.cc
@@ -15,7 +15,6 @@
*/
#include "monitor.h"
-#include "thread.h"
#include <fcntl.h>
#include <sys/stat.h>
@@ -24,6 +23,9 @@
#include <log/log.h>
#include <log/log_event_list.h>
+#include "art_method.h"
+#include "thread.h"
+
#define EVENT_LOG_TAG_dvm_lock_sample 20003
namespace art {
@@ -77,6 +79,9 @@ void Monitor::LogContentionEvent(Thread* self,
// Emit the source code line number.
ctx << line_number;
+
+ // Emit the method name.
+ ctx << ArtMethod::PrettyMethod(m);
}
// Emit the lock owner source code file name.
@@ -91,6 +96,9 @@ void Monitor::LogContentionEvent(Thread* self,
// Emit the source code line number.
ctx << owner_line_number;
+ // Emit the owner method name.
+ ctx << ArtMethod::PrettyMethod(owner_method);
+
// Emit the sample percentage.
ctx << sample_percent;