Merge branch 'feature/use_cpu_time_for_tests' into 'master'

Cache compensated timer

See merge request espressif/esp-idf!6087
This commit is contained in:
Angus Gratton
2019-11-20 08:33:27 +08:00
33 changed files with 1151 additions and 35 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ else()
# driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t
# app_update is added here because cpu_start.c uses esp_ota_get_app_description() function.
set(priv_requires app_trace app_update bootloader_support log mbedtls nvs_flash pthread
spi_flash vfs wpa_supplicant espcoredump esp_common esp_wifi)
spi_flash vfs wpa_supplicant espcoredump esp_common esp_wifi perfmon)
set(fragments linker.lf ld/esp32_fragments.lf)
idf_component_register(SRCS "${srcs}"
+1
View File
@@ -188,6 +188,7 @@ SECTIONS
*(.gnu.linkonce.s2.*)
*(.jcr)
mapping[dram0_data]
_data_end = ABSOLUTE(.);
@@ -45,7 +45,7 @@ typedef struct xtensa_perfmon_masks {
} xtensa_perfmon_masks_t;
// Maximum amount of performance counter events
#define MAX_PERFMON_EVENTS 118
#define MAX_PERFMON_EVENTS 119
/**
* @brief Select value description table
@@ -71,4 +71,4 @@ extern const uint32_t xtensa_perfmon_select_mask_all[MAX_PERFMON_EVENTS * 2];
#ifdef __cplusplus
}
#endif
#endif // _xtensa_perfmon_masks_H_
#endif // _xtensa_perfmon_masks_H_
@@ -192,6 +192,7 @@ const uint32_t xtensa_perfmon_select_mask_all[MAX_PERFMON_EVENTS * 2] = {
XTPERF_CNT_INSN, XTPERF_MASK_INSN_LOOP_BEG,
XTPERF_CNT_INSN, XTPERF_MASK_INSN_LOOP_END,
XTPERF_CNT_INSN, XTPERF_MASK_INSN_NON_BRANCH,
XTPERF_CNT_INSN, XTPERF_MASK_INSN_ALL,
XTPERF_CNT_D_STALL, XTPERF_MASK_D_STALL_STORE_BUF_FULL,
XTPERF_CNT_D_STALL, XTPERF_MASK_D_STALL_STORE_BUF_CONFLICT,
XTPERF_CNT_D_STALL, XTPERF_MASK_D_STALL_CACHE_MISS,
+2 -6
View File
@@ -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)
-2
View File
@@ -1,3 +1 @@
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive
COMPONENT_ADD_LDFRAGMENTS += linker.lf
-9
View File
@@ -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)
+3 -4
View File
@@ -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