4040from powerapi .cli .generator import PusherGenerator , PullerGenerator
4141from powerapi .dispatch_rule import HWPCDispatchRule , HWPCDepthLevel
4242from powerapi .dispatcher import DispatcherActor , RouteTable
43- from powerapi .exception import PowerAPIException , MissingArgumentException , NotAllowedArgumentValueException , \
44- FileDoesNotExistException
43+ from powerapi .exception import PowerAPIException , MissingArgumentException , NotAllowedArgumentValueException , FileDoesNotExistException
4544from powerapi .filter import Filter
4645from powerapi .report import HWPCReport
4746
@@ -57,52 +56,33 @@ def generate_smartwatts_parser() -> CommonCLIParsingManager:
5756 Construct and returns the SmartWatts cli parameters parser.
5857 :return: SmartWatts cli parameters parser
5958 """
60- parser_manager = CommonCLIParsingManager ()
59+ pm = CommonCLIParsingManager ()
6160
6261 # Formula control parameters
63- parser_manager .add_argument_to_cli_parser ('disable-cpu-formula' , help_text = 'Disable CPU formula' , is_flag = True ,
64- argument_type = bool , default_value = False , action = store_true )
65- parser_manager .add_argument_to_cli_parser ('disable-dram-formula' , help_text = 'Disable DRAM formula' , is_flag = True ,
66- argument_type = bool , default_value = False , action = store_true )
62+ pm .add_argument ('disable-cpu-formula' , help_text = 'Disable CPU formula' , is_flag = True , argument_type = bool , default_value = False , action = store_true )
63+ pm .add_argument ('disable-dram-formula' , help_text = 'Disable DRAM formula' , is_flag = True , argument_type = bool , default_value = False , action = store_true )
6764
6865 # Formula RAPL reference event
69- parser_manager .add_argument_to_cli_parser ('cpu-rapl-ref-event' ,
70- help_text = 'RAPL event used as reference for the CPU power models' ,
71- default_value = 'RAPL_ENERGY_PKG' )
72- parser_manager .add_argument_to_cli_parser ('dram-rapl-ref-event' ,
73- help_text = 'RAPL event used as reference for the DRAM power models' ,
74- default_value = 'RAPL_ENERGY_DRAM' )
66+ pm .add_argument ('cpu-rapl-ref-event' , help_text = 'RAPL event used as reference for the CPU power models' , default_value = 'RAPL_ENERGY_PKG' )
67+ pm .add_argument ('dram-rapl-ref-event' , help_text = 'RAPL event used as reference for the DRAM power models' , default_value = 'RAPL_ENERGY_DRAM' )
7568
7669 # CPU topology information
77- parser_manager .add_argument_to_cli_parser ('cpu-tdp' , help_text = 'CPU TDP (in Watt)' , argument_type = int ,
78- default_value = 400 )
79- parser_manager .add_argument_to_cli_parser ('cpu-base-clock' , help_text = 'CPU base clock (in MHz)' , argument_type = int ,
80- default_value = 100 )
81- parser_manager .add_argument_to_cli_parser ('cpu-base-freq' , help_text = 'CPU base frequency (in MHz)' ,
82- argument_type = int , default_value = 2100 )
70+ pm .add_argument ('cpu-tdp' , help_text = 'CPU TDP (in Watt)' , argument_type = int , default_value = 400 )
71+ pm .add_argument ('cpu-base-clock' , help_text = 'CPU base clock (in MHz)' , argument_type = int , default_value = 100 )
72+ pm .add_argument ('cpu-base-freq' , help_text = 'CPU base frequency (in MHz)' , argument_type = int , default_value = 2100 )
8373
8474 # Formula error threshold
85- parser_manager .add_argument_to_cli_parser ('cpu-error-threshold' ,
86- help_text = 'Error threshold for the CPU power models (in Watt)' ,
87- argument_type = float , default_value = 2.0 )
88- parser_manager .add_argument_to_cli_parser ('dram-error-threshold' ,
89- help_text = 'Error threshold for the DRAM power models (in Watt)' ,
90- argument_type = float , default_value = 2.0 )
75+ pm .add_argument ('cpu-error-threshold' , help_text = 'Error threshold for the CPU power models (in Watt)' , argument_type = float , default_value = 2.0 )
76+ pm .add_argument ('dram-error-threshold' , help_text = 'Error threshold for the DRAM power models (in Watt)' , argument_type = float , default_value = 2.0 )
9177
9278 # Sensor information
93- parser_manager .add_argument_to_cli_parser ('sensor-reports-frequency' ,
94- help_text = 'The frequency with which measurements are made (in milliseconds)' ,
95- argument_type = int , default_value = 1000 )
79+ pm .add_argument ('sensor-reports-frequency' , help_text = 'The frequency with which measurements are made (in milliseconds)' , argument_type = int , default_value = 1000 )
9680
9781 # Learning parameters
98- parser_manager .add_argument_to_cli_parser ('learn-min-samples-required' ,
99- help_text = 'Minimum amount of samples required before trying to learn a power model' ,
100- argument_type = int , default_value = 10 )
101- parser_manager .add_argument_to_cli_parser ('learn-history-window-size' ,
102- help_text = 'Size of the history window used to keep samples to learn from' ,
103- argument_type = int , default_value = 60 )
104-
105- return parser_manager
82+ pm .add_argument ('learn-min-samples-required' , help_text = 'Minimum amount of samples required before trying to learn a power model' , argument_type = int , default_value = 10 )
83+ pm .add_argument ('learn-history-window-size' , help_text = 'Size of the history window used to keep samples to learn from' , argument_type = int , default_value = 60 )
84+
85+ return pm
10686
10787
10888def generate_formula_configuration (config : Dict , cpu_topology : CPUTopology , scope : SmartWattsFormulaScope ) -> SmartWattsFormulaConfig :
0 commit comments