@@ -2815,7 +2815,7 @@ def rules(self, out, benchmarks, bmSuiteArgs):
2815
2815
# Should currently only contain round numbers due to the field incorrectly being indexed as integer in the DB (GR-57487)
2816
2816
"latency_percentiles" : [50.0 , 75.0 , 90.0 , 99.0 , 100.0 ],
2817
2817
"rss_percentiles" : [100 , 99 , 98 , 97 , 96 , 95 , 90 , 75 , 50 , 25 ],
2818
- "disable_trackers " : [mx_benchmark .RssTracker , mx_benchmark . PsrecordTracker , mx_benchmark . PsrecordMaxrssTracker , mx_benchmark . RssPercentilesTracker , mx_benchmark . RssPercentilesAndMaxTracker ],
2818
+ "supported_trackers " : [mx_benchmark .EnergyConsumptionTracker ],
2819
2819
}
2820
2820
2821
2821
class BaristaBenchmarkSuite (mx_benchmark .CustomHarnessBenchmarkSuite ):
@@ -2828,9 +2828,8 @@ class BaristaBenchmarkSuite(mx_benchmark.CustomHarnessBenchmarkSuite):
2828
2828
def __init__ (self , custom_harness_command : mx_benchmark .CustomHarnessCommand = None ):
2829
2829
if custom_harness_command is None :
2830
2830
custom_harness_command = BaristaBenchmarkSuite .BaristaCommand ()
2831
- super ().__init__ (custom_harness_command )
2831
+ super ().__init__ (custom_harness_command , supported_trackers = _baristaConfig [ "supported_trackers" ] )
2832
2832
self ._version = None
2833
- self ._extra_run_options = []
2834
2833
2835
2834
def readBaristaVersionFromPyproject (self ):
2836
2835
# tomllib was included in python standard library with version 3.11
@@ -2916,25 +2915,6 @@ def validateEnvironment(self):
2916
2915
def new_execution_context (self , vm : Vm , benchmarks : List [str ], bmSuiteArgs : List [str ]) -> SingleBenchmarkExecutionContext :
2917
2916
return SingleBenchmarkExecutionContext (self , vm , benchmarks , bmSuiteArgs )
2918
2917
2919
- def register_tracker (self , name , tracker_type ):
2920
- if tracker_type in _baristaConfig ["disable_trackers" ]:
2921
- mx .log (f"Ignoring the registration of '{ name } ' tracker as it was disabled for { self .__class__ .__name__ } ." )
2922
- return
2923
- if name == "energy" :
2924
- if self .version () < "0.4.1" :
2925
- mx .abort (
2926
- "The 'energy' tracker is not supported for barista benchmarks before Barista version '0.4.1'."
2927
- " Please update your Barista repository in order to use the 'energy' tracker! Aborting!"
2928
- )
2929
- # Allow for the baseline measurement before looking up the app process
2930
- self ._extra_run_options += ["--cmd-app-prefix-init-timelimit" , f"{ tracker_type (self ).baseline_duration + 5 } " ]
2931
- # Ensure that the workload is independent from the performance of the VM
2932
- # We want to track the energy needed for a set amount of work
2933
- self ._extra_run_options += ["--startup-iteration-count" , "0" ]
2934
- self ._extra_run_options += ["--warmup-iteration-count" , "0" ]
2935
- self ._extra_run_options += ["--throughput-iteration-count" , "0" ]
2936
- super ().register_tracker (name , tracker_type )
2937
-
2938
2918
def createCommandLineArgs (self , benchmarks , bmSuiteArgs ):
2939
2919
# Pass the VM options, BaristaCommand will form the final command.
2940
2920
return self .vmArgs (bmSuiteArgs )
@@ -3149,6 +3129,29 @@ def _updateCommandOption(self, cmd, option_name, option_short_name, new_value):
3149
3129
new_value = f"{ new_value } { existing_option_match .group (1 )} "
3150
3130
cmd .append (f"{ option_name } ={ new_value } " )
3151
3131
3132
+ def _energyTrackerExtraOptions (self , suite : BaristaBenchmarkSuite ):
3133
+ """Returns extra options necessary for correct benchmark results when using the 'energy' tracker."""
3134
+ if not isinstance (suite ._tracker , mx_benchmark .EnergyConsumptionTracker ):
3135
+ return []
3136
+
3137
+ required_barista_version = "0.4.5"
3138
+ if mx .VersionSpec (suite .version ()) < mx .VersionSpec (required_barista_version ):
3139
+ mx .abort (
3140
+ f"The 'energy' tracker is not supported for barista benchmarks before Barista version '{ required_barista_version } '."
3141
+ " Please update your Barista repository in order to use the 'energy' tracker! Aborting!"
3142
+ )
3143
+
3144
+ extra_options = []
3145
+ # If baseline has to be measured, wait for the measurement duration before looking up the app process
3146
+ if suite ._tracker .baseline_power is None :
3147
+ extra_options += ["--cmd-app-prefix-init-sleep" , f"{ suite ._tracker .baseline_duration } " ]
3148
+ # Ensure that the workload is independent from the performance of the VM
3149
+ # We want to track the energy needed for a set amount of work
3150
+ extra_options += ["--startup-iteration-count" , "0" ]
3151
+ extra_options += ["--warmup-iteration-count" , "0" ]
3152
+ extra_options += ["--throughput-iteration-count" , "0" ]
3153
+ return extra_options
3154
+
3152
3155
def produceHarnessCommand (self , cmd , suite ):
3153
3156
"""Maps a JVM command into a command tailored for the Barista harness.
3154
3157
@@ -3173,7 +3176,7 @@ def produceHarnessCommand(self, cmd, suite):
3173
3176
jvm_vm_options = jvm_cmd [index_of_java_exe + 1 :]
3174
3177
3175
3178
# Verify that the run arguments don't already contain a "--mode" option
3176
- run_args = suite .runArgs (suite .execution_context .bmSuiteArgs ) + suite . _extra_run_options
3179
+ run_args = suite .runArgs (suite .execution_context .bmSuiteArgs ) + self . _energyTrackerExtraOptions ( suite )
3177
3180
mode_pattern = r"^(?:-m|--mode)(=.*)?$"
3178
3181
mode_match = self ._regexFindInCommand (run_args , mode_pattern )
3179
3182
if mode_match :
0 commit comments