[vtkusers] Calculating frame rate
Francois Bertel
francois.bertel at kitware.com
Wed Mar 24 14:25:53 EDT 2010
You don't want to measure your framerate all the time because
WaitForCompletion() is actually a call to glFinish() which is
necessary for accurate measurement but could kill overall performance
has it prevents the CPU thread for doing subsequent operations
(blocking call) until the GPU is done.
I usually use it in a performance test with an explicit loop over
multiple render calls and compute the average time.
On Wed, Mar 24, 2010 at 2:15 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Wed, Mar 24, 2010 at 2:10 PM, Francois Bertel
> <francois.bertel at kitware.com> wrote:
>>
>> Hello,
>>
>> Here is the code to measure the rendering time:
>>
>>
>> vtkRenderWindow *r=vtkRenderWindow::New();
>> vtkTimerLog *t=vtkTimerLog::New();
>>
>> [...]
>>
>> t->StartTimer();
>> r->Render();
>> r->WaitForCompletion();
>> t->StopTimer();
>>
>> double timeInSeconds=t->GetElapsedTime();
>> double fps=1.0/timeInSeconds;
>
> So where would be the best place to put this code? Do you have to subclass
> the interactor style and put the timer code around which ever function calls
> Render()? It seems like we should make a vtkRenderWindow::GetFrameRate() -
> what do you think Francois?
> Thanks,
>
> David
--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA
More information about the vtkusers
mailing list