cg shader time measurement

Started by
-1 comments, last by sienaiwun 12 years, 1 month ago
Hi all
I would like to know the exact time measurement for cg shader.
Now I have a display function containing two parts : cuda part computing data, and cg shader render the scene. Like the following :
[color=#444444][font=Tahoma,]Display()[/font]
[color=#444444][font=Tahoma,]{[/font]
[color=#444444][font=Tahoma,]time1 = time();[/font]
[color=#444444][font=Tahoma,]cudaEventRecord(record1);[/font]
[color=#444444][font=Tahoma,]RunCuda();[/font]
[color=#444444][font=Tahoma,]cudaEventRecord(record2);[/font]
[color=#444444][font=Tahoma,]time2 = time();[/font]
[color=#444444][font=Tahoma,]cgRender(); //in cgRender render the scene dozens of time.[/font]
[color=#444444][font=Tahoma,]time3 = time();[/font]
[color=#444444][font=Tahoma,]}[/font]
[color=#444444][font=Tahoma,]then define: [/font]
[color=#444444][font=Tahoma,]cudaTimebyTime = time2-time1;[/font]
[color=#444444][font=Tahoma,]cudaTimebyEvent = record2-record1;[/font]
[color=#444444][font=Tahoma,]cgTime = time3-time2;[/font]
then I find this:
[color=#444444][font=Tahoma,]cudaTimebyTime != cudaTimebyEvent , which means cudaEvent's time measurement is different from the time() function. [/font]
[color=#444444][font=Tahoma,]what's more, when I change cg function in cgRender(); (cudaTimebyTime - cudaTimebyTime) changes rather than the cgTime. It seems cgTime only records the scene drawing time while cg time measurement parts records in [/font][color=#444444][font=Tahoma,] (cudaTimebyTime - cudaTimebyTime).[/font]


[color=#444444][font=Tahoma,] Can it be true and what's the reason, how should I record the cg time measurement.[/font]

This topic is closed to new replies.

Advertisement