build.gradle.kts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import net.ltgt.gradle.errorprone.errorprone
  2. plugins {
  3. id("me.champeau.jmh")
  4. id("com.github.johnrengelman.shadow")
  5. id("otel.java-conventions")
  6. id("otel.jmh-conventions")
  7. }
  8. dependencies {
  9. jmh(platform(project(":dependencyManagement")))
  10. jmh("io.opentelemetry:opentelemetry-api")
  11. jmh("net.bytebuddy:byte-buddy-agent")
  12. jmh(project(":instrumentation-api"))
  13. jmh(project(":javaagent-instrumentation-api"))
  14. jmh(project(":javaagent-tooling"))
  15. jmh(project(":javaagent-extension-api"))
  16. jmh("com.github.ben-manes.caffeine:caffeine")
  17. jmh("javax.servlet:javax.servlet-api:4.0.1")
  18. jmh("com.google.http-client:google-http-client:1.19.0")
  19. jmh("org.eclipse.jetty:jetty-server:9.4.1.v20170120")
  20. jmh("org.eclipse.jetty:jetty-servlet:9.4.1.v20170120")
  21. jmh("org.slf4j:slf4j-api")
  22. // used to provide lots of classes for TypeMatchingBenchmark
  23. jmh("org.springframework:spring-web:4.3.28.RELEASE")
  24. }
  25. jmh {
  26. profilers.set(listOf("io.opentelemetry.benchmark.UsedMemoryProfiler", "gc"))
  27. duplicateClassesStrategy.set(DuplicatesStrategy.EXCLUDE)
  28. val jmhIncludeSingleClass: String? by project
  29. if (jmhIncludeSingleClass != null) {
  30. includes.set(listOf(jmhIncludeSingleClass))
  31. }
  32. }
  33. tasks {
  34. // without disabling errorprone, jmh task fails with
  35. // Task :benchmark:jmhCompileGeneratedClasses FAILED
  36. // error: plug-in not found: ErrorProne
  37. withType<JavaCompile>().configureEach {
  38. options.errorprone {
  39. isEnabled.set(false)
  40. }
  41. }
  42. named("jmh") {
  43. dependsOn(":javaagent:fullJavaagentJar")
  44. }
  45. }
  46. /*
  47. If using libasyncProfiler, use the following to generate nice svg flamegraphs.
  48. sed '/unknown/d' benchmark/build/reports/jmh/profiler.txt | sed '/^thread_start/d' | sed '/not_walkable/d' > benchmark/build/reports/jmh/profiler-cleaned.txt
  49. (using https://github.com/brendangregg/FlameGraph)
  50. ./flamegraph.pl --color=java benchmark/build/reports/jmh/profiler-cleaned.txt > benchmark/build/reports/jmh/jmh-main.svg
  51. */