Skip to content

Commit

Permalink
Merge pull request #996 from rspieldenner/perfshadowjar
Browse files Browse the repository at this point in the history
Perfshadowjar
  • Loading branch information
benjchristensen committed Mar 28, 2014
2 parents 0e2a797 + 525af22 commit 2180f39
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 49 deletions.
116 changes: 67 additions & 49 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ buildscript {
mavenCentral()
jcenter()
}
apply from: file('gradle/buildscript.gradle'), to: buildscript

apply from: file('gradle/buildscript.gradle'), to: buildscript
}

allprojects {
Expand All @@ -27,6 +27,7 @@ allprojects {

subprojects {
apply plugin: 'java'
apply plugin: 'shadow'
group = "com.netflix.rxjava"

// make 'examples' use the same classpath
Expand All @@ -45,22 +46,29 @@ subprojects {
sourceSets {
examples
perf {
compileClasspath += sourceSets.main.output
}
compileClasspath += sourceSets.main.output
}
}

tasks.build {
//include 'examples' in build task
dependsOn(examplesClasses)
dependsOn(perfClasses)
dependsOn(perfClasses)
}

task perfJar(type: Jar, dependsOn: perfClasses) {
from sourceSets.perf.output + sourceSets.main.output
}

dependencies {
perfCompile 'org.openjdk.jmh:jmh-core:0.5.3'
perfCompile 'org.openjdk.jmh:jmh-generator-annprocess:0.5.3'

//perfCompile project
}

artifacts {
perfRuntime perfJar
}

eclipse {
classpath {
Expand All @@ -78,49 +86,59 @@ subprojects {
}
}

/**
* By default: Run without arguments this will execute all benchmarks that are found (can take a long time).
*
* Optionally pass arguments for custom execution. Example:
*
* ../gradlew benchmarks '-Pjmh=-f 1 -tu ns -bm avgt -wi 5 -i 5 -r 1 .*OperatorSerializePerf.*'
*
* To see all options:
*
* ../gradlew benchmarks '-Pjmh=-h'
*/
task benchmarks(type: JavaExec) {
main = 'org.openjdk.jmh.Main'
classpath = sourceSets.perf.runtimeClasspath + sourceSets.main.output
maxHeapSize = "512m"

if (project.hasProperty('jmh')) {
args(jmh.split(' '))
} else {
//args '-h' // help output
args '-f' // fork
args '1'
args '-tu' // time unit
args 'ns'
args '-bm' // benchmark mode
args 'avgt'
args '-wi' // warmup iterations
args '5'
args '-i' // test iterations
args '5'
args '-r' // time per execution in seconds
args '5'
//args '-prof' // profilers
//args 'HS_GC' // HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans
//args 'HS_RT' // HotSpot (tm) runtime profiling via implementation-specific MBeans
//args 'HS_THR' // HotSpot (tm) threading subsystem via implementation-specific MBeans
//args 'HS_COMP' // HotSpot (tm) JIT compiler profiling via implementation-specific MBeans
//args 'HS_CL' // HotSpot (tm) classloader profiling via implementation-specific MBeans
//args 'STACK' // Simple and naive Java stack profiler
args '.*OperatorSerializePerf.*' // for running only a specific test
}
}

/**
* By default: Run without arguments this will execute all benchmarks that are found (can take a long time).
*
* Optionally pass arguments for custom execution. Example:
*
* ../gradlew benchmarks '-Pjmh=-f 1 -tu ns -bm avgt -wi 5 -i 5 -r 1 .*OperatorSerializePerf.*'
*
* To see all options:
*
* ../gradlew benchmarks '-Pjmh=-h'
*/
task benchmarks(type: JavaExec) {
main = 'org.openjdk.jmh.Main'
classpath = sourceSets.perf.runtimeClasspath + sourceSets.main.output
maxHeapSize = "512m"

if (project.hasProperty('jmh')) {
args(jmh.split(' '))
} else {
//args '-h' // help output
args '-f' // fork
args '1'
args '-tu' // time unit
args 'ns'
args '-bm' // benchmark mode
args 'avgt'
args '-wi' // warmup iterations
args '5'
args '-i' // test iterations
args '5'
args '-r' // time per execution in seconds
args '5'
//args '-prof' // profilers
//args 'HS_GC' // HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans
//args 'HS_RT' // HotSpot (tm) runtime profiling via implementation-specific MBeans
//args 'HS_THR' // HotSpot (tm) threading subsystem via implementation-specific MBeans
//args 'HS_COMP' // HotSpot (tm) JIT compiler profiling via implementation-specific MBeans
//args 'HS_CL' // HotSpot (tm) classloader profiling via implementation-specific MBeans
//args 'STACK' // Simple and naive Java stack profiler
args '.*OperatorSerializePerf.*' // for running only a specific test
}
}

shadow {
classifier = "benchmarks"
includeDependenciesFor = ["runtime", "perfRuntime"]

transformer(com.github.jengelman.gradle.plugins.shadow.transformers.ManifestResourceTransformer) {
mainClass = "org.openjdk.jmh.Main"
}
}

shadowJar.dependsOn perfJar
}

project(':rxjava-core') {
Expand Down
6 changes: 6 additions & 0 deletions gradle/buildscript.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
repositories {
// Repo in addition to maven central
repositories { maven { url 'http://dl.bintray.com/content/netflixoss/external-gradle-plugins/' } } // For gradle-release
maven {
//FIXME: waiting for https://github.com/johnrengelman/shadow/pull/38 to merge
name 'Shadow'
url 'http://dl.bintray.com/content/gvsmirnov/gradle-plugins'
}
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.1'
classpath 'com.mapvine:gradle-cobertura-plugin:0.1'
classpath 'gradle-release:gradle-release:1.1.5'
classpath 'org.ajoberstar:gradle-git:0.5.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:0.8.1'
}

0 comments on commit 2180f39

Please sign in to comment.