From 91669ac61ed757eb7e825bd02e03a2a4ea1ab436 Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Tue, 26 Mar 2019 13:32:40 -0400 Subject: [PATCH] gpu: nvgpu: unit: track time for test modules When run with '-v' option, the unit tests will include the execution time for each test module in seconds. E.g. [C] Module completed: posix_bitops (execution time: 0.607291) Update unit.sh to run with -v option on target to get data for GVS runs if tests start timing out. Change-Id: I2a38ac458c5a5809777df33635e271e4dc9727de Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/2082015 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Nicolas Benech Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/src/exec.c | 8 +++++++- userspace/unit.sh | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/userspace/src/exec.c b/userspace/src/exec.c index 8c9233518..6fd3e7eab 100644 --- a/userspace/src/exec.c +++ b/userspace/src/exec.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -57,6 +58,8 @@ static void *core_exec_module(void *module_param) unsigned int i; struct unit_module *module = (struct unit_module *) module_param; struct gk20a *g; + clock_t begin; + double time_spent; g = module->fw->nvgpu.nvgpu_posix_probe(); @@ -68,6 +71,7 @@ static void *core_exec_module(void *module_param) } core_vbs(module->fw, 1, "Execing module: %s\n", module->name); + begin = clock(); thread_local_module = module; @@ -97,7 +101,9 @@ static void *core_exec_module(void *module_param) module->fw->nvgpu.nvgpu_posix_cleanup(g); - core_vbs(module->fw, 1, "Module completed: %s\n", module->name); + time_spent = (double)(clock() - begin) / CLOCKS_PER_SEC; + core_vbs(module->fw, 1, "Module completed: %s (execution time: %f)\n", + module->name, time_spent); thread_exit: sem_post(&unit_thread_semaphore); return NULL; diff --git a/userspace/unit.sh b/userspace/unit.sh index db762af7e..76dda7e8b 100755 --- a/userspace/unit.sh +++ b/userspace/unit.sh @@ -34,7 +34,7 @@ if [ -f nvgpu_unit ]; then # target, so use that dir structure LD_LIBRARY_PATH=".:units" cores=$(cat /proc/cpuinfo |grep processor |wc -l) - NVGPU_UNIT="./nvgpu_unit --nvtest --unit-load-path units/ --no-color \ + NVGPU_UNIT="./nvgpu_unit -v --nvtest --unit-load-path units/ --no-color \ --num-threads $cores" else # running on host