tests: benchmarks: timing_info: Enable benchmarks for nios2.

This patch provides support needed to get timing related
information from nios2 based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
Adithya Baglody 2018-07-23 13:57:06 +05:30 committed by Anas Nashif
commit 79f65d4db7
6 changed files with 111 additions and 1 deletions

View file

@ -22,6 +22,33 @@ GTEXT(_k_neg_eagain)
*/
SECTION_FUNC(exception.other, __swap)
#ifdef CONFIG_EXECUTION_BENCHMARKING
/* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel)
/* Get the pointer to kernel->current */
ldw r11, _kernel_offset_to_current(r10)
stw r2, _thread_offset_to_r16(r11)
stw r3, _thread_offset_to_r17(r11)
stw r4, _thread_offset_to_r18(r11)
stw ra, _thread_offset_to_ra(r11)
stw sp, _thread_offset_to_sp(r11)
call read_timer_start_of_swap
/* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel)
/* Get the pointer to kernel->current */
ldw r11, _kernel_offset_to_current(r10)
ldw r2, _thread_offset_to_r16(r11)
ldw r3, _thread_offset_to_r17(r11)
ldw r4, _thread_offset_to_r18(r11)
ldw ra, _thread_offset_to_ra(r11)
ldw sp, _thread_offset_to_sp(r11)
#endif
/* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel)
@ -114,6 +141,33 @@ no_unlock:
#else
wrctl status, r3
#endif
#ifdef CONFIG_EXECUTION_BENCHMARKING
/* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel)
ldw r11, _kernel_offset_to_current(r10)
stw r2, _thread_offset_to_r16(r11)
stw r3, _thread_offset_to_r17(r11)
stw r4, _thread_offset_to_r18(r11)
stw ra, _thread_offset_to_ra(r11)
stw sp, _thread_offset_to_sp(r11)
call read_timer_end_of_swap
/* Get a reference to _kernel in r10 */
movhi r10, %hi(_kernel)
ori r10, r10, %lo(_kernel)
/* Get the pointer to kernel->current */
ldw r11, _kernel_offset_to_current(r10)
ldw r2, _thread_offset_to_r16(r11)
ldw r3, _thread_offset_to_r17(r11)
ldw r4, _thread_offset_to_r18(r11)
ldw ra, _thread_offset_to_ra(r11)
ldw sp, _thread_offset_to_sp(r11)
#endif
ret