<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>With JEP 483 [1], the profiling data (AOT config file) are
captured when the training run exits. In the Leyden repo, we have
implemented a mechanism [2] to capture the profiler data at an
earlier point. Excerpt from [2]:</p>
<p><br>
</p>
<p>===</p>
<p><span style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">It
may be difficult for users to run to normal completion for all
training runs - some may prefer to only record data until the
application framework has started or prior to some method being
invoked.</span><br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">This
RFE is to track other possible triggers for CDS data to be
collected and / or for the _assembly phase_ to being.</span><br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">(a)
JCMD: a new jcmd can be developed to attach to a running JVM and
signal the training run has ended. For classic CDS, this may be
the point at which the classlist is dumped to the file. For
premain CDS, this may trigger the start of the assembly phase
and the creation of the CDS archive.</span><br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">(b)
API: a new Leyden-specific API may be created that allows
developers to indicate programatically the point at which the
training run should end. This could be as simple as a static
method `Leyden.endTraining()` or something that exposes more
state such as the name of the CDS file. Details TBD based on
need.</span><br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<br style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<span style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">(c)
Commandline: a new option could specify when to trigger the end
of the training run. ie:
`-XX:CDSEndTrainingOnEntry=org.foo.bar.someMethod`. This can be
extended beyond single entry to also include a counted entry ie:
the 1000 time this method is entered.</span></p>
<p><span style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">===<br>
</span></p>
<p><span style="color: rgb(23, 43, 77); font-family: "DejaVu Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><br>
</span></p>
<p>As of today, (a) and (c) have been implemented in the Leyden
repo. We have received positive feedback from developers who found
this mechanism to be useful and are requesting for similar
features in the JDK mainline.</p>
<p>I think now will be a good time to have a wider discussion with
the community about:</p>
<p>- The use case and requirements for such a mechanism</p>
<p>- The solution space -- besides the 3 options listed above, are
there other approaches? Pros & cons?</p>
<p>For example, an API might be more precise. However, many apps are
built with 3rd libraries that cannot be modified easily, so an
external mechanism would be preferable. JCMD might be least
intrusive, but it's timing dependent and may not be available (in
containers, etc).<br>
</p>
<p><br>
</p>
<p>--------------------------------------<br>
</p>
<p>[1] <a class="moz-txt-link-freetext" href="https://openjdk.org/jeps/483">https://openjdk.org/jeps/483</a><br>
</p>
<p>[2] <a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8335358">https://bugs.openjdk.org/browse/JDK-8335358</a><br>
</p>
</body>
</html>