Introduce the ability to annotate profile samples
We can now annotate profiles samples (classes or methods) with additional
metadata that will be persisted in the offline representation. Currently
the annotations support the package name that contributed the given
samples.
When samples are annotated, they are grouped into distinct categories
indexed by (dex_file, sample_annotation). This is achieved by extending
the profile key to include a serialized representation of the annotation.
Because they create independent groups in the profile, the annotations can
potentially increase the profile size considerably so care should be taken
when adding them in big numbers.
Information extraction (methods and classes) has also been extended to
support the annotations. Users may choose to extract the info for
a particular group (dex_file, sample_annotation) or, as before, just for a
single dex file. If the metadata is not given (e.g. when using profile
guided compilation), the default search mechanism kicks in, and the first
dex file matching the constraint is searched.
By extending the key representation, we preserve the previous profile
behaviour without the need to extended the underlying format or increase
the version.
Bug: 139884006
Test: m test-art-host-gtest
Change-Id: Iaccecd05c575bf0dac6dace6257cdafc6dc4a329
3 files changed