MCPcopy Create free account
hub / github.com/apache/arrow / JavaBenchmarkRunner

Class JavaBenchmarkRunner

dev/archery/archery/benchmark/runner.py:276–365  ·  view source on GitHub ↗

Run suites for Java.

Source from the content-addressed store, hash-verified

274
275
276class JavaBenchmarkRunner(BenchmarkRunner):
277 """ Run suites for Java. """
278
279 # default repetitions is 5 for Java microbenchmark harness
280 def __init__(self, build, **kwargs):
281 """ Initialize a JavaBenchmarkRunner. """
282 self.build = build
283 super().__init__(**kwargs)
284
285 @staticmethod
286 def default_configuration(**kwargs):
287 """ Returns the default benchmark configuration. """
288 return JavaConfiguration(**kwargs)
289
290 def suite(self, name):
291 """ Returns the resulting benchmarks for a given suite. """
292 # update .m2 directory, which installs target jars
293 self.build.build()
294
295 suite_cmd = JavaMicrobenchmarkHarnessCommand(
296 self.build, self.benchmark_filter)
297
298 # Ensure there will be data
299 benchmark_names = suite_cmd.list_benchmarks()
300 if not benchmark_names:
301 return None
302
303 # TODO: support `repetition_min_time`
304 results = suite_cmd.results(repetitions=self.repetitions)
305 benchmarks = JavaMicrobenchmarkHarness.from_json(results)
306 return BenchmarkSuite(name, benchmarks)
307
308 @property
309 def list_benchmarks(self):
310 """ Returns all suite names """
311 # Ensure build is up-to-date to run benchmarks
312 self.build.build()
313
314 suite_cmd = JavaMicrobenchmarkHarnessCommand(self.build)
315 benchmark_names = suite_cmd.list_benchmarks()
316 for benchmark_name in benchmark_names:
317 yield f"{benchmark_name}"
318
319 @property
320 def suites(self):
321 """ Returns all suite for a runner. """
322 suite_name = "JavaBenchmark"
323 suite = self.suite(suite_name)
324
325 # Filter may exclude all benchmarks
326 if not suite:
327 logger.debug(f"Suite {suite_name} executed but no results")
328 return
329
330 yield suite
331
332 @staticmethod
333 def from_rev_or_path(src, root, rev_or_path, maven_conf, **kwargs):

Callers 1

from_rev_or_pathMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected