summaryrefslogtreecommitdiff
path: root/runtime/javaheapprof/javaheapsampler.h
diff options
context:
space:
mode:
authorWessam Hassanein <wessam@google.com>2021-02-09 14:09:10 -0800
committerTreehugger Robot <treehugger-gerrit@google.com>2021-03-10 21:07:35 +0000
commit45a9fc9b683449bc0e996e64f3b37e2de071be76 (patch)
tree918e373ac2e24ed0759b8e093fd420aa42bb0784 /runtime/javaheapprof/javaheapsampler.h
parentf2893adb27211609c17c4cc8d083371da4888032 (diff)
Add API to ART/Perfetto Java Heap Profiler (reland)
Add Perfetto API calls to ART Sampling Java Heap Profiler. Test: Passing Tests Local Testing Bug: 160214819 Test: art/tools/run-gtests.sh in ART chroot built on master-art (silvermont target) Test: art/test/testrunner/testrunner.py --target --optimizing in ART chroot built on master-art (silvermont target) Test: art/tools/run-libcore-tests.sh --mode=device in ART chroot built on master-art (silvermont target) Test: m test-art-host-gtest on master-art Test: art/tools/buildbot-build.sh --host && \ art/test/testrunner/testrunner.py --host --64 --optimizing on master-art Bug: 179915934 This reverts commit 2291439187b06d995bb298683246416c75d92740 Change-Id: I600313b9515a2a3ff64361d7307b88d9a76c07e4
Diffstat (limited to 'runtime/javaheapprof/javaheapsampler.h')
-rw-r--r--runtime/javaheapprof/javaheapsampler.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/runtime/javaheapprof/javaheapsampler.h b/runtime/javaheapprof/javaheapsampler.h
index 02cb7b7f9b..618893cad0 100644
--- a/runtime/javaheapprof/javaheapsampler.h
+++ b/runtime/javaheapprof/javaheapsampler.h
@@ -42,6 +42,15 @@ class HeapSampler {
thread_local size_t bytes_until_sample = 0;
return &bytes_until_sample;
}
+ void SetHeapID(uint32_t heap_id) {
+ perfetto_heap_id_ = heap_id;
+ }
+ void EnableHeapSampler() {
+ enabled_.store(true, std::memory_order_release);
+ }
+ void DisableHeapSampler() {
+ enabled_.store(false, std::memory_order_release);
+ }
// Report a sample to Perfetto.
void ReportSample(art::mirror::Object* obj, size_t allocation_size);
// Check whether we should take a sample or not at this allocation, and return the
@@ -60,16 +69,10 @@ class HeapSampler {
void AdjustSampleOffset(size_t adjustment);
// Is heap sampler enabled?
bool IsEnabled();
- void EnableHeapSampler(void* enable_ptr, const void* enable_info_ptr);
- void DisableHeapSampler(void* disable_ptr, const void* disable_info_ptr);
// Set the sampling interval.
- void SetSamplingInterval(int sampling_interval) REQUIRES(geo_dist_rng_lock_);
+ void SetSamplingInterval(int sampling_interval) REQUIRES(!geo_dist_rng_lock_);
// Return the sampling interval.
int GetSamplingInterval();
- // Set the Perfetto Session Info.
- void SetSessionInfo(void* info);
- // Get the Perfetto Session Info.
- void* GetSessionInfo();
private:
size_t NextGeoDistRandSample() REQUIRES(!geo_dist_rng_lock_);
@@ -81,7 +84,6 @@ class HeapSampler {
// Default sampling interval is 4kb.
// Writes guarded by geo_dist_rng_lock_.
std::atomic<int> p_sampling_interval_{4 * 1024};
- void* perfetto_session_info_;
uint32_t perfetto_heap_id_ = 0;
// std random number generator.
std::minstd_rand rng_ GUARDED_BY(geo_dist_rng_lock_); // Holds the state