gpu: nvgpu: Abstract get_cycles()

get_cycles is a linux specific API used in common code. This API
is being used, it seems, as a method to generate time stamps. So
add an API to generate 'high resolution' time stamps. This API
returns an opaque time stamp: that is not something one may use
directly as a time since in the Linux implementation we just use
this cycle counter.

Other implementations will, of course, be free to implement as a
real time stamp.

JIRA NVGPU-525

Change-Id: I237aac9bd6c795d000459025bdb4fce92e8aaa3d
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1673811
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@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:
Alex Waterman
2018-02-16 14:08:04 -08:00
committed by mobile promotions
parent ae1b86ed4f
commit 0725ff9372
3 changed files with 17 additions and 1 deletions

View File

@@ -241,3 +241,18 @@ s64 nvgpu_current_time_ms(void)
{
return ktime_to_ms(ktime_get());
}
/**
* nvgpu_hr_timestamp - Opaque 'high resolution' time stamp.
*
* Return a "high resolution" time stamp. It does not really matter exactly what
* it is, so long as it generally returns unique values and monotonically
* increases - wrap around _is_ possible though in a system running for long
* enough.
*
* Note: what high resolution means is system dependent.
*/
u64 nvgpu_hr_timestamp(void)
{
return get_cycles();
}