zephyr/doc
Nicolas Pitre 099850e916 ring_buffer: the great simplification
This code is rather hairy. When I look at it I don't like the way it
stares back at me.

First, the rewind business looks fishy. It has to die.

And we don't have to rely on modulus either. Not even for non-power-of-2
buffers. Let's kill that distinction too and make all sizes always
"high performance".

The code is now entirely relying only on simple ALU operations (add,
sub and compare).

The key assumption: 32-bit values do wrap around after max range has
been reached. No saturation. All architectures supported by Zephyr
do that.

Some stats:

lib/os/ring_buffer.c: 62 insertions(+), 124 deletions(-)

ring_buffer.c.obj       before   after    diff
----------------------------------------------
frdm_k64f                 1224    1136     -88
m2gl025_miv               2485    2079    -406
mps2_an385                1228    1132     -96
mps2_an521                1228    1132     -96
native_posix              1546    1496     -50
native_posix_64           1598    1595      -3
nsim_hs_mpuv6             1252    1192     -60
nsim_hs_smp               1252    1192     -60
nsim_sem                  1252    1192     -60
qemu_arc_em               1324    1192    -132
qemu_arc_hs6x             1824    1620    -204
qemu_arc_hs               1252    1192     -60
qemu_cortex_a53_smp       2154    1888    -266
qemu_cortex_a53           2154    1888    -266
qemu_cortex_a9            1938    1792    -146

Before (qemu_cortex_a53):
START - test_ringbuffer_performance
1 byte put-get, avg cycles: 52
4 byte put-get, avg cycles: 47
1 byte put claim-finish, avg cycles: 39
5 byte put claim-finish, avg cycles: 41
5 byte get claim-finish, avg cycles: 52
 PASS - test_ringbuffer_performance in 0.8 seconds

After (qemu_cortex_a53):
START - test_ringbuffer_performance
1 byte put-get, avg cycles: 34
4 byte put-get, avg cycles: 41
1 byte put claim-finish, avg cycles: 27
5 byte put claim-finish, avg cycles: 29
5 byte get claim-finish, avg cycles: 29
 PASS - test_ringbuffer_performance in 0.4 seconds

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-02-24 14:49:00 -08:00
..
_doxygen doc: doxygen: adjust titles 2021-11-08 11:17:37 +01:00
_extensions/zephyr doc: extensions: doxyrunner: do not modify extension config 2022-02-05 06:24:26 -05:00
_scripts doc: add support for DT_TURBO_MODE 2022-02-21 20:47:10 -05:00
_static doc: readme: make logo text gray 2022-02-21 19:38:11 -05:00
_templates doc: add a toctree with reference material 2021-11-02 13:24:40 +01:00
application doc: application: tweak experimental features text 2022-02-21 22:07:12 -05:00
contribute doc: contribute: signed-off-by updates 2022-02-22 15:07:11 -08:00
development_process doc: use extlink for github issue links 2022-01-17 12:48:43 -05:00
getting_started doc: toolchain: add a few words about XCC 2022-02-02 18:39:24 -05:00
guides pm: Rename pm_power_state_exit_post_ops 2022-02-23 07:33:46 -05:00
images
introduction doc: mention MIPS architecture support 2022-01-24 17:11:42 -05:00
reference ring_buffer: the great simplification 2022-02-24 14:49:00 -08:00
releases doc: fix release notes title for 3.0 2022-02-22 19:02:22 -08:00
security security: docs: Add CVE-2021-3966 2022-02-17 19:05:08 -05:00
templates
404.rst
CMakeLists.txt cmake: doc: created a doc.cmake CMake module in Zephyr CMake modules dir 2022-02-22 10:02:39 -08:00
LICENSING.rst
Makefile doc: add support for DT_TURBO_MODE 2022-02-21 20:47:10 -05:00
conf.py doc: silent filtered warnings 2022-02-22 16:02:56 -08:00
copyright.rst
glossary.rst docs: pm: Add power domain information 2022-01-19 13:35:32 -05:00
index-tex.rst
index.rst doc: add a toctree with reference material 2021-11-02 13:24:40 +01:00
known-warnings.txt
substitutions.txt
zephyr.doxyfile.in doc: generate Doxygen tag file 2022-01-21 14:26:14 -05:00