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 <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2082015
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2019-03-26 13:32:40 -04:00
committed by mobile promotions
parent 55be80e697
commit 91669ac61e
2 changed files with 8 additions and 2 deletions

View File

@@ -26,6 +26,7 @@
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
#include <time.h>
#include <unit/io.h>
#include <unit/core.h>
@@ -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;