From 523a7bfe931d50f03023948b6558800d1c4dc0f9 Mon Sep 17 00:00:00 2001 From: Gabriele 'matrix' Gristina Date: Tue, 9 Feb 2016 21:48:18 +0100 Subject: [PATCH] Use CL_DEVICE_PROFILING_TIMER_RESOLUTION per-device value in total_time calculations --- include/types.h | 1 + src/oclHashcat.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/types.h b/include/types.h index 34451da1c..00ead97d3 100644 --- a/include/types.h +++ b/include/types.h @@ -847,6 +847,7 @@ struct __hc_device_param u64 device_maxmem_alloc; u64 device_global_mem; u32 device_maxclock_frequency; + u64 device_timer_resolution; uint vector_width; diff --git a/src/oclHashcat.c b/src/oclHashcat.c index 15c2b1247..7b3944928 100644 --- a/src/oclHashcat.c +++ b/src/oclHashcat.c @@ -797,7 +797,7 @@ void status_display_automat () hc_clGetEventProfilingInfo (data.ocl, device_param->event, CL_PROFILING_COMMAND_START, sizeof (time_start), &time_start, NULL); hc_clGetEventProfilingInfo (data.ocl, device_param->event, CL_PROFILING_COMMAND_END, sizeof (time_end), &time_end, NULL); - const double total_time = (time_end - time_start) / 1000000.0; + const double total_time = ((double)(time_end - time_start) * (double)(device_param->device_timer_resolution)) / 1000000.0; fprintf (out, "%f\t", total_time); } @@ -12579,6 +12579,14 @@ int main (int argc, char **argv) device_param->device_maxclock_frequency = device_maxclock_frequency; + // device_timer_resolution + + cl_ulong device_timer_resolution; + + hc_clGetDeviceInfo (data.ocl, device_param->device, CL_DEVICE_PROFILING_TIMER_RESOLUTION, sizeof (device_timer_resolution), &device_timer_resolution, NULL); + + device_param->device_timer_resolution = device_timer_resolution; + // skipped const u32 skipped1 = ((devices_filter & (1 << device_id)) == 0);