benchmarks: timing_info: Add hooks in the kernel for userspace.
Added sampling hooks in the kernel needed for userspace benchmarks. Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
parent
c9e3c938e6
commit
a8b0b0d5e8
3 changed files with 35 additions and 7 deletions
|
@ -93,6 +93,14 @@ SECTION_FUNC(TEXT,_arm_userspace_enter)
|
|||
/* restore r0 */
|
||||
mov r0, lr
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
stm sp!,{r0-r3} /* Save regs r0 to r4 on stack */
|
||||
push {lr}
|
||||
bl read_timer_end_of_userspace_enter
|
||||
pop {lr}
|
||||
ldm sp!,{r0-r3} /* Load back regs ro to r4 */
|
||||
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
||||
|
||||
/* change processor mode to unprivileged */
|
||||
mrs ip, CONTROL
|
||||
orrs ip, ip, #1
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
/* #include <kernel_structs.h> */
|
||||
|
||||
u64_t __noinit __start_swap_time;
|
||||
u64_t __noinit __end_swap_time;
|
||||
u64_t __noinit __start_intr_time;
|
||||
u64_t __noinit __end_intr_time;
|
||||
u64_t __noinit __start_tick_time;
|
||||
u64_t __noinit __end_tick_time;
|
||||
u64_t __start_swap_time;
|
||||
u64_t __end_swap_time;
|
||||
u64_t __start_intr_time;
|
||||
u64_t __end_intr_time;
|
||||
u64_t __start_tick_time;
|
||||
u64_t __end_tick_time;
|
||||
u64_t __end_drop_to_usermode_time;
|
||||
|
||||
/* location of the time stamps*/
|
||||
u32_t __read_swap_end_time_value;
|
||||
|
@ -47,7 +48,7 @@ u64_t __common_var_swap_end_time;
|
|||
void read_timer_start_of_swap(void)
|
||||
{
|
||||
TIMING_INFO_PRE_READ();
|
||||
__start_swap_time = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
||||
__start_swap_time = (u32_t) TIMING_INFO_OS_GET_TIME();
|
||||
}
|
||||
|
||||
void read_timer_end_of_swap(void)
|
||||
|
@ -86,4 +87,10 @@ void read_timer_end_of_tick_handler(void)
|
|||
__end_tick_time = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
||||
}
|
||||
|
||||
void read_timer_end_of_userspace_enter(void)
|
||||
{
|
||||
TIMING_INFO_PRE_READ();
|
||||
__end_drop_to_usermode_time = (u32_t) TIMING_INFO_GET_TIMER_VALUE();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARM */
|
||||
|
|
|
@ -223,5 +223,18 @@ SECTION_FUNC(TEXT, _x86_userspace_enter)
|
|||
push $USER_CODE_SEG /* CS */
|
||||
push $_thread_entry /* EIP */
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
/* Save the eax and edx registers before reading the time stamp
|
||||
* once done pop the values.
|
||||
*/
|
||||
push %eax
|
||||
push %edx
|
||||
rdtsc
|
||||
mov %eax,__end_drop_to_usermode_time
|
||||
mov %edx,__end_drop_to_usermode_time+4
|
||||
pop %edx
|
||||
pop %eax
|
||||
#endif
|
||||
|
||||
/* We will land in _thread_entry() in user mode after this */
|
||||
iret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue