summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2017-06-15 03:58:32 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-19 11:35:04 -0400
commit571c7c2fb37176671d55f004df4ed1055f7e8cb1 (patch)
treeea249cf7e46a86bb5b70f6478886b8b45ccc6e01 /drivers/gpu/nvgpu
parentd84d7f8694562628e1ab41fd09d08b68f59e0b30 (diff)
gpu: nvgpu: add a simple time API
Add nvgpu_current_time_ms() to return a time from a monotonic clock source in milliseconds. The start time is unspecified; this API is meant to be used for duration measurements. Jira NVGPU-83 Change-Id: I135c8ee88283149422a68d5fa859241eebbd6459 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1503001 Reviewed-by: Deepak Nibade <dnibade@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/common/linux/timers.c12
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/timers.h7
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c
index efd04557..140ae80e 100644
--- a/drivers/gpu/nvgpu/common/linux/timers.c
+++ b/drivers/gpu/nvgpu/common/linux/timers.c
@@ -229,3 +229,15 @@ void nvgpu_msleep(unsigned int msecs)
229{ 229{
230 msleep(msecs); 230 msleep(msecs);
231} 231}
232
233/**
234 * nvgpu_current_time_ms - Time in milliseconds from a monotonic clock.
235 *
236 * Return a clock in millisecond units. The start time of the clock is
237 * unspecified; the time returned can be compared with older ones to measure
238 * durations. The source clock does not jump when the system clock is adjusted.
239 */
240s64 nvgpu_current_time_ms(void)
241{
242 return ktime_to_ms(ktime_get());
243}
diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h
index 0aadd0df..be903e54 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/timers.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h
@@ -17,6 +17,8 @@
17#ifndef __NVGPU_TIMERS_H__ 17#ifndef __NVGPU_TIMERS_H__
18#define __NVGPU_TIMERS_H__ 18#define __NVGPU_TIMERS_H__
19 19
20#include <nvgpu/types.h>
21
20struct gk20a; 22struct gk20a;
21 23
22/* 24/*
@@ -97,4 +99,9 @@ void nvgpu_msleep(unsigned int msecs);
97void nvgpu_usleep_range(unsigned int min_us, unsigned int max_us); 99void nvgpu_usleep_range(unsigned int min_us, unsigned int max_us);
98void nvgpu_udelay(unsigned int usecs); 100void nvgpu_udelay(unsigned int usecs);
99 101
102/*
103 * Timekeeping.
104 */
105s64 nvgpu_current_time_ms(void);
106
100#endif 107#endif