timing_info: rename globals
Global variables related to timing information have been renamed to be prefixed with z_arch, with naming arranged in increasing order of specificity. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
2129937d3d
commit
9e1dda8804
12 changed files with 90 additions and 93 deletions
|
@ -4,21 +4,20 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
#include <kernel_internal.h>
|
||||||
|
|
||||||
/* #include <kernel_structs.h> */
|
u64_t z_arch_timing_swap_start;
|
||||||
|
u64_t z_arch_timing_swap_end;
|
||||||
u64_t __start_swap_time;
|
u64_t z_arch_timing_irq_start;
|
||||||
u64_t __end_swap_time;
|
u64_t z_arch_timing_irq_end;
|
||||||
u64_t __start_intr_time;
|
u64_t z_arch_timing_tick_start;
|
||||||
u64_t __end_intr_time;
|
u64_t z_arch_timing_tick_end;
|
||||||
u64_t __start_tick_time;
|
u64_t z_arch_timing_enter_user_mode_end;
|
||||||
u64_t __end_tick_time;
|
|
||||||
u64_t __end_drop_to_usermode_time;
|
|
||||||
|
|
||||||
/* location of the time stamps*/
|
/* location of the time stamps*/
|
||||||
u32_t __read_swap_end_time_value;
|
u32_t z_arch_timing_value_swap_end;
|
||||||
u64_t __common_var_swap_end_time;
|
u64_t z_arch_timing_value_swap_common;
|
||||||
u64_t __temp_start_swap_time;
|
u64_t z_arch_timing_value_swap_temp;
|
||||||
|
|
||||||
#ifdef CONFIG_NRF_RTC_TIMER
|
#ifdef CONFIG_NRF_RTC_TIMER
|
||||||
#include <nrfx.h>
|
#include <nrfx.h>
|
||||||
|
@ -80,18 +79,18 @@ u64_t __temp_start_swap_time;
|
||||||
|
|
||||||
void read_timer_start_of_swap(void)
|
void read_timer_start_of_swap(void)
|
||||||
{
|
{
|
||||||
if (__read_swap_end_time_value == 1U) {
|
if (z_arch_timing_value_swap_end == 1U) {
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__start_swap_time = (u32_t) TIMING_INFO_OS_GET_TIME();
|
z_arch_timing_swap_start = (u32_t) TIMING_INFO_OS_GET_TIME();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_timer_end_of_swap(void)
|
void read_timer_end_of_swap(void)
|
||||||
{
|
{
|
||||||
if (__read_swap_end_time_value == 1U) {
|
if (z_arch_timing_value_swap_end == 1U) {
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__read_swap_end_time_value = 2U;
|
z_arch_timing_value_swap_end = 2U;
|
||||||
__common_var_swap_end_time = (u64_t)TIMING_INFO_OS_GET_TIME();
|
z_arch_timing_value_swap_common = (u64_t)TIMING_INFO_OS_GET_TIME();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,29 +100,29 @@ void read_timer_end_of_swap(void)
|
||||||
void read_timer_start_of_isr(void)
|
void read_timer_start_of_isr(void)
|
||||||
{
|
{
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__start_intr_time = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
z_arch_timing_irq_start = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_timer_end_of_isr(void)
|
void read_timer_end_of_isr(void)
|
||||||
{
|
{
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__end_intr_time = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
z_arch_timing_irq_end = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_timer_start_of_tick_handler(void)
|
void read_timer_start_of_tick_handler(void)
|
||||||
{
|
{
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__start_tick_time = (u32_t)TIMING_INFO_GET_TIMER_VALUE();
|
z_arch_timing_tick_start = (u32_t)TIMING_INFO_GET_TIMER_VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_timer_end_of_tick_handler(void)
|
void read_timer_end_of_tick_handler(void)
|
||||||
{
|
{
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__end_tick_time = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
z_arch_timing_tick_end = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_timer_end_of_userspace_enter(void)
|
void read_timer_end_of_userspace_enter(void)
|
||||||
{
|
{
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__end_drop_to_usermode_time = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
z_arch_timing_enter_user_mode_end = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,8 @@ SECTION_FUNC(TEXT, _interrupt_enter)
|
||||||
pushl %eax
|
pushl %eax
|
||||||
pushl %edx
|
pushl %edx
|
||||||
rdtsc
|
rdtsc
|
||||||
mov %eax, __start_intr_time
|
mov %eax, z_arch_timing_irq_start
|
||||||
mov %edx, __start_intr_time+4
|
mov %edx, z_arch_timing_irq_start+4
|
||||||
pop %edx
|
pop %edx
|
||||||
pop %eax
|
pop %eax
|
||||||
#endif
|
#endif
|
||||||
|
@ -187,8 +187,8 @@ alreadyOnIntStack:
|
||||||
pushl %eax
|
pushl %eax
|
||||||
pushl %edx
|
pushl %edx
|
||||||
rdtsc
|
rdtsc
|
||||||
mov %eax,__end_intr_time
|
mov %eax,z_arch_timing_irq_end
|
||||||
mov %edx,__end_intr_time+4
|
mov %edx,z_arch_timing_irq_end+4
|
||||||
pop %edx
|
pop %edx
|
||||||
pop %eax
|
pop %eax
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -93,8 +93,8 @@ SECTION_FUNC(TEXT, __swap)
|
||||||
push %eax
|
push %eax
|
||||||
push %edx
|
push %edx
|
||||||
rdtsc
|
rdtsc
|
||||||
mov %eax,__start_swap_time
|
mov %eax,z_arch_timing_swap_start
|
||||||
mov %edx,__start_swap_time+4
|
mov %edx,z_arch_timing_swap_start+4
|
||||||
pop %edx
|
pop %edx
|
||||||
pop %eax
|
pop %eax
|
||||||
#endif
|
#endif
|
||||||
|
@ -367,15 +367,12 @@ CROHandlingDone:
|
||||||
popfl
|
popfl
|
||||||
|
|
||||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||||
/* Save the eax and edx registers before reading the time stamp
|
cmp $0x1,z_arch_timing_value_swap_end
|
||||||
* once done pop the values.
|
|
||||||
*/
|
|
||||||
cmp $0x1,__read_swap_end_time_value
|
|
||||||
jne time_read_not_needed
|
jne time_read_not_needed
|
||||||
movw $0x2,__read_swap_end_time_value
|
movw $0x2,z_arch_timing_value_swap_end
|
||||||
read_tsc __common_var_swap_end_time
|
read_tsc z_arch_timing_value_swap_common
|
||||||
pushl __start_swap_time
|
pushl z_arch_timing_swap_start
|
||||||
popl __temp_start_swap_time
|
popl z_arch_timing_value_swap_temp
|
||||||
time_read_not_needed:
|
time_read_not_needed:
|
||||||
#endif
|
#endif
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -394,8 +394,8 @@ SECTION_FUNC(TEXT, z_x86_userspace_enter)
|
||||||
push %eax
|
push %eax
|
||||||
push %edx
|
push %edx
|
||||||
rdtsc
|
rdtsc
|
||||||
mov %eax,__end_drop_to_usermode_time
|
mov %eax,z_arch_timing_enter_user_mode_end
|
||||||
mov %edx,__end_drop_to_usermode_time+4
|
mov %edx,z_arch_timing_enter_user_mode_end+4
|
||||||
pop %edx
|
pop %edx
|
||||||
pop %eax
|
pop %eax
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -206,8 +206,8 @@ void timer_int_handler(void *unused /* parameter is not used */
|
||||||
"pushl %eax\n\t"
|
"pushl %eax\n\t"
|
||||||
"pushl %edx\n\t"
|
"pushl %edx\n\t"
|
||||||
"rdtsc\n\t"
|
"rdtsc\n\t"
|
||||||
"mov %eax, __start_tick_time\n\t"
|
"mov %eax, z_arch_timing_tick_start\n\t"
|
||||||
"mov %edx, __start_tick_time+4\n\t"
|
"mov %edx, z_arch_timing_tick_start+4\n\t"
|
||||||
"pop %edx\n\t"
|
"pop %edx\n\t"
|
||||||
"pop %eax\n\t");
|
"pop %eax\n\t");
|
||||||
#endif
|
#endif
|
||||||
|
@ -293,8 +293,8 @@ void timer_int_handler(void *unused /* parameter is not used */
|
||||||
"pushl %eax\n\t"
|
"pushl %eax\n\t"
|
||||||
"pushl %edx\n\t"
|
"pushl %edx\n\t"
|
||||||
"rdtsc\n\t"
|
"rdtsc\n\t"
|
||||||
"mov %eax, __end_tick_time\n\t"
|
"mov %eax, z_arch_timing_tick_end\n\t"
|
||||||
"mov %edx, __end_tick_time+4\n\t"
|
"mov %edx, z_arch_timing_tick_end+4\n\t"
|
||||||
"pop %edx\n\t"
|
"pop %edx\n\t"
|
||||||
"pop %eax\n\t");
|
"pop %eax\n\t");
|
||||||
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
||||||
|
|
|
@ -280,6 +280,21 @@ extern void z_arch_busy_wait(u32_t usec_to_wait);
|
||||||
*/
|
*/
|
||||||
extern FUNC_NORETURN void z_arch_system_halt(unsigned int reason);
|
extern FUNC_NORETURN void z_arch_system_halt(unsigned int reason);
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||||
|
extern u64_t z_arch_timing_swap_start;
|
||||||
|
extern u64_t z_arch_timing_swap_end;
|
||||||
|
extern u64_t z_arch_timing_irq_start;
|
||||||
|
extern u64_t z_arch_timing_irq_end;
|
||||||
|
extern u64_t z_arch_timing_tick_start;
|
||||||
|
extern u64_t z_arch_timing_tick_end;
|
||||||
|
extern u64_t z_arch_timing_user_mode_end;
|
||||||
|
|
||||||
|
/* FIXME: Document. Temporary storage, seems x86 specific? */
|
||||||
|
extern u32_t z_arch_timing_value_swap_end;
|
||||||
|
extern u64_t z_arch_timing_value_swap_common;
|
||||||
|
extern u64_t z_arch_timing_value_swap_temp;
|
||||||
|
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,8 +23,8 @@ K_MBOX_DEFINE(benchmark_mbox);
|
||||||
K_SEM_DEFINE(mbox_sem, 1, 1);
|
K_SEM_DEFINE(mbox_sem, 1, 1);
|
||||||
|
|
||||||
/* common location for the swap to write the tsc data*/
|
/* common location for the swap to write the tsc data*/
|
||||||
extern u32_t __read_swap_end_time_value;
|
extern u32_t z_arch_timing_value_swap_end;
|
||||||
extern u64_t __common_var_swap_end_time;
|
extern u64_t z_arch_timing_value_swap_common;
|
||||||
|
|
||||||
/* location of the time stamps*/
|
/* location of the time stamps*/
|
||||||
u64_t __msg_q_put_state;
|
u64_t __msg_q_put_state;
|
||||||
|
@ -140,7 +140,7 @@ void msg_passing_bench(void)
|
||||||
|
|
||||||
k_thread_abort(producer_w_cxt_switch_tid);
|
k_thread_abort(producer_w_cxt_switch_tid);
|
||||||
k_thread_abort(producer_wo_cxt_switch_tid);
|
k_thread_abort(producer_wo_cxt_switch_tid);
|
||||||
__msg_q_put_w_cxt_end_time = ((u32_t)__common_var_swap_end_time);
|
__msg_q_put_w_cxt_end_time = ((u32_t)z_arch_timing_value_swap_common);
|
||||||
ARG_UNUSED(msg_status);
|
ARG_UNUSED(msg_status);
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
@ -160,7 +160,7 @@ void msg_passing_bench(void)
|
||||||
2 /*priority*/, 0, 50);
|
2 /*priority*/, 0, 50);
|
||||||
k_sleep(2000); /* make the main thread sleep */
|
k_sleep(2000); /* make the main thread sleep */
|
||||||
k_thread_abort(producer_get_w_cxt_switch_tid);
|
k_thread_abort(producer_get_w_cxt_switch_tid);
|
||||||
__msg_q_get_w_cxt_end_time = (__common_var_swap_end_time);
|
__msg_q_get_w_cxt_end_time = (z_arch_timing_value_swap_common);
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ void msg_passing_bench(void)
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
1 /*priority*/, 0, 0);
|
1 /*priority*/, 0, 0);
|
||||||
k_sleep(1000); /* make the main thread sleep */
|
k_sleep(1000); /* make the main thread sleep */
|
||||||
mbox_sync_put_end_time = (__common_var_swap_end_time);
|
mbox_sync_put_end_time = (z_arch_timing_value_swap_common);
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ void msg_passing_bench(void)
|
||||||
thread_mbox_sync_get_receive, NULL,
|
thread_mbox_sync_get_receive, NULL,
|
||||||
NULL, NULL, 2 /*priority*/, 0, 0);
|
NULL, NULL, 2 /*priority*/, 0, 0);
|
||||||
k_sleep(1000); /* make the main thread sleep */
|
k_sleep(1000); /* make the main thread sleep */
|
||||||
mbox_sync_get_end_time = (__common_var_swap_end_time);
|
mbox_sync_get_end_time = (z_arch_timing_value_swap_common);
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ void thread_producer_msgq_w_cxt_switch(void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
int data_to_send = 5050;
|
int data_to_send = 5050;
|
||||||
|
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__msg_q_put_w_cxt_start_time = (u32_t) TIMING_INFO_OS_GET_TIME();
|
__msg_q_put_w_cxt_start_time = (u32_t) TIMING_INFO_OS_GET_TIME();
|
||||||
k_msgq_put(&benchmark_q, &data_to_send, K_NO_WAIT);
|
k_msgq_put(&benchmark_q, &data_to_send, K_NO_WAIT);
|
||||||
|
@ -363,7 +363,7 @@ void thread_producer_get_msgq_w_cxt_switch(void *p1, void *p2, void *p3)
|
||||||
void thread_consumer_get_msgq_w_cxt_switch(void *p1, void *p2, void *p3)
|
void thread_consumer_get_msgq_w_cxt_switch(void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
producer_get_w_cxt_switch_tid->base.timeout.dticks = _EXPIRED;
|
producer_get_w_cxt_switch_tid->base.timeout.dticks = _EXPIRED;
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
__msg_q_get_w_cxt_start_time = TIMING_INFO_OS_GET_TIME();
|
__msg_q_get_w_cxt_start_time = TIMING_INFO_OS_GET_TIME();
|
||||||
received_data_get = k_msgq_get(&benchmark_q_get,
|
received_data_get = k_msgq_get(&benchmark_q_get,
|
||||||
|
@ -387,7 +387,7 @@ void thread_mbox_sync_put_send(void *p1, void *p2, void *p3)
|
||||||
|
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
mbox_sync_put_start_time = TIMING_INFO_OS_GET_TIME();
|
mbox_sync_put_start_time = TIMING_INFO_OS_GET_TIME();
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
|
|
||||||
status = k_mbox_put(&benchmark_mbox, &tx_msg, 300);
|
status = k_mbox_put(&benchmark_mbox, &tx_msg, 300);
|
||||||
MBOX_CHECK(status);
|
MBOX_CHECK(status);
|
||||||
|
@ -433,7 +433,7 @@ void thread_mbox_sync_get_receive(void *p1, void *p2, void *p3)
|
||||||
.tx_target_thread = K_ANY
|
.tx_target_thread = K_ANY
|
||||||
};
|
};
|
||||||
|
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
mbox_sync_get_start_time = TIMING_INFO_OS_GET_TIME();
|
mbox_sync_get_start_time = TIMING_INFO_OS_GET_TIME();
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,8 @@ void thread_sem1_give_test(void *p1, void *p2, void *p3);
|
||||||
k_tid_t sem0_tid;
|
k_tid_t sem0_tid;
|
||||||
k_tid_t sem1_tid;
|
k_tid_t sem1_tid;
|
||||||
|
|
||||||
extern u64_t __common_var_swap_end_time;
|
extern u64_t z_arch_timing_value_swap_common;
|
||||||
extern u32_t __read_swap_end_time_value;
|
extern u32_t z_arch_timing_value_swap_end;
|
||||||
|
|
||||||
void semaphore_bench(void)
|
void semaphore_bench(void)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ void semaphore_bench(void)
|
||||||
|
|
||||||
|
|
||||||
/* u64_t test_time1 = z_tsc_read(); */
|
/* u64_t test_time1 = z_tsc_read(); */
|
||||||
sem_end_time = (__common_var_swap_end_time);
|
sem_end_time = (z_arch_timing_value_swap_common);
|
||||||
u32_t sem_cycles = sem_end_time - sem_start_time;
|
u32_t sem_cycles = sem_end_time - sem_start_time;
|
||||||
|
|
||||||
sem0_tid = k_thread_create(&my_thread, my_stack_area,
|
sem0_tid = k_thread_create(&my_thread, my_stack_area,
|
||||||
|
@ -77,7 +77,7 @@ void semaphore_bench(void)
|
||||||
2 /*priority*/, 0, 0);
|
2 /*priority*/, 0, 0);
|
||||||
|
|
||||||
k_sleep(1000);
|
k_sleep(1000);
|
||||||
sem_give_end_time = (__common_var_swap_end_time);
|
sem_give_end_time = (z_arch_timing_value_swap_common);
|
||||||
u32_t sem_give_cycles = sem_give_end_time - sem_give_start_time;
|
u32_t sem_give_cycles = sem_give_end_time - sem_give_start_time;
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ void thread_sem1_test(void *p1, void *p2, void *p3)
|
||||||
|
|
||||||
k_sem_give(&sem_bench); /* sync the 2 threads*/
|
k_sem_give(&sem_bench); /* sync the 2 threads*/
|
||||||
|
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
sem_start_time = TIMING_INFO_OS_GET_TIME();
|
sem_start_time = TIMING_INFO_OS_GET_TIME();
|
||||||
k_sem_take(&sem_bench, 10);
|
k_sem_take(&sem_bench, 10);
|
||||||
|
@ -207,7 +207,7 @@ void thread_sem0_give_test(void *p1, void *p2, void *p3)
|
||||||
/* To make sure that the sem give will cause a swap to occur */
|
/* To make sure that the sem give will cause a swap to occur */
|
||||||
k_thread_priority_set(sem1_tid, 1);
|
k_thread_priority_set(sem1_tid, 1);
|
||||||
|
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
sem_give_start_time = TIMING_INFO_OS_GET_TIME();
|
sem_give_start_time = TIMING_INFO_OS_GET_TIME();
|
||||||
k_sem_give(&sem_bench_1);
|
k_sem_give(&sem_bench_1);
|
||||||
|
|
|
@ -19,9 +19,9 @@ char sline[256];
|
||||||
/* FILE *output_file = stdout; */
|
/* FILE *output_file = stdout; */
|
||||||
|
|
||||||
/* location of the time stamps*/
|
/* location of the time stamps*/
|
||||||
extern u32_t __read_swap_end_time_value;
|
extern u32_t z_arch_timing_value_swap_end;
|
||||||
extern u64_t __temp_start_swap_time;
|
extern u64_t z_arch_timing_value_swap_temp;
|
||||||
extern u64_t __common_var_swap_end_time;
|
extern u64_t z_arch_timing_value_swap_common;
|
||||||
|
|
||||||
volatile u64_t thread_abort_end_time;
|
volatile u64_t thread_abort_end_time;
|
||||||
volatile u64_t thread_abort_start_time;
|
volatile u64_t thread_abort_start_time;
|
||||||
|
@ -48,7 +48,7 @@ K_THREAD_STACK_DEFINE(my_stack_area_0, STACK_SIZE);
|
||||||
struct k_thread my_thread;
|
struct k_thread my_thread;
|
||||||
struct k_thread my_thread_0;
|
struct k_thread my_thread_0;
|
||||||
|
|
||||||
u32_t __read_swap_end_time_value_test = 1U;
|
u32_t z_arch_timing_value_swap_end_test = 1U;
|
||||||
u64_t dummy_time;
|
u64_t dummy_time;
|
||||||
u64_t start_time;
|
u64_t start_time;
|
||||||
u64_t test_end_time;
|
u64_t test_end_time;
|
||||||
|
@ -68,9 +68,9 @@ u32_t benchmarking_overhead_swap(void)
|
||||||
"rdtsc\n\t"
|
"rdtsc\n\t"
|
||||||
"mov %eax,start_time\n\t"
|
"mov %eax,start_time\n\t"
|
||||||
"mov %edx,start_time+4\n\t"
|
"mov %edx,start_time+4\n\t"
|
||||||
"cmp $0x1,__read_swap_end_time_value_test\n\t"
|
"cmp $0x1,z_arch_timing_value_swap_end_test\n\t"
|
||||||
"jne time_read_not_needed_test\n\t"
|
"jne time_read_not_needed_test\n\t"
|
||||||
"movw $0x2,__read_swap_end_time_value\n\t"
|
"movw $0x2,z_arch_timing_value_swap_end\n\t"
|
||||||
"pushl %eax\n\t"
|
"pushl %eax\n\t"
|
||||||
"pushl %edx\n\t"
|
"pushl %edx\n\t"
|
||||||
"rdtsc\n\t"
|
"rdtsc\n\t"
|
||||||
|
@ -99,7 +99,7 @@ void test_thread_entry(void *p, void *p1, void *p2)
|
||||||
|
|
||||||
void thread_swap_test(void *p1, void *p2, void *p3)
|
void thread_swap_test(void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
thread_abort_start_time = TIMING_INFO_OS_GET_TIME();
|
thread_abort_start_time = TIMING_INFO_OS_GET_TIME();
|
||||||
k_thread_abort(_current);
|
k_thread_abort(_current);
|
||||||
|
@ -142,20 +142,20 @@ void system_thread_bench(void)
|
||||||
-1 /*priority*/, 0, 0);
|
-1 /*priority*/, 0, 0);
|
||||||
|
|
||||||
k_sleep(1);
|
k_sleep(1);
|
||||||
thread_abort_end_time = (__common_var_swap_end_time);
|
thread_abort_end_time = (z_arch_timing_value_swap_common);
|
||||||
__end_swap_time = __common_var_swap_end_time;
|
z_arch_timing_swap_end = z_arch_timing_value_swap_common;
|
||||||
#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
|
#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
|
||||||
__start_swap_time = __temp_start_swap_time;
|
z_arch_timing_swap_start = z_arch_timing_value_swap_temp;
|
||||||
/* In the rest of ARCHes read_timer_start_of_swap() has already
|
/* In the rest of ARCHes read_timer_start_of_swap() has already
|
||||||
* registered the time-stamp of the start of context-switch in
|
* registered the time-stamp of the start of context-switch in
|
||||||
* __start_swap_time.
|
* z_arch_timing_swap_start.
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
u32_t total_swap_cycles = __end_swap_time - __start_swap_time;
|
u32_t total_swap_cycles = z_arch_timing_swap_end - z_arch_timing_swap_start;
|
||||||
|
|
||||||
/* Interrupt latency*/
|
/* Interrupt latency*/
|
||||||
u64_t local_end_intr_time = __end_intr_time;
|
u64_t local_end_intr_time = z_arch_timing_irq_end;
|
||||||
u64_t local_start_intr_time = __start_intr_time;
|
u64_t local_start_intr_time = z_arch_timing_irq_start;
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* thread create*/
|
/* thread create*/
|
||||||
|
@ -224,8 +224,8 @@ void system_thread_bench(void)
|
||||||
(u32_t) (CYCLES_TO_NS(intr_latency_cycles)));
|
(u32_t) (CYCLES_TO_NS(intr_latency_cycles)));
|
||||||
|
|
||||||
/*tick overhead*/
|
/*tick overhead*/
|
||||||
u32_t tick_overhead_cycles = SUBTRACT_CLOCK_CYCLES(__end_tick_time) -
|
u32_t tick_overhead_cycles = SUBTRACT_CLOCK_CYCLES(z_arch_timing_tick_end) -
|
||||||
SUBTRACT_CLOCK_CYCLES(__start_tick_time);
|
SUBTRACT_CLOCK_CYCLES(z_arch_timing_tick_start);
|
||||||
PRINT_STATS("Tick overhead",
|
PRINT_STATS("Tick overhead",
|
||||||
(u32_t)(tick_overhead_cycles),
|
(u32_t)(tick_overhead_cycles),
|
||||||
(u32_t) (CYCLES_TO_NS(tick_overhead_cycles)));
|
(u32_t) (CYCLES_TO_NS(tick_overhead_cycles)));
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
#include <timestamp.h>
|
#include <timestamp.h>
|
||||||
|
#include <kernel_internal.h>
|
||||||
|
|
||||||
#define CALCULATE_TIME(special_char, profile, name) \
|
#define CALCULATE_TIME(special_char, profile, name) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -201,15 +201,6 @@ void mutex_bench(void);
|
||||||
void msg_passing_bench(void);
|
void msg_passing_bench(void);
|
||||||
void userspace_bench(void);
|
void userspace_bench(void);
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* External variables */
|
|
||||||
extern u64_t __start_swap_time;
|
|
||||||
extern u64_t __end_swap_time;
|
|
||||||
extern u64_t __start_intr_time;
|
|
||||||
extern u64_t __end_intr_time;
|
|
||||||
extern u64_t __start_tick_time;
|
|
||||||
extern u64_t __end_tick_time;
|
|
||||||
/******************************************************************************/
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
#include <syscall_handler.h>
|
#include <syscall_handler.h>
|
||||||
__syscall int k_dummy_syscall(void);
|
__syscall int k_dummy_syscall(void);
|
||||||
|
|
|
@ -20,7 +20,7 @@ K_APPMEM_PARTITION_DEFINE(bench_ptn);
|
||||||
struct k_mem_domain bench_domain;
|
struct k_mem_domain bench_domain;
|
||||||
|
|
||||||
extern char sline[256];
|
extern char sline[256];
|
||||||
extern u64_t __end_drop_to_usermode_time;
|
extern u64_t z_arch_timing_enter_user_mode_end;
|
||||||
|
|
||||||
u32_t drop_to_user_mode_end_time, drop_to_user_mode_start_time;
|
u32_t drop_to_user_mode_end_time, drop_to_user_mode_start_time;
|
||||||
u32_t user_thread_creation_end_time, user_thread_creation_start_time;
|
u32_t user_thread_creation_end_time, user_thread_creation_start_time;
|
||||||
|
@ -105,7 +105,7 @@ void drop_to_user_mode(void)
|
||||||
k_yield();
|
k_yield();
|
||||||
|
|
||||||
drop_to_user_mode_end_time = (u32_t)
|
drop_to_user_mode_end_time = (u32_t)
|
||||||
SUBTRACT_CLOCK_CYCLES(__end_drop_to_usermode_time);
|
SUBTRACT_CLOCK_CYCLES(z_arch_timing_enter_user_mode_end);
|
||||||
|
|
||||||
u32_t tmp_start_time =
|
u32_t tmp_start_time =
|
||||||
SUBTRACT_CLOCK_CYCLES(drop_to_user_mode_start_time);
|
SUBTRACT_CLOCK_CYCLES(drop_to_user_mode_start_time);
|
||||||
|
|
|
@ -18,11 +18,6 @@ extern K_THREAD_STACK_DEFINE(my_stack_area_0, STACK_SIZE);
|
||||||
extern struct k_thread my_thread;
|
extern struct k_thread my_thread;
|
||||||
extern struct k_thread my_thread_0;
|
extern struct k_thread my_thread_0;
|
||||||
|
|
||||||
/* u64_t thread_yield_start_time[1000]; */
|
|
||||||
/* u64_t thread_yield_end_time[1000]; */
|
|
||||||
/* location of the time stamps*/
|
|
||||||
extern u32_t __read_swap_end_time_value;
|
|
||||||
extern u64_t __common_var_swap_end_time;
|
|
||||||
extern char sline[];
|
extern char sline[];
|
||||||
|
|
||||||
extern u64_t thread_sleep_start_time;
|
extern u64_t thread_sleep_start_time;
|
||||||
|
@ -53,12 +48,12 @@ void yield_bench(void)
|
||||||
0 /*priority*/, 0, 0);
|
0 /*priority*/, 0, 0);
|
||||||
|
|
||||||
/*read the time of start of the sleep till the swap happens */
|
/*read the time of start of the sleep till the swap happens */
|
||||||
__read_swap_end_time_value = 1U;
|
z_arch_timing_value_swap_end = 1U;
|
||||||
|
|
||||||
TIMING_INFO_PRE_READ();
|
TIMING_INFO_PRE_READ();
|
||||||
thread_sleep_start_time = TIMING_INFO_OS_GET_TIME();
|
thread_sleep_start_time = TIMING_INFO_OS_GET_TIME();
|
||||||
k_sleep(1000);
|
k_sleep(1000);
|
||||||
thread_sleep_end_time = ((u32_t)__common_var_swap_end_time);
|
thread_sleep_end_time = ((u32_t)z_arch_timing_value_swap_common);
|
||||||
|
|
||||||
u32_t yield_cycles = (thread_end_time - thread_start_time) / 2000U;
|
u32_t yield_cycles = (thread_end_time - thread_start_time) / 2000U;
|
||||||
u32_t sleep_cycles = thread_sleep_end_time - thread_sleep_start_time;
|
u32_t sleep_cycles = thread_sleep_end_time - thread_sleep_start_time;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue