Skip to content

Commit 0163301

Browse files
committed
tweak colors, avoid divergence in stack trace due to reflection inflation.
1 parent ceb80bf commit 0163301

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

build.sbt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def profParser(s: State): Parser[String] = {
103103
}
104104

105105
commands += Command.custom((s: State) => Command.applyEffect(profParser(s))((line: String) => {
106+
val flameGraphOpts = s"--minwidth,1,--colors,java,--cp,--width,1800"
106107
abstract class Profiler(val name: String) {
107108
def command(outDir: File): String
108109
}
@@ -111,10 +112,10 @@ commands += Command.custom((s: State) => Command.applyEffect(profParser(s))((lin
111112
def command(outDir: File): String = "-jvmArgs -Xprof -prof hs_comp -prof hs_gc -prof stack -prof hs_rt"
112113
}
113114
object jfr extends Profiler("jfr") {
114-
def command(outDir: File): String = s"-prof jmh.extras.JFR:dir=${outDir.getAbsolutePath};flameGraphOpts=--hash,--minwidth,1;verbose=true'"
115+
def command(outDir: File): String = s"-prof jmh.extras.JFR:dir=${outDir.getAbsolutePath};flameGraphOpts=$flameGraphOpts;verbose=true'"
115116
}
116117
object async extends Profiler("async") {
117-
def command(outDir: File): String = s"-prof jmh.extras.Async:dir=${outDir.getAbsolutePath};flameGraphOpts=--hash,--minwidth,1;verbose=true;event=cpu"
118+
def command(outDir: File): String = s"-prof jmh.extras.Async:dir=${outDir.getAbsolutePath};flameGraphOpts=$flameGraphOpts;verbose=true;event=cpu" // + ";simpleName=true" TODO add this after upgrading next sbt-jmh release
118119
}
119120
object perfNorm extends Profiler("perfNorm") {
120121
def command(outDir: File): String = "-prof perfnorm"
@@ -124,7 +125,7 @@ commands += Command.custom((s: State) => Command.applyEffect(profParser(s))((lin
124125
val commands: List[String] = profs.flatMap { (prof: Profiler) =>
125126
val outDir = file(s"target/profile-${prof.name}")
126127
IO.createDirectory(outDir)
127-
List(line + " " + prof.command(outDir) + s" -o ${(outDir / "jmh.log").getAbsolutePath} -rf json -rff ${(outDir / "result.json").getAbsolutePath}", BasicCommandStrings.FailureWall)
128+
List(line + " -jvmArgs -Dsun.reflect.inflationThreshold=0 " + prof.command(outDir) + s" -o ${(outDir / "jmh.log").getAbsolutePath} -rf json -rff ${(outDir / "result.json").getAbsolutePath}", BasicCommandStrings.FailureWall)
128129
}
129130
s.copy(remainingCommands = BasicCommandStrings.ClearOnFailure :: commands ++ s.remainingCommands)
130131
}))

0 commit comments

Comments
 (0)