mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
8153394: Add Unified Logging to make it easy to trace time taken in initPhase2
Added modules+startuptime logging for initPhase2 via TraceTime class Reviewed-by: rehn, hseigel, mockner
This commit is contained in:
parent
6ef961edbd
commit
36ac8c8a00
2 changed files with 22 additions and 0 deletions
|
@ -3405,6 +3405,8 @@ static void call_initPhase1(TRAPS) {
|
|||
//
|
||||
// After phase 2, The VM will begin search classes from -Xbootclasspath/a.
|
||||
static void call_initPhase2(TRAPS) {
|
||||
TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime));
|
||||
|
||||
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
|
||||
instanceKlassHandle klass (THREAD, k);
|
||||
|
||||
|
|
|
@ -50,6 +50,18 @@ public class StartupTimeTest {
|
|||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
static void analyzeModulesOutputOn(ProcessBuilder pb) throws Exception {
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldMatch("(Phase2 initialization, [0-9]+.[0-9]+ secs)");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
static void analyzeModulesOutputOff(ProcessBuilder pb) throws Exception {
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotContain("[modules,startuptime]");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime",
|
||||
InnerClass.class.getName());
|
||||
|
@ -58,6 +70,14 @@ public class StartupTimeTest {
|
|||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime=off",
|
||||
InnerClass.class.getName());
|
||||
analyzeOutputOff(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules",
|
||||
InnerClass.class.getName());
|
||||
analyzeModulesOutputOn(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules=off",
|
||||
InnerClass.class.getName());
|
||||
analyzeModulesOutputOff(pb);
|
||||
}
|
||||
|
||||
public static class InnerClass {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue