diff options
author | Petri Latvala <petri.latvala@intel.com> | 2018-08-08 14:06:58 +0300 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2018-08-09 10:33:24 +0300 |
commit | 0c57495e924b25acbaa58ec41ff03aba38183d96 (patch) | |
tree | 688e66b937f4ae7852bd87ac1da60235ed1de815 /lib/igt_core.c | |
parent | 6a02badf89dfc09776117b90f1b7c36b02bfe54c (diff) |
lib: Export igt_gettime and igt_time_elapsed
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r-- | lib/igt_core.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c index d3385756..c52c0818 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -403,9 +403,8 @@ void igt_kmsg(const char *format, ...) #define time_valid(ts) ((ts)->tv_sec || (ts)->tv_nsec) -static double -time_elapsed(struct timespec *then, - struct timespec* now) +double igt_time_elapsed(struct timespec *then, + struct timespec *now) { double elapsed = -1.; @@ -417,7 +416,7 @@ time_elapsed(struct timespec *then, return elapsed; } -static int gettime(struct timespec *ts) +int igt_gettime(struct timespec *ts) { memset(ts, 0, sizeof(*ts)); errno = 0; @@ -450,7 +449,7 @@ uint64_t igt_nsec_elapsed(struct timespec *start) { struct timespec now; - gettime(&now); + igt_gettime(&now); if ((start->tv_sec | start->tv_nsec) == 0) { *start = now; return 0; @@ -811,7 +810,7 @@ out: igt_install_exit_handler(common_exit_handler); if (!test_with_subtests) - gettime(&subtest_time); + igt_gettime(&subtest_time); for (i = 0; (optind + i) < *argc; i++) argv[i + 1] = argv[optind + i]; @@ -940,7 +939,7 @@ bool __igt_run_subtest(const char *subtest_name) _igt_log_buffer_reset(); - gettime(&subtest_time); + igt_gettime(&subtest_time); return (in_subtest = subtest_name); } @@ -985,15 +984,15 @@ static void exit_subtest(const char *result) { struct timespec now; - gettime(&now); + igt_gettime(&now); igt_info("%sSubtest %s: %s (%.3fs)%s\n", (!__igt_plain_output) ? "\x1b[1m" : "", - in_subtest, result, time_elapsed(&subtest_time, &now), + in_subtest, result, igt_time_elapsed(&subtest_time, &now), (!__igt_plain_output) ? "\x1b[0m" : ""); fflush(stdout); if (stderr_needs_sentinel) fprintf(stderr, "Subtest %s: %s (%.3fs)\n", - in_subtest, result, time_elapsed(&subtest_time, &now)); + in_subtest, result, igt_time_elapsed(&subtest_time, &now)); igt_terminate_spin_batches(); @@ -1484,7 +1483,7 @@ void igt_exit(void) struct timespec now; const char *result; - gettime(&now); + igt_gettime(&now); switch (igt_exitcode) { case IGT_EXIT_SUCCESS: @@ -1501,7 +1500,7 @@ void igt_exit(void) } printf("%s (%.3fs)\n", - result, time_elapsed(&subtest_time, &now)); + result, igt_time_elapsed(&subtest_time, &now)); } exit(igt_exitcode); |