Skip to content

Commit 7caff70

Browse files
committed
[GR-40319] Add mx benchmark option for image_build_stats_file location.
PullRequest: graal/12440
2 parents e81f3a2 + 599007b commit 7caff70

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

sdk/mx.sdk/mx_sdk_benchmark.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,13 @@ def benchmark_output_dir(self, _, args):
245245
else:
246246
return None
247247

248+
def image_build_stats_file(self, bm_config, args):
249+
parsed_arg = parse_prefixed_arg('-Dnative-image.benchmark.image-build-stats-file=', args, 'Image build stats file should be specified once')
250+
if parsed_arg:
251+
return parsed_arg
252+
else:
253+
return os.path.join(bm_config.output_dir, bm_config.executable_name + '-image-build-stats.json')
254+
248255
def pgo_iteration_num(self, _, args):
249256
parsed_args = parse_prefixed_args('-Dnative-image.benchmark.pgo-iteration-num=', args)
250257
if parsed_args:

vm/mx.vm/mx_vm_benchmark.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def __init__(self, vm, bm_suite, args):
158158
self.config_dir = os.path.join(self.output_dir, 'config')
159159
self.log_dir = self.output_dir
160160
self.analysis_report_path = os.path.join(self.output_dir, self.executable_name + '-analysis.json')
161-
self.image_build_report_path = os.path.join(self.output_dir, self.executable_name + '-image-build-stats.json')
161+
self.image_build_stats_file = bm_suite.image_build_stats_file(self, args)
162162
self.base_image_build_args = [os.path.join(vm.home(), 'bin', 'native-image')]
163163
self.base_image_build_args += ['--no-fallback', '-g']
164164
self.base_image_build_args += ['-H:+VerifyGraalGraphs', '-H:+VerifyPhases', '--diagnostics-mode'] if vm.is_gate else []
@@ -171,7 +171,7 @@ def __init__(self, vm, bm_suite, args):
171171
self.base_image_build_args += ['-H:ConfigurationFileDirectories=' + self.config_dir]
172172
self.base_image_build_args += ['-H:+PrintAnalysisStatistics', '-H:AnalysisStatisticsFile=' + self.analysis_report_path]
173173
self.base_image_build_args += ['-H:+PrintCallEdges']
174-
self.base_image_build_args += ['-H:+CollectImageBuildStatistics', '-H:ImageBuildStatisticsFile=' + self.image_build_report_path]
174+
self.base_image_build_args += ['-H:+CollectImageBuildStatistics', '-H:ImageBuildStatisticsFile=' + self.image_build_stats_file]
175175
if vm.is_quickbuild:
176176
self.base_image_build_args += ['-Ob']
177177
if vm.use_string_inlining:
@@ -557,7 +557,7 @@ def image_build_statistics_rules(self, benchmark):
557557
metric_objects.append(obj + "_after_high_tier")
558558
rules = []
559559
for i in range(0, len(metric_objects)):
560-
rules.append(mx_benchmark.JsonFixedFileRule(self.config.image_build_report_path, {
560+
rules.append(mx_benchmark.JsonFixedFileRule(self.config.image_build_stats_file, {
561561
"benchmark": benchmark,
562562
"metric.name": "image-build-stats",
563563
"metric.type": "numeric",
@@ -582,7 +582,7 @@ def __call__(self, *args, **kwargs):
582582
phase = measured_phases[i]
583583
value_name = phase + "_time"
584584
rules.append(
585-
mx_benchmark.JsonFixedFileRule(self.config.image_build_report_path, {
585+
mx_benchmark.JsonFixedFileRule(self.config.image_build_stats_file, {
586586
"benchmark": benchmark,
587587
"metric.name": "compile-time",
588588
"metric.type": "numeric",
@@ -595,7 +595,7 @@ def __call__(self, *args, **kwargs):
595595
}, [value_name]))
596596
value_name = phase + "_memory"
597597
rules.append(
598-
mx_benchmark.JsonFixedFileRule(self.config.image_build_report_path, {
598+
mx_benchmark.JsonFixedFileRule(self.config.image_build_stats_file, {
599599
"benchmark": benchmark,
600600
"metric.name": "analysis-stats",
601601
"metric.type": "numeric",

0 commit comments

Comments
 (0)