Skip to content

Commit

Permalink
Merge branch 'feature/optimize_fatfs_on_sdmmc' into 'master'
Browse files Browse the repository at this point in the history
feat(examples/storage): update perf benchmark example

Closes IDF-8420

See merge request espressif/esp-idf!27678
  • Loading branch information
haberturdeur committed Apr 9, 2024
2 parents 0631176 + 0c99375 commit f5d4957
Show file tree
Hide file tree
Showing 13 changed files with 839 additions and 536 deletions.
309 changes: 181 additions & 128 deletions examples/storage/perf_benchmark/README.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/storage/perf_benchmark/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
idf_component_register(SRCS "main.c" "tests.c"
idf_component_register(SRCS "perf_benchmark_example_main.c" "perf_benchmark_example_tests.c"
"perf_benchmark_example_sd_utils.c"
INCLUDE_DIRS ".")
58 changes: 56 additions & 2 deletions examples/storage/perf_benchmark/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
menu "Performance Benchmark Example Configuration"
config EXAMPLE_TARGET_RW_SIZE
int "Target size for read/write (bytes)"
default 65536
help
This is the target size used for the benchmark,
it represents how much data will be transferred in each test.
(The actual size of the allocated buffer will be larger for "more than target size" cases.)
The test will test will show the performance of reading and writing
of both slightly more and slightly less than this size as well.
This will greatly affect the performance of the benchmark.
In general, the larger the rw size, the better the performance.
For FATFS, the best performance is achieved when the rw size
matches the cluster size or is at least a multiple of the sector size.

config EXAMPLE_TEST_TRIES
int "Number of test tries"
default 10
help
The number of times to run the benchmark.
The average value will be displayed.

config EXAMPLE_USE_MEGABYTES
bool "Use megabytes instead of megabits"
config EXAMPLE_USE_BYTES
bool "Use bytes instead of bits"
default y
help
If this config item is set, the IO speed will be displayed in megabytes per second
Expand All @@ -28,12 +48,29 @@ menu "Performance Benchmark Example Configuration"
help
If this config item is set, FATFS will be tested.

config EXAMPLE_FATFS_SPIFLASH_CLUSTER_SIZE
depends on EXAMPLE_TEST_SPIFLASH_FATFS
int "Cluster size for FATFS on internal flash"
default EXAMPLE_TARGET_RW_SIZE
help
The cluster size of the FATFS filesystem.
The cluster size must be a multiple of the sector size.
The default value is the same as the target read/write size.
The larger the cluster size, the better the performance,
but the more space will be wasted on the storage medium.

config EXAMPLE_TEST_SPIFLASH_SPIFFS
bool "Test SPIFFS"
default y
help
If this config item is set, SPIFFS will be tested.

config EXAMPLE_TEST_SPIFLASH_LITTLEFS
bool "Test LittleFS"
default y
help
If this config item is set, LittleFS will be tested.

endmenu # "Internal flash test config"

config EXAMPLE_TEST_SD_CARD
Expand Down Expand Up @@ -74,6 +111,23 @@ menu "Performance Benchmark Example Configuration"
help
If this config item is set, FATFS will be tested.

config EXAMPLE_FATFS_SD_CARD_CLUSTER_SIZE
depends on EXAMPLE_TEST_SD_CARD_FATFS
int "Cluster size for FATFS on SD card"
default EXAMPLE_TARGET_RW_SIZE
help
The cluster size of the FATFS filesystem.
The cluster size must be a multiple of the sector size.
The default value is the same as the target read/write size.
The larger the cluster size, the better the performance,
but the more space will be wasted on the storage medium.

config EXAMPLE_TEST_SD_CARD_LITTLEFS
bool "Test LittleFS"
default y
help
If this config item is set, LittleFS will be tested.

choice EXAMPLE_SD_CARD_FREQ_PICKER
prompt "SD card frequency"
default EXAMPLE_SD_FREQ_HIGHSPEED if EXAMPLE_USE_SDMMC
Expand Down
3 changes: 3 additions & 0 deletions examples/storage/perf_benchmark/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## IDF Component Manager Manifest File
dependencies:
joltwallet/littlefs: "^1.14.1"
Loading

0 comments on commit f5d4957

Please sign in to comment.