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>
This commit is contained in:
Konsta Holtta
2017-06-15 10:58:32 +03:00
committed by mobile promotions
parent d84d7f8694
commit 571c7c2fb3
2 changed files with 19 additions and 0 deletions

View File

@@ -229,3 +229,15 @@ void nvgpu_msleep(unsigned int msecs)
{
msleep(msecs);
}
/**
* nvgpu_current_time_ms - Time in milliseconds from a monotonic clock.
*
* Return a clock in millisecond 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_ms(void)
{
return ktime_to_ms(ktime_get());
}