From 550c0ef2342777b9d0fc924101deb0e4f16af11d Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Mon, 23 Sep 2019 11:43:34 +0800 Subject: [PATCH] vfs: use ccomp timer in performance test --- components/vfs/test/CMakeLists.txt | 8 ++------ components/vfs/test/component.mk | 2 -- components/vfs/test/linker.lf | 9 --------- components/vfs/test/test_vfs_fd.c | 7 +++---- 4 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 components/vfs/test/linker.lf diff --git a/components/vfs/test/CMakeLists.txt b/components/vfs/test/CMakeLists.txt index 7272221db5..da9ed3c35a 100644 --- a/components/vfs/test/CMakeLists.txt +++ b/components/vfs/test/CMakeLists.txt @@ -1,7 +1,3 @@ -set(srcdirs ".") - -idf_component_register(SRC_DIRS ${srcdirs} +idf_component_register(SRC_DIRS "." INCLUDE_DIRS . - REQUIRES unity test_utils vfs fatfs spiffs - LDFRAGMENTS linker.lf - ) + REQUIRES unity test_utils vfs fatfs spiffs) diff --git a/components/vfs/test/component.mk b/components/vfs/test/component.mk index 5650ced1ee..ce464a212a 100644 --- a/components/vfs/test/component.mk +++ b/components/vfs/test/component.mk @@ -1,3 +1 @@ COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive - -COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/vfs/test/linker.lf b/components/vfs/test/linker.lf deleted file mode 100644 index b2313955bd..0000000000 --- a/components/vfs/test/linker.lf +++ /dev/null @@ -1,9 +0,0 @@ -[mapping:vfs] -archive: libvfs.a -entries: - vfs:esp_vfs_open (noflash) - vfs:esp_vfs_write (noflash) - vfs:esp_vfs_close (noflash) - vfs:get_vfs_for_fd (noflash) - vfs:get_vfs_for_path (noflash) - vfs:translate_path (noflash) diff --git a/components/vfs/test/test_vfs_fd.c b/components/vfs/test/test_vfs_fd.c index 75be13a654..639ec417b1 100644 --- a/components/vfs/test/test_vfs_fd.c +++ b/components/vfs/test/test_vfs_fd.c @@ -24,6 +24,7 @@ #include "unity.h" #include "esp_log.h" #include "test_utils.h" +#include "ccomp_timer.h" #define VFS_PREF1 "/vfs1" #define VFS_PREF2 "/vfs2" @@ -243,7 +244,7 @@ TEST_CASE("Open & write & close through VFS passes performance test", "[vfs]") TEST_ESP_OK( esp_vfs_register(VFS_PREF1, &desc, NULL) ); - const int64_t begin = esp_timer_get_time(); + ccomp_timer_start(); const int iter_count = 5000; for (int i = 0; i < iter_count; ++i) { @@ -255,9 +256,7 @@ TEST_CASE("Open & write & close through VFS passes performance test", "[vfs]") TEST_ASSERT_NOT_EQUAL(close(fd), -1); } - // esp_vfs_open, esp_vfs_write and esp_vfs_close need to be in IRAM for performance test to pass - - const int64_t time_diff_us = esp_timer_get_time() - begin; + const int64_t time_diff_us = ccomp_timer_stop(); const int ns_per_iter = (int) (time_diff_us * 1000 / iter_count); TEST_ESP_OK( esp_vfs_unregister(VFS_PREF1) ); #ifdef CONFIG_SPIRAM