RFR: 8249: Add support for the new allocation profiler in rules [v2]
Carter Kozak
duke at openjdk.org
Fri Sep 6 16:09:48 UTC 2024
> ## Allocation Rules may use ObjectAllocationSample
>
> The allocation profiling rules (`AllocationByClassRule`, `AllocationByThreadRule`, `AutoBoxingRule`) were developed prior to the introduction of the newer and less invasive ObjectAllocationSample event. I've updated these rules to prefer the more precise events, but when those are unavailable, use the new ObjectAllocationSample events instead. This proved a bit tricky because the rules are scored based on number of events sampled, where the new events may not be emitted for every tlab based on a rate limit, so we must take into account the sample weight and estimate the number of samples as best we can.
>
> The `IRule#getRequiredEvents` API doesn't provide a way to declare _either_ dependencies, so I opted to remove the dependencies in favor of a similar check in the `getResult` implementation.
>
> ## JfrGenerator Utility
>
> The idea is to provide java sources with code that violates rules. We compile and execute the input sources while capturing a JFR, and execute rules against the results to verify they work as expected.
>
> I like having the input sources available in the test rather than only a JFR recording, because it's not clear whether most JDKs will still create the given recording, or with what configuration. However, the trade-off is that we're only testing against the JVM used to run tests, which represents a subset of all supported versions.
> This type of test must also compile and execute small Java programs, which is more expensive than executing against an existing recording, and may be more likely to flake if we're not careful.
>
> Anyhow, I thought I would share the idea before moving forward, as always, feedback is appreciated :-)
Carter Kozak has updated the pull request incrementally with one additional commit since the last revision:
Fix calculateBalanceScore when large integers are provided
-------------
Changes:
- all: https://git.openjdk.org/jmc/pull/579/files
- new: https://git.openjdk.org/jmc/pull/579/files/9f2e7c02..c525ec90
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jmc&pr=579&range=01
- incr: https://webrevs.openjdk.org/?repo=jmc&pr=579&range=00-01
Stats: 22 lines in 2 files changed: 20 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jmc/pull/579.diff
Fetch: git fetch https://git.openjdk.org/jmc.git pull/579/head:pull/579
PR: https://git.openjdk.org/jmc/pull/579
More information about the jmc-dev
mailing list