VkBreakout icon indicating copy to clipboard operation
VkBreakout copied to clipboard

Multiply timestamp ticks by timestampPeriod.

Open maratsarbasov opened this issue 5 years ago • 3 comments

Hello. In Renderer.cpp starting from line 427 you measure time using vkCmdWriteTimestamp, then calculate diff between end and begin and divide the diff by 1e6 to get milliseconds. But you also need to multiply the diff by timestampPeriod (your variable is timestampFrequency) because timestamp values are unitless. timestampPeriod is how many nanoseconds does one gpu tick contains.

maratsarbasov avatar Jul 30 '19 12:07 maratsarbasov

Agree that need to multiply timestampPeriod, I create an example here: https://github.com/math3d/VulkanCompute/blob/master/base/VulkanUtils.h#L165

math3d avatar Jun 02 '20 03:06 math3d

Yep, you're both right. I definitely should have done that.

Luckily, I just tested this on the machine that I ran these tests on, and the timestampFrequency for that gpu is reported as 1.0, so this change doesn't impact the numbers in the graphs, assuming the way that the code is getting device properties is valid (this was a project I wrote when I was just getting my feet wet with Vulkan, there's potentially a lot of issues). It seems suspect to me that my timestampFrequency just happened to be 1.0, but again, this is an old project, and I don't really want to dig into it any more.

I've checked in the fix to the master branch (https://github.com/khalladay/VkBreakout/commit/fa4707e012dfeaf73afad8102495037b4379677d)

The branches on this project are a total mess, and I'm not really keen on untangling an abandoned 3 year old project's branching problems to update each one, so that's as much as I'm going to do here. Pull requests are welcome, of course ;)

Thanks for pointing this out!

khalladay avatar Jun 21 '20 11:06 khalladay

I've decided to leave this issue open to make it easier for people looking at that old blog post / this repository to notice this issue.

khalladay avatar Jun 21 '20 12:06 khalladay