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 :
time1 = time();
time2 = time();
cgRender(); //in cgRender render the scene dozens of time.
time3 = time();
cudaTimebyTime = time2-time1;
cudaTimebyEvent = record2-record1;
cgTime = time3-time2;
then I find this:
cudaTimebyTime != cudaTimebyEvent , which means cudaEvent's time measurement is different from the time() function.
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
(cudaTimebyTime - cudaTimebyTime).
Can it be true and what's the reason, how should I record the cg time measurement.