ART/Perfetto Java Heap Profiler
Adding a Sampling Java Heap Profiler to ART and its interface to Perfetto.
This cl is the first cl (CL1) in a series of cls described as below to implement the full ART/Perfetto Java Heap Profiler.
CL1: ART Java Heap Profiler. This is the main ART sampling profiler code. Tested using the ART testrunner as below as well as VLOG.
CL2: Uncomment APEX code ART side. CL3: Add APEX code Perfetto side.
CL2 and CL3 will be submitted simultaneously to avoid build failures and to add APEX dependencies.
CL4: Uncomment Perfetto API code. To be reviewed by fmayer@ (Perfetto Team). Further Testing, could be full feature testing including Perfetto at this point.
CL5: Further tests and/or optimizations can be added as needed.
Test: Passing Tests
test/testrunner/testrunner.py --host --debug -b
test/testrunner/testrunner.py --host --debug -b --64 -t 004-ThreadStress
test/testrunner/testrunner.py --host --runtime-option=-XX:PerfettoJavaHeapStackProf=true --debug -b
test/testrunner/testrunner.py --host --runtime-option=-XX:PerfettoJavaHeapStackProf=true --debug -b --64 -t 004-ThreadStress
Individualized and VLOG testing.
Bug: 160214819
Change-Id: I2be4c4e715ce8c3c8ac545e3e14332198b9c2295
(cherry picked from commit 7b149d585b4627ebb389e987c14fe808f2fe698b)
Merged-In: I2be4c4e715ce8c3c8ac545e3e14332198b9c2295
diff --git a/runtime/thread.h b/runtime/thread.h
index b23f647..7475681 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -36,6 +36,7 @@
#include "handle.h"
#include "handle_scope.h"
#include "interpreter/interpreter_cache.h"
+#include "javaheapprof/javaheapsampler.h"
#include "jvalue.h"
#include "managed_stack.h"
#include "offsets.h"
@@ -1157,6 +1158,11 @@
return tlsPtr_.thread_local_end - tlsPtr_.thread_local_pos;
}
+ // Returns pos offset from start.
+ size_t GetTlabPosOffset() const {
+ return tlsPtr_.thread_local_pos - tlsPtr_.thread_local_start;
+ }
+
// Returns the remaining space in the TLAB if we were to expand it to maximum capacity.
size_t TlabRemainingCapacity() const {
return tlsPtr_.thread_local_limit - tlsPtr_.thread_local_pos;