zephyr/samples/basic/hash_map
Marek Matej 3776402f40 boards: xtensa: esp32 board split
Remove virtual esp32 board and replace it with the
real word boards:

- esp32_devkitc_wroom
- esp32_devkitc_wrover (with PSRAM option)

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-25 18:12:33 +02:00
..
src samples, tests, boards: Switch main return type from void to int 2023-04-14 07:49:41 +09:00
CMakeLists.txt samples: lib: os: hash_map: add Hashmap sample code 2023-02-22 19:14:05 +01:00
Kconfig tests/samples: Replace minimal libc malloc configs with common ones 2023-04-27 20:17:24 +09:00
README.rst samples: lib: os: hash_map: add Hashmap sample code 2023-02-22 19:14:05 +01:00
prj.conf tests,samples: Fix picolibc malloc arena settings 2023-05-09 01:29:16 +09:00
sample.yaml boards: xtensa: esp32 board split 2023-07-25 18:12:33 +02:00

README.rst

.. _system_hashmap:

System Hashmap
##############

Overview
********

This is a simple example that repeatedly

* inserts up to ``CONFIG_TEST_LIB_HASH_MAP_MAX_ENTRIES``
* replaces up to the same number that were previously inserted
* removes all previously inserted keys

Building
********

This application can be built on native_posix as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/basic/hash_map
   :host-os: unix
   :board: native_posix
   :goals: build
   :compact:

To build for another board, change "native_posix" above to that board's name.

Additionally, it is possible to use one of the other Hashmap implementations by specifying

* ``CONFIG_SYS_HASH_MAP_CHOICE_SC=y`` (Separate Chaining)
* ``CONFIG_SYS_HASH_MAP_CHOICE_OA_LP=y`` (Open Addressing / Linear Probe)
* ``CONFIG_SYS_HASH_MAP_CHOICE_CXX=y`` (C Wrapper around the C++ ``std::unordered_map``)

To stress the Hashmap implementation, adjust ``CONFIG_TEST_LIB_HASH_MAP_MAX_ENTRIES``.

Running
*******

Run ``build/zephyr/zephyr.exe``

Sample Output
*************

.. code-block:: console

    System Hashmap sample

    [00:00:11.000,000] <inf> hashmap_sample: n_insert: 118200 n_remove: 295500 n_replace: 329061 n_miss: 0 n_error: 0 max_size: 118200
    [00:00:11.010,000] <inf> hashmap_sample: success