diff options
| author | 2023-10-05 12:13:19 +0000 | |
|---|---|---|
| committer | 2023-10-26 10:26:41 +0000 | |
| commit | 0ebabc91593573a791e2d66f72907d25655047a0 (patch) | |
| tree | 96e302573289827e1511f476c1361e4438efa5f0 /compiler/optimizing/graph_visualizer.h | |
| parent | c2eb3651e2c5a152756090c59c1c61231435ab0f (diff) | |
Treat all References like normal objects
Currently, the code only dumps the `java.lang.ref.Reference.referent`
field for PhantomReferences. That field might be useful also for other
types of references (java.lang.ref.FinalizerReference,
java.lang.ref.SoftReference and java.lang.ref.WeakReference). It's not
going to affect at all the perfetto flamegraph displayed in the UI (non
strong references are ignored by the flamegraph), but it will show up in
the `heap_grap_reference` table and it can be useful for manual
debugging.
As a side effect, the list of fields for non-strong reference types is
emitted only once now (not once per object). This could reduce the trace
size, but obviously including the extra reference might increase it. I
noticed a slight reduction in the samples I took, but we don't have the
infra to capture a trace with the exact same conditions.
Commit d3f8758e8ac("Treat PhantomReferences like normal object") did the
same for PhantomReferences. At the time, perfetto needed only
the `java.lang.ref.Reference.referent` field for
NativeAllocationRegistry. Now we realized that it might be useful
everywhere.
Tested by:
* Building, flashing, booting and unlocking a device.
* Capturing a system_server dump with `perfetto/tools/java_heap_dump -n
system_server`.
* Opening the resulting trace in ui.perfetto.dev.
* Running the SQL query:
```
SELECT r.* FROM heap_graph_class c
JOIN heap_graph_object o ON c.id = o.type_id
JOIN heap_graph_reference r ON o.id = r.owner_id
WHERE name = 'java.util.WeakHashMap$Entry';
```
* Checking that we have a `java.lang.ref.Reference.referent` now (it
wasn't there without the patch.
Bug: 302703322
Change-Id: Ibea5453d0aa8b94e7519782767aeef66cd6da4b7
Diffstat (limited to 'compiler/optimizing/graph_visualizer.h')
0 files changed, 0 insertions, 0 deletions