Skip to content

Commit d30dc09

Browse files
authored
[FUS-3458] Implement changes to support profiling enabled config parameter. (#16)
# New Features - [config_tool] Support read/apply the ProfilingMask configuration parameter.
2 parents 63bb6bc + c7a5d98 commit d30dc09

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

Diff for: bin/config_tool.py

+30
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,28 @@ def _str_to_tick_direction(tick_direction_str):
152152
return _tick_direction_map.get(tick_direction_str, TickDirection.OFF)
153153

154154

155+
# A bit mask used to select a set of profilers to enable:
156+
# SYSTEM = 1 << 0
157+
# COUNTERS = 1 << 1
158+
# EXECUTIONS = 1 << 2
159+
# EXECUTION_STATS = 1 << 3
160+
# PIPELINES = 1 << 4
161+
# By default enable all profiling besides EXECUTIONS.
162+
_profile_level_map = {
163+
"off": 0,
164+
"on": 0b11011,
165+
"detailed": 0b11111
166+
}
167+
168+
169+
def _args_to_profile_level(cls, args, config_interface):
170+
if args.value.isdigit():
171+
mask_val = int(args.value)
172+
else:
173+
mask_val = _profile_level_map.get(args.value, 0)
174+
return ProfilingMask(mask_val)
175+
176+
155177
_iono_delay_model_map = {
156178
"auto": IonoDelayModel.AUTO,
157179
"off": IonoDelayModel.OFF,
@@ -434,6 +456,8 @@ def _str_to_socket_type(key):
434456
'watchdog_enabled': {'format': WatchdogTimerEnabled, 'arg_parse': _args_to_bool},
435457
'user_device_id': {'format': UserDeviceID, 'arg_parse': _args_to_id},
436458

459+
'profiling_enabled': {'format': ProfilingMask, 'arg_parse': _args_to_profile_level},
460+
437461
'uart1_baud': {'format': Uart1BaudConfig, 'arg_parse': _args_to_int_gen('baud_rate')},
438462
'uart2_baud': {'format': Uart2BaudConfig, 'arg_parse': _args_to_int_gen('baud_rate')},
439463
'uart1_diagnostics_enabled': {'format': Uart1DiagnosticMessagesEnabled, 'arg_parse': _args_to_bool},
@@ -1418,6 +1442,12 @@ def main():
14181442
help='The scale factor to convert from wheel encoder ticks to distance '
14191443
'(in meters/tick).')
14201444

1445+
help = 'Configure system profiling support.'
1446+
param_parser.add_parser('profiling_enabled', help=help, description=help)
1447+
profiling_enabled_parser = apply_param_parser.add_parser('profiling_enabled', help=help, description=help)
1448+
profiling_enabled_parser.add_argument('value', help='Sets which profiling features are enabled.',
1449+
choices=_profile_level_map.keys())
1450+
14211451
# config_tool.py apply -- output interface/stream control
14221452
help = 'Configure the UART1 serial baud rate.'
14231453
param_parser.add_parser('uart1_baud', help=help, description=help)

Diff for: requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ argparse-formatter>=1.4
22
colorama>=0.4.4
33
construct~=2.10.67
44
deepdiff>=8.0.1
5-
fusion-engine-client==1.24.0rc2
5+
fusion-engine-client==1.24.0rc3
66
pynmea2~=1.18.0
77
pyserial~=3.5
88
urllib3>=1.21.1

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"colorama>=0.4.4",
1111
"construct~=2.10.67",
1212
"deepdiff>=8.0.1",
13-
"fusion-engine-client==1.24.0rc2",
13+
"fusion-engine-client==1.24.0rc3",
1414
"psutil>=5.9.4",
1515
"pynmea2~=1.18.0",
1616
"pyserial~=3.5",

0 commit comments

Comments
 (0)