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

shell: introduce shell_xxx_impl wrapper functions for output macros #75340

Merged

Conversation

ndrs-pst
Copy link
Contributor

@ndrs-pst ndrs-pst commented Jul 2, 2024

Refactor shell output macros to minimize caller overhead by eliminating direct color parameter passing:

  • Introduce wrapper functions: shell_info_impl, shell_print_impl, shell_warn_impl, shell_error_impl.
  • Replace shell_fprintf in macros with these new wrappers.
  • Update shell_hexdump_line to use the new wrappers, minimizing caller overhead.

@zephyrbot zephyrbot added the area: Shell Shell subsystem label Jul 2, 2024
@ndrs-pst ndrs-pst force-pushed the pr_shell_shell_xxx_impl_wrapper branch from 82ac281 to 3aee3fa Compare July 2, 2024 17:16
@ndrs-pst
Copy link
Contributor Author

ndrs-pst commented Jul 2, 2024

Additional information

BUILD TARGET FLASH SIZE (BEFORE) FLASH SIZE (AFTER) INCREASE/DECREASE
samples/shields/npm1300_ek with board nrf52dk_nrf52832 78,568 B 78,456 B -112 B
tests/bluetoosh/shell with board esp32s3_devkitc/esp32s3/procpu 255,610 B irom0_0_seg 254,902 B irom0_0_seg -708 B
tests/bluetoosh/shell with board nrf5340dk_nrf5340_cpuapp 248,308 B 247,460 B -848 B
samples/drivers/flash_shell with board disco_l475_iot1 98,580 B 98,388 B -192 B

Refactor shell output macros to minimize caller overhead by eliminating
direct `color` parameter passing:
- Introduce wrapper functions: `shell_info_impl`, `shell_print_impl`,
  `shell_warn_impl`, `shell_error_impl`.
- Replace `shell_fprintf` in macros with these new wrappers.
- Update `shell_hexdump_line` to use the new wrappers,
  minimizing caller overhead.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
@ndrs-pst ndrs-pst force-pushed the pr_shell_shell_xxx_impl_wrapper branch from 3aee3fa to 8b338cd Compare July 2, 2024 17:58
@ndrs-pst
Copy link
Contributor Author

ndrs-pst commented Jul 6, 2024

Ping @carlescufi for review. If this PR can be merged, I can leverage this wrapper in many places 😃.

@nashif nashif added this to the v4.0.0 milestone Jul 9, 2024
@nashif nashif merged commit d5cd47f into zephyrproject-rtos:main Jul 27, 2024
22 checks passed
@ndrs-pst ndrs-pst deleted the pr_shell_shell_xxx_impl_wrapper branch July 28, 2024 06:16
ndrs-pst added a commit to DDC-NDRS/zephyr_rtos that referenced this pull request Jul 28, 2024
Due to the introduction of `shell_xxx_impl` wrapper functions in
PR zephyrproject-rtos#75340, we can minimize caller overhead by eliminating direct
`color` parameter passing.

This is achieved by using `shell_print_impl`, `shell_error_impl`,
`shell_info_impl` and `shell_warn_impl` instead of `shell_fprintf`.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
carlescufi pushed a commit that referenced this pull request Jul 31, 2024
Due to the introduction of `shell_xxx_impl` wrapper functions in
PR #75340, we can minimize caller overhead by eliminating direct
`color` parameter passing.

This is achieved by using `shell_print_impl`, `shell_error_impl`,
`shell_info_impl` and `shell_warn_impl` instead of `shell_fprintf`.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
ndrs-pst added a commit to DDC-NDRS/zephyr_rtos that referenced this pull request Aug 16, 2024
Due to the introduction of `shell_xxx_impl` wrapper functions in
PR zephyrproject-rtos#75340, we can minimize caller overhead by eliminating direct
`color` parameter passing.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
Chenhongren pushed a commit to Chenhongren/zephyr that referenced this pull request Aug 26, 2024
Due to the introduction of `shell_xxx_impl` wrapper functions in
PR zephyrproject-rtos#75340, we can minimize caller overhead by eliminating direct
`color` parameter passing.

This is achieved by using `shell_print_impl`, `shell_error_impl`,
`shell_info_impl` and `shell_warn_impl` instead of `shell_fprintf`.

(cherry picked from commit 16386d7)

Original-Signed-off-by: Pisit Sawangvonganan <[email protected]>
GitOrigin-RevId: 16386d7
Change-Id: I1c97cadf3ca9301f487496041e03c57ed88de64c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5752451
Reviewed-by: Fabio Baltieri <[email protected]>
Tested-by: Fabio Baltieri <[email protected]>
Commit-Queue: Fabio Baltieri <[email protected]>
Tested-by: ChromeOS Prod (Robot) <[email protected]>
ndrs-pst added a commit to DDC-NDRS/zephyr_rtos that referenced this pull request Sep 10, 2024
…intf`

Due to the introduction of `shell_xxx_impl` wrapper functions in
PR zephyrproject-rtos#75340 and rename to `shell_fprintf_xxx` in PR zephyrproject-rtos#77192 we can minimize
caller overhead by eliminating direct `color` parameter passing.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
carlescufi pushed a commit that referenced this pull request Sep 10, 2024
…intf`

Due to the introduction of `shell_xxx_impl` wrapper functions in
PR #75340 and rename to `shell_fprintf_xxx` in PR #77192 we can minimize
caller overhead by eliminating direct `color` parameter passing.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
nagelkl pushed a commit to nagelkl/zephyr that referenced this pull request Sep 16, 2024
…intf`

Due to the introduction of `shell_xxx_impl` wrapper functions in
PR zephyrproject-rtos#75340 and rename to `shell_fprintf_xxx` in PR zephyrproject-rtos#77192 we can minimize
caller overhead by eliminating direct `color` parameter passing.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Shell Shell subsystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants