Skip to content

Commit

Permalink
java-performance: produce additional report, instead of replacing exi…
Browse files Browse the repository at this point in the history
…sting
  • Loading branch information
greenrobot-team committed Mar 31, 2016
1 parent 3045466 commit e44c0bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
11 changes: 1 addition & 10 deletions android-performance/build.gradle
Expand Up @@ -44,16 +44,7 @@ android {
}

ext.reportsDir = file("$buildDir/outputs/androidTest-results/connected")
ext.outputReportFile = file("$buildDir/reports/android-performance-0.tsv")
if (ext.outputReportFile.exists()) {
for (int i = 1; i < 1000; i++) {
def f = file("$buildDir/reports/android-performance-${i}.tsv")
if (!f.exists()) {
ext.outputReportFile = f
break;
}
}
}
ext.outputReportFile = reportFile(file("$buildDir/reports"), "android-performance-%index%.tsv")

task generateReport {
inputs.dir reportsDir
Expand Down
10 changes: 10 additions & 0 deletions build.gradle
Expand Up @@ -10,3 +10,13 @@ task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}

def reportFile(File parentDir, String templateName) {
def file
for (int i = 0; i < 1000; i++) {
file = new File(parentDir, templateName.replaceAll('%index%', i as String))
if (!file.exists()) {
return file;
}
}
return file
}
3 changes: 1 addition & 2 deletions java-essentials-performance/benchmarks.gradle
Expand Up @@ -35,7 +35,7 @@ ext.benchmarks = [
[tests: ['StringHexBenchmark$StdImpl', 'StringHexBenchmark$LibImpl'], runs: 1000, warmUp: 10]
]

ext.reportFile = file("$buildDir/reports/performance.tsv")
ext.reportFile = reportFile(file("$buildDir/reports"), "performance-%index%.tsv")

// using cpu time for measurements instead of wall time can be specified with -DcpuTime
ext.useWallTime = !project.hasProperty('cpuTime')
Expand All @@ -44,7 +44,6 @@ ext.useWallTime = !project.hasProperty('cpuTime')
task allBenchmarks {
dependsOn compileJava
inputs.sourceDir sourceSets.main.java.srcDirs.first()
outputs.file reportFile

doFirst {
reportFile.parentFile.mkdirs()
Expand Down

0 comments on commit e44c0bc

Please sign in to comment.