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>
This commit is contained in:
Konsta Holtta
2018-05-17 15:04:51 +03:00
committed by mobile promotions
parent b65197c26d
commit a4d1a4830e
2 changed files with 13 additions and 0 deletions

View File

@@ -242,6 +242,18 @@ s64 nvgpu_current_time_ms(void)
return ktime_to_ms(ktime_get());
}
/**
* nvgpu_current_time_ns - Time in nanoseconds from a monotonic clock.
*
* Return a clock in nanosecond units. The start time of the clock is
* unspecified; the time returned can be compared with older ones to measure
* durations. The source clock does not jump when the system clock is adjusted.
*/
s64 nvgpu_current_time_ns(void)
{
return ktime_to_ns(ktime_get());
}
/**
* nvgpu_hr_timestamp - Opaque 'high resolution' time stamp.
*