Skip to content

Commit b69681b

Browse files
committed
Fix incorrect Vulkan timestamp frequency
The code was misinterpreting the limits.timestampPeriod member of VkPhysicalDeviceProperties. This addresses the issue reported here: #40
1 parent 113b0be commit b69681b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Src/GPUPerfAPIVk/VkUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ bool VkUtils::GetTimestampFrequency(VkPhysicalDevice vkPhysicalDevice, gpa_uint6
227227
VkPhysicalDeviceProperties properties;
228228
_vkGetPhysicalDeviceProperties(vkPhysicalDevice, &properties);
229229

230-
// Convert timestamp period from cycles / nanosecond to cycles / second
231-
float timestampPeriod = properties.limits.timestampPeriod * 1000000000.0f;
232-
timestampFrequency = static_cast<gpa_uint64>(timestampPeriod);
230+
// Vulkan's timestampPeriod is expressed in nanoseconds per clock tick, convert to frequency in seconds
231+
float timestampPeriod = properties.limits.timestampPeriod;
232+
timestampFrequency = static_cast<gpa_uint64>(1000000000.0f / (timestampPeriod));
233233

234234
success = true;
235235
}

0 commit comments

Comments
 (0)