Skip to content

Commit

Permalink
[FUS-3458] Implement changes to support profiling enabled config para…
Browse files Browse the repository at this point in the history
…meter. (#16)

# New Features
- [config_tool] Support read/apply the ProfilingMask configuration
parameter.
  • Loading branch information
axlan authored Feb 24, 2025
2 parents 63bb6bc + c7a5d98 commit d30dc09
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
30 changes: 30 additions & 0 deletions bin/config_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ def _str_to_tick_direction(tick_direction_str):
return _tick_direction_map.get(tick_direction_str, TickDirection.OFF)


# A bit mask used to select a set of profilers to enable:
# SYSTEM = 1 << 0
# COUNTERS = 1 << 1
# EXECUTIONS = 1 << 2
# EXECUTION_STATS = 1 << 3
# PIPELINES = 1 << 4
# By default enable all profiling besides EXECUTIONS.
_profile_level_map = {
"off": 0,
"on": 0b11011,
"detailed": 0b11111
}


def _args_to_profile_level(cls, args, config_interface):
if args.value.isdigit():
mask_val = int(args.value)
else:
mask_val = _profile_level_map.get(args.value, 0)
return ProfilingMask(mask_val)


_iono_delay_model_map = {
"auto": IonoDelayModel.AUTO,
"off": IonoDelayModel.OFF,
Expand Down Expand Up @@ -434,6 +456,8 @@ def _str_to_socket_type(key):
'watchdog_enabled': {'format': WatchdogTimerEnabled, 'arg_parse': _args_to_bool},
'user_device_id': {'format': UserDeviceID, 'arg_parse': _args_to_id},

'profiling_enabled': {'format': ProfilingMask, 'arg_parse': _args_to_profile_level},

'uart1_baud': {'format': Uart1BaudConfig, 'arg_parse': _args_to_int_gen('baud_rate')},
'uart2_baud': {'format': Uart2BaudConfig, 'arg_parse': _args_to_int_gen('baud_rate')},
'uart1_diagnostics_enabled': {'format': Uart1DiagnosticMessagesEnabled, 'arg_parse': _args_to_bool},
Expand Down Expand Up @@ -1418,6 +1442,12 @@ def main():
help='The scale factor to convert from wheel encoder ticks to distance '
'(in meters/tick).')

help = 'Configure system profiling support.'
param_parser.add_parser('profiling_enabled', help=help, description=help)
profiling_enabled_parser = apply_param_parser.add_parser('profiling_enabled', help=help, description=help)
profiling_enabled_parser.add_argument('value', help='Sets which profiling features are enabled.',
choices=_profile_level_map.keys())

# config_tool.py apply -- output interface/stream control
help = 'Configure the UART1 serial baud rate.'
param_parser.add_parser('uart1_baud', help=help, description=help)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ argparse-formatter>=1.4
colorama>=0.4.4
construct~=2.10.67
deepdiff>=8.0.1
fusion-engine-client==1.24.0rc2
fusion-engine-client==1.24.0rc3
pynmea2~=1.18.0
pyserial~=3.5
urllib3>=1.21.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"colorama>=0.4.4",
"construct~=2.10.67",
"deepdiff>=8.0.1",
"fusion-engine-client==1.24.0rc2",
"fusion-engine-client==1.24.0rc3",
"psutil>=5.9.4",
"pynmea2~=1.18.0",
"pyserial~=3.5",
Expand Down

0 comments on commit d30dc09

Please sign in to comment.