Gradle plugin that prints the time taken by the tasks in a build.
See Gradle Plugin Portal for usage instructions
You can customize the plugin as follows:
Parameters:
minDuration: Duration
-optional
minimum task duration for report, default0
(all tasks included)sorted: Boolean
-optional
sort by duration, defaultfalse
take: Int
-optional
take first N task from build, defaultInt.MAX_VALUE
(take all)
build.gradle.kts
:
buildTimeTracker {
consoleConfiguration.set(ConsoleConfiguration(Duration.ofMillis(200))
}
Console output:
Build finished: 0.643s
:first | 0.229s | 35.61%
:second | 0.412s | 64.07%
Parameters:
reportFile: String
-required
path for report fileminDuration: Duration
-optional
minimum task duration for report, default0
(all tasks included)includeSystemUserName: Boolean
-optional
add username to report, defaultfalse
includeSystemOSName: Boolean
-optional
add os name to report, defaultfalse
build.gradle.kts
:
buildTimeTracker {
csvConfiguration.set(CSVConfiguration("${project.buildDir}/report/buildStats.csv", Duration.ofMillis(200), true, true))
}
buildStats.csv
output:
:first, 229, 2023-06-12T04:59:05.621Z, 2023-06-12T04:59:05.850Z, myusername, Windows 11
:second, 411, 2023-06-12T04:59:05.852Z, 2023-06-12T04:59:06.263Z, myusername, Windows 11
Parameters:
reportFile: String
-required
path for report fileminDuration: Duration
-optional
minimum task duration for report, default0
(all tasks included)withTableLabels: Boolean
-optional
add table labels, defaulttrue
sorted: Boolean
-optional
sort by duration, defaultfalse
take: Int
-optional
take first N task from build, defaultInt.MAX_VALUE
(take all)
build.gradle.kts
:
buildTimeTracker {
markdownConfiguration.set(MarkdownConfiguration("${project.buildDir}/report/buildStats.md", Duration.ofMillis(0)))
}
buildStats.md
output:
#### Build finished: 0.638s
|Task|Duration|Proportion|
|---|---|---|
|:first|0.223s|34.95%|
|:second|0.413s|64.73%|
data class InfluxDBConfiguration( val url: String, val token: String, val org: String, val bucket: String, val minDuration: Duration = Duration.ZERO ) : Serializable
Parameters:
url: String
-required
URL for InfluxDB (Flux) instance. Examplehttp://localhost:8086/
token: String
-required
org: String
-required
bucket: String
-required
measurementName: String
-optional
name for metric, defaultbuildTime
minDuration: Duration
-optional
minimum task duration for report, default0
(all tasks included)
build.gradle.kts
:
buildTimeTracker {
influxDBConfiguration.set(InfluxDBConfiguration("http://192.168.1.100:8086/", "myToken", "myOrg", "MyBucket", "SampleAppBuildTime"))
}
Output:
Grafana + InfluxDB
The output data can be grouped by buildUUID
to calculate a total sum for the individual builds
- Java 11
- Gradle 6.1
Released under Apache License v2.0