forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#10294 from geoand/build-step-startup-times
Add the ability to print the startup time of each build step
- Loading branch information
Showing
7 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
core/runtime/src/main/java/io/quarkus/runtime/util/StepTiming.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.quarkus.runtime.util; | ||
|
||
import io.quarkus.runtime.StartupContext; | ||
|
||
public class StepTiming { | ||
|
||
public static final String PRINT_STARTUP_TIMES = "quarkus.debug.print-startup-times"; | ||
|
||
private static boolean stepTimingEnabled; | ||
private static long stepTimingStart; | ||
|
||
public static void configureEnabled() { | ||
stepTimingEnabled = System.getProperty(PRINT_STARTUP_TIMES, "false").equalsIgnoreCase("true"); | ||
} | ||
|
||
public static void configureStart() { | ||
stepTimingStart = System.currentTimeMillis(); | ||
} | ||
|
||
public static void printStepTime(StartupContext startupContext) { | ||
if (!stepTimingEnabled) { | ||
return; | ||
} | ||
long stepTimingStop = System.currentTimeMillis(); | ||
String currentBuildStepName = startupContext.getCurrentBuildStepName(); | ||
System.out | ||
.println("Build step " + currentBuildStepName + " completed in: " + (stepTimingStop - stepTimingStart) + "ms"); | ||
stepTimingStart = System.currentTimeMillis(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters