From f2fcbe7ccf5ad0f87e55c6799177660b36f6f527 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 6 Oct 2023 14:01:08 +0800 Subject: [PATCH] testing: Swith up_perf_xxx to perf_xxx follow up the the kernel change: https://github.com/apache/nuttx/pull/10834 Signed-off-by: Xiang Xiao Signed-off-by: TaiJu Wu --- system/cachespeed/cachespeed_main.c | 4 ++-- testing/arch_libc/arch_libc_test_main.c | 12 ++++++------ testing/osperf/osperf.c | 15 ++++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/system/cachespeed/cachespeed_main.c b/system/cachespeed/cachespeed_main.c index 83386f837..711a4af9d 100644 --- a/system/cachespeed/cachespeed_main.c +++ b/system/cachespeed/cachespeed_main.c @@ -47,11 +47,11 @@ do \ { \ struct timespec ts; \ - up_perf_convert(cost, &ts); \ + perf_convert(cost, &ts); \ cost = ts.tv_sec * 1000000000 + ts.tv_nsec; \ } while (0) - #define TIMESTAMP(x) (x) = up_perf_gettime() + #define TIMESTAMP(x) (x) = perf_gettime() #else #define TIME time_t diff --git a/testing/arch_libc/arch_libc_test_main.c b/testing/arch_libc/arch_libc_test_main.c index d9585b3ce..770e2773c 100644 --- a/testing/arch_libc/arch_libc_test_main.c +++ b/testing/arch_libc/arch_libc_test_main.c @@ -187,19 +187,19 @@ int arch_libc_test_strcpy(void) * Name: arch_libc_strcpy_speed_offset ****************************************************************************/ -uint32_t arch_libc_strcpy_speed_offset(int dst_offset, int src_offset) +clock_t arch_libc_strcpy_speed_offset(int dst_offset, int src_offset) { FAR char *dest; FAR char *src; - uint32_t start; - uint32_t end; + clock_t start; + clock_t end; init_short_test_str(dst_offset, src_offset); dest = g_test_dst_str + dst_offset; src = g_test_src_str + src_offset; - start = up_perf_gettime(); + start = perf_gettime(); strcpy(dest, src); - end = up_perf_gettime(); + end = perf_gettime(); return end - start; } @@ -212,7 +212,7 @@ int arch_libc_strcpy_speed(void) { int dest_off; int src_off; - uint32_t cycles = 0; + clock_t cycles = 0; for (dest_off = 0; dest_off <= 4; dest_off++) { diff --git a/testing/osperf/osperf.c b/testing/osperf/osperf.c index f04c09983..f44ee31eb 100644 --- a/testing/osperf/osperf.c +++ b/testing/osperf/osperf.c @@ -44,8 +44,8 @@ struct performance_time_s { - size_t start; - size_t end; + clock_t start; + clock_t end; }; struct performance_thread_s @@ -109,18 +109,18 @@ static int performance_thread_create(FAR void *(*entry)(FAR void *), static void performance_start(FAR struct performance_time_s *result) { - result->start = up_perf_gettime(); + result->start = perf_gettime(); } static void performance_end(FAR struct performance_time_s *result) { - result->end = up_perf_gettime(); + result->end = perf_gettime(); } static size_t performance_gettime(FAR struct performance_time_s *result) { struct timespec ts; - up_perf_convert(result->end - result->start, &ts); + perf_convert(result->end - result->start, &ts); return ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec; } @@ -217,7 +217,7 @@ static size_t context_switch_performance(void) static void work_handle(void *arg) { - FAR struct performance_time_s *time = ((FAR void **)arg)[0]; + FAR struct performance_time_s *time = ((FAR void **)arg)[2]; FAR sem_t *sem = ((void **)arg)[1]; performance_end(time); sem_post(sem); @@ -233,7 +233,8 @@ static size_t hpwork_performance(void) FAR void *args = (void *[]) { (FAR void *)&work, - (FAR void *)&sem + (FAR void *)&sem, + (FAR void *)&result }; memset(&work, 0, sizeof(work));