Skip to content

Commit

Permalink
Make Jit telelmetry compatible with JDK 9+ (#1825)
Browse files Browse the repository at this point in the history
  • Loading branch information
gareth-ellis authored Jan 24, 2024
1 parent 84a8904 commit 2c59d03
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion esrally/mechanic/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _start_node(self, node_configuration, node_count_on_host):
telemetry_params = self.cfg.opts("telemetry", "params")
node_telemetry = [
telemetry.FlightRecorder(telemetry_params, node_telemetry_dir, java_major_version),
telemetry.JitCompiler(node_telemetry_dir),
telemetry.JitCompiler(node_telemetry_dir, java_major_version),
telemetry.Gc(telemetry_params, node_telemetry_dir, java_major_version),
telemetry.Heapdump(node_telemetry_dir),
telemetry.DiskIo(node_count_on_host),
Expand Down
26 changes: 18 additions & 8 deletions esrally/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,31 @@ class JitCompiler(TelemetryDevice):
human_name = "JIT Compiler Profiler"
help = "Enables JIT compiler logs."

def __init__(self, log_root):
def __init__(self, log_root, java_major_version):
super().__init__()
self.log_root = log_root
self.java_major_version = java_major_version

def instrument_java_opts(self):
io.ensure_dir(self.log_root)
log_file = os.path.join(self.log_root, "jit.log")
console.info("%s: Writing JIT compiler log to [%s]" % (self.human_name, log_file), logger=self.logger)
return [
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+TraceClassLoading",
"-XX:+LogCompilation",
f"-XX:LogFile={log_file}",
"-XX:+PrintAssembly",
]
if self.java_major_version < 9:
return [
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+TraceClassLoading",
"-XX:+LogCompilation",
f"-XX:LogFile={log_file}",
"-XX:+PrintAssembly",
]
else:
return [
"-XX:+UnlockDiagnosticVMOptions",
"-Xlog:class+load=info",
"-XX:+LogCompilation",
f"-XX:LogFile={log_file}",
"-XX:+PrintAssembly",
]


class Gc(TelemetryDevice):
Expand Down

0 comments on commit 2c59d03

Please sign in to comment.