https://github.com/openjdk/jdk17u-dev/blob/f969f811a71603f39e4ab42f1362271b7a4d303d/src/hotspot/share/code/codeHeapState.cpp#L1155
Jcmd CodeCache_Analytics uses own implementation of threshold calculation, allowing an error to creep in, making report invalid. Instead of unallocated size, it uses uncommitted size. The problem especially visialbe with InitialCodeCacheSize == ReservedCodeCacheSize.
https://github.com/openjdk/jdk17u-dev/blob/f969f811a71603f39e4ab42f1362271b7a4d303d/src/hotspot/share/code/codeCache.cpp#L926
{code}
java -XX:InitialCodeCacheSize=1G -XX:ReservedCodeCacheSize=1G Sleep.java
jcmd jdk.compiler/com.sun.tools.javac.launcher.Main Compiler.CodeHeap_Analytics | grep -A 2 "Threshold for method to be considered 'cold'"
Threshold for method to be considered 'cold': 5330737152.000
min. hotness = 1016
avg. hotness = 2048
--
Threshold for method to be considered 'cold': 5330696192.000
min. hotness = 1016
avg. hotness = 2048
--
Threshold for method to be considered 'cold': 75978752.000
No hotness data available
{code}