[osg-users] measuring a frame

Robert Osfield robert.osfield at gmail.com
Mon Nov 6 00:37:42 PST 2017


Hi Nick,

On 6 November 2017 at 00:56, Trajce Nikolov NICK
<trajce.nikolov.nick at gmail.com> wrote:
> I am trying to measure the time needed to process a frame. My first and
> somewhat naïve approach is to init the timer at the beginning of the frame
> and get the result after the renderingTraversal. But, it seams (and that is
> what I believe it is happening) the rendering traversal is containing the
> swap buffers which is synced with the refresh rate (please correct me if I
> am wrong). Is there something like preswap callback or something like this?

Are you aware of the osg::Stats data structure and support built into
osgViewer?  The StatsHandler.cpp that provides the on-screen stats
enables stats collection and then gets the stats from the osg::Stats
objects.  Various parts of the OSG check for the osg::Stats objects
and then fill in the details when required.  The osg::Stats objects
are designed to queried by users.  Just have a look at how
src/osgViewer/StatsHandler.cpp sets things up.

Robert


More information about the osg-users mailing list