// SPDX-License-Identifier: MPL-2.0 #include "kernel/tests/test_utils.h" #include "kernel/tests/test_slabs.h" #include "kernel/tests/test_radix.h" #include "kernel/log.h" __attribute__((section(".bss"))) static sh_tsc_TSC_VALUE tsc_value[10000]; static void sort(sh_tsc_TSC_VALUE *array,sh_uint64 n) { for (sh_iter64 i=1;i0 && array[j-1]>key) { array[j]=array[j-1]; j--; } array[j]=key; } } static sh_tsc_TSC_VALUE percentile(sh_tsc_TSC_VALUE *array,sh_uint64 n,sh_uint8 p) { sh_uint64 idx=(n*p)/100; if (idx>=n) idx=n-1; return array[idx]; } SH_STATUS sh_test_compute_print_stats(char* benchname,sh_tsc_TSC_VALUE *tsc_value_array,sh_uint64 array_size) { if (tsc_value_array==SH_NULLPTR || array_size==0) return SH_STATUS_INVALID_PARAMETER; sort(tsc_value_array,array_size); sh_uint64 min=tsc_value_array[0]; sh_uint64 max=tsc_value_array[array_size-1]; sh_uint64 median=tsc_value_array[array_size/2]; sh_uint64 sum=0; for(sh_iter64 i=0;i