freertos/xtensa_context: added conditional compiling option around isr cycle measurement

It is possible to enable and disable the isr time measurement on context save and
it related test via menuconfig by the new option: FREERTOS_ISR_STATS
This commit is contained in:
Felipe Neves 2019-10-16 11:21:52 -03:00
parent 346b12e29a
commit 64f918bd70
3 changed files with 21 additions and 1 deletions

View file

@ -435,9 +435,18 @@ menu "FreeRTOS"
would be checked to be in compliance with Vanilla FreeRTOS.
e.g Calling port*_CRITICAL from ISR context would cause assert failure
<<<<<<< HEAD
config FREERTOS_DEBUG_OCDAWARE
bool
help
Hidden option, gets selected by CONFIG_ESPxx_DEBUG_OCDAWARE
=======
config FREERTOS_ISR_STATS
bool "Enable cycle measurement inside ISR"
default n
help
If enabled, every context save operation will have its time
spent in cycles, measured.
>>>>>>> 0f141ba8a... freertos/xtensa_context: added conditional compiling option around isr cycle measurement
endmenu

View file

@ -13,6 +13,8 @@
#include "soc/cpu.h"
#include "test_utils.h"
#ifdef CONFIG_FREERTOS_ISR_STATS
static SemaphoreHandle_t end_sema;
extern uint32_t isr_enter_spent_time_cycles;
volatile static uint32_t isr_enter_spent_time_cycles_copy;
@ -49,7 +51,7 @@ static void test_task(void *arg) {
nested1();
}
TEST_CASE("isr handling time test", "[freertos]")
TEST_CASE("isr handling time test", "[freertos] [ignore]")
{
end_sema = xSemaphoreCreateBinary();
TEST_ASSERT(end_sema != NULL);
@ -59,3 +61,4 @@ TEST_CASE("isr handling time test", "[freertos]")
TEST_PERFORMANCE_LESS_THAN(SPILL_REG_CYCLES, "%d cycles" ,isr_enter_spent_time_cycles_copy);
}
#endif

View file

@ -62,11 +62,14 @@ NOERROR: .error "C preprocessor needed for this file: make sure its filename\
ISR overhead statistics data:
--------------------------------------------------------------------------------
*/
#ifdef CONFIG_FREERTOS_ISR_STATS
.data
.align 16
.global isr_enter_spent_time_cycles
isr_enter_spent_time_cycles:
.word 0
#endif
.text
@ -191,16 +194,21 @@ _not_l1:
wsr a2, PS
rsync
#ifdef CONFIG_FREERTOS_ISR_STATS
rsr a2, CCOUNT
#endif
addi sp, sp, XT_STK_FRMSZ /* go back to spill register region */
SPILL_ALL_WINDOWS /* place the live register windows there */
addi sp, sp, -XT_STK_FRMSZ /* return the current stack pointer and proceed with conext save*/
#ifdef CONFIG_FREERTOS_ISR_STATS
rsr a3, CCOUNT
sub a3, a3, a2
movi a2, isr_enter_spent_time_cycles
s32i a3,a2,0
#endif //CONFIG_ISR_TIMING_STATS
#endif
l32i a12, sp, XT_STK_TMP0 /* temp. save stuff in stack frame */