• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

src/11-Mar-2024-225181

CMakeLists.txtD11-Mar-2024226 96

KconfigD11-Mar-2024307 1712

README.rstD11-Mar-20245.4 KiB134113

benchmark_256KB.robotD11-Mar-20242.8 KiB8473

prj.confD11-Mar-202497 65

sample.yamlD11-Mar-20241.5 KiB4847

README.rst

1.. zephyr:code-sample:: zbus-benchmark
2   :name: Benchmarking
3   :relevant-api: zbus_apis
4
5   Measure the time for sending 256KB from a producer to X consumers.
6
7This sample implements an application to measure the time for sending 256KB from the producer to the consumers.
8
9Building and Running
10********************
11
12.. zephyr-app-commands::
13   :zephyr-app: samples/subsys/zbus/dyn_channel
14   :host-os: unix
15   :board: qemu_cortex_m3
16   :gen-args: -DCONFIG_BM_MESSAGE_SIZE=1 -DCONFIG_BM_ONE_TO=1 -DCONFIG_BM_ASYNC=y
17   :goals: build run
18
19Notice we have the following parameters:
20
21* **CONFIG_BM_MESSAGE_SIZE** the size of the message to be transferred (1, 2, 4, 8, 16, 32, 64, 128, or 256);
22* **CONFIG_BM_ONE_TO** number of consumers to send (1, 2, 4, or 8);
23* **CONFIG_BM_ASYNC** if the execution must be asynchronous or synchronous. Use y to async and n to sync;
24
25Sample Output
26=============
27The result would be something like:
28
29.. code-block:: console
30
31    *** Booting Zephyr OS build zephyr-v3.3.0 ***
32    I: Benchmark 1 to 1: Dynamic memory, SYNC transmission and message size 1
33    I: Bytes sent = 262144, received = 262144
34    I: Average data rate: 0.6MB/s
35    I: Duration: 4.72020167s
36
37    @4072020167
38
39
40Running the benchmark automatically
41===================================
42
43There is a `Robot framework <https://robotframework.org/>`_ script called ``benchmark_256KB.robot`` which runs all the input combinations as the complete benchmark.
44The resulting file, ``zbus_dyn_benchmark_256KB.csv`` is generated in the project root folder. It takes a long time to execute. In the CSV file, we have the following columns:
45
46+------------+---------------------+--------------------------+---------------+-------------+-------------+
47| Style      | Number of consumers | Message size (bytes)     | Duration (ns) | RAM (bytes) | ROM (bytes) |
48+============+=====================+==========================+===============+=============+=============+
49| SYNC/ASYNC | 1,2,4,8             | 1,2,4,8,16,32,64,128,256 | float         | int         | int         |
50+------------+---------------------+--------------------------+---------------+-------------+-------------+
51
52The complete benchmark command using Robot framework is:
53
54.. code-block:: console
55
56    robot --variable serial_port:/dev/ttyACM0 --variable board:nrf52833dk_nrf52833 -d /tmp/benchmark_out   benchmark_256KB.robot
57
58An example of execution using the ``nrf52833dk_nrf52833`` board would generate a file like this:
59
60.. code-block::
61
62    SYNC,1,1,2312815348.3333335,7286,23752
63    SYNC,1,2,1172444661.3333333,7287,23760
64    SYNC,1,4,602284749.6666666,7289,23768
65    SYNC,1,8,323750814.0,7293,23772
66    SYNC,1,16,175120035.66666666,7301,23776
67    SYNC,1,32,103942871.33333333,7317,23776
68    SYNC,1,64,68318685.0,7349,23776
69    SYNC,1,128,50567627.333333336,7477,23776
70    SYNC,1,256,41656494.0,7733,23776
71    SYNC,2,1,1277842204.3333333,7298,23768
72    SYNC,2,2,647094726.6666666,7299,23776
73    SYNC,2,4,329559326.3333333,7301,23784
74    SYNC,2,8,170979817.66666666,7305,23796
75    SYNC,2,16,95174153.66666667,7313,23792
76    SYNC,2,32,55786133.0,7329,23792
77    SYNC,2,64,36173502.333333336,7361,23792
78    SYNC,2,128,26326497.666666668,7489,23792
79    SYNC,2,256,21280924.333333332,7745,23792
80    SYNC,4,1,745513916.0,7322,23800
81    SYNC,4,2,374755859.6666667,7323,23808
82    SYNC,4,4,191497802.66666666,7325,23816
83    SYNC,4,8,101399739.66666667,7329,23820
84    SYNC,4,16,54026286.0,7337,23824
85    SYNC,4,32,31097412.0,7353,23824
86    SYNC,4,64,19643148.333333332,7385,23824
87    SYNC,4,128,13936360.333333334,7513,23824
88    SYNC,4,256,11047363.333333334,7769,23824
89    SYNC,8,1,477518717.3333333,7370,23864
90    SYNC,8,2,240773518.66666666,7371,23872
91    SYNC,8,4,121897379.33333333,7373,23880
92    SYNC,8,8,64015706.333333336,7377,23884
93    SYNC,8,16,33681234.0,7385,23888
94    SYNC,8,32,18880208.333333332,7401,23888
95    SYNC,8,64,11505127.0,7433,23888
96    SYNC,8,128,7781982.333333333,7561,23888
97    SYNC,8,256,5940755.333333333,7817,23888
98    ASYNC,1,1,9422749837.333334,7962,24108
99    ASYNC,1,2,4728759765.333333,7963,24116
100    ASYNC,1,4,2380554199.3333335,7965,24124
101    ASYNC,1,8,1225118001.6666667,7969,24128
102    ASYNC,1,16,618764241.6666666,7977,24132
103    ASYNC,1,32,326253255.3333333,7993,24132
104    ASYNC,1,64,179473876.66666666,8025,24132
105    ASYNC,1,128,106170654.33333333,8217,24132
106    ASYNC,1,256,69386800.33333333,8601,24136
107    ASYNC,2,1,8347330729.0,8650,24288
108    ASYNC,2,2,4186747233.3333335,8651,24296
109    ASYNC,2,4,2092895507.3333333,8653,24304
110    ASYNC,2,8,1049245198.6666666,8657,24316
111    ASYNC,2,16,541544596.6666666,8665,24312
112    ASYNC,2,32,281127929.6666667,8681,24312
113    ASYNC,2,64,150746663.66666666,8713,24312
114    ASYNC,2,128,85662842.0,8969,24312
115    ASYNC,2,256,48909505.0,9481,24320
116    ASYNC,4,1,7854085286.666667,10026,24652
117    ASYNC,4,2,3935852050.3333335,10027,24660
118    ASYNC,4,4,1972869873.0,10029,24668
119    ASYNC,4,8,979451497.6666666,10033,24672
120    ASYNC,4,16,499348958.0,10041,24676
121    ASYNC,4,32,253712972.0,10057,24676
122    ASYNC,4,64,131022135.33333333,10089,24676
123    ASYNC,4,128,69610595.66666667,10473,24676
124    ASYNC,4,256,38706461.666666664,11241,24692
125    ASYNC,8,1,7590311686.666667,12778,25220
126    ASYNC,8,2,3800333658.6666665,12779,25228
127    ASYNC,8,4,1900014241.6666667,12781,25236
128    ASYNC,8,8,940419515.0,12785,25240
129    ASYNC,8,16,478739420.6666667,12793,25244
130    ASYNC,8,32,241465250.66666666,12809,25244
131    ASYNC,8,64,122701009.0,12841,25244
132    ASYNC,8,128,63405355.0,13481,25244
133    ASYNC,8,256,33752441.666666664,14761,25244
134