Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FUS-3458] Implement changes to support profiling enabled config parameter. #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 profiling 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