summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/timers.c
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2018-05-17 08:04:51 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-24 07:37:24 -0400
commita4d1a4830e13caecf5f39f15a716f3bd63f37c34 (patch)
tree476409c163c1bd2942bf15cf2665c85435caaec4 /drivers/gpu/nvgpu/common/linux/timers.c
parentb65197c26d0bc014297b79f1063d7ba68091ef83 (diff)
gpu: nvgpu: add nvgpu_current_time_ns()
Add an abstraction over a monotonic system clock in nanosecond units. Use ktime_get() for the Linux implementation, similarly to nvgpu_current_time_ms(). Jira NVGPU-708 Change-Id: I3165c20abf2652f1a1fa04e66c04cd34a8fe6dcc Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1723201 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: Sourab Gupta <sourabg@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/timers.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/timers.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c
index 41b55543..d1aa641f 100644
--- a/drivers/gpu/nvgpu/common/linux/timers.c
+++ b/drivers/gpu/nvgpu/common/linux/timers.c
@@ -243,6 +243,18 @@ s64 nvgpu_current_time_ms(void)
243} 243}
244 244
245/** 245/**
246 * nvgpu_current_time_ns - Time in nanoseconds from a monotonic clock.
247 *
248 * Return a clock in nanosecond units. The start time of the clock is
249 * unspecified; the time returned can be compared with older ones to measure
250 * durations. The source clock does not jump when the system clock is adjusted.
251 */
252s64 nvgpu_current_time_ns(void)
253{
254 return ktime_to_ns(ktime_get());
255}
256
257/**
246 * nvgpu_hr_timestamp - Opaque 'high resolution' time stamp. 258 * nvgpu_hr_timestamp - Opaque 'high resolution' time stamp.
247 * 259 *
248 * Return a "high resolution" time stamp. It does not really matter exactly what 260 * Return a "high resolution" time stamp. It does not really matter exactly what