[Qt-interest] QBENCHMARK walltime executes entire test function multiple times?

Ed Sutton ESutton at fescorp.com
Tue Feb 8 15:58:07 CET 2011


I expected QBENCHMARK walltime to execute the scoped code multiple times
to average execution time.  Instead it appears to execute the entire test
function.  Is this expected or am I doing something wrong?

I am new to QTestLib.
My target is Red Hat Enterprise Linux 5.x running in a VM using Qt 4.6.1.

void TestFesVideo::subscribeVideo()
{
   string ethernetAdapterName = "eth0";
   string configurationFile =
"../../config/sim/configuration-sim-interlaced.xml";
   FesVideo* pFesVideo = createFesVideoFromConfigFile(configurationFile,
ethernetAdapterName);
   QVERIFY2(NULL != pFesVideo, "FesVideo is NULL");

   VideoSink* pVideoSink;
   pVideoSink = new
VideoSink(boost::bind(&TestFesVideo::onNewVideoFrameHandler, this, _1));

   // When QBENCHMARK usee Walltime (default), it executes entire
subscribeVideo test function multiple times.
   // I expected it to only execute the subscribe/unsubscribe section
multiple times?
   QBENCHMARK {
   pFesVideo->subscribe("channel1", *pVideoSink);
   pFesVideo->unsubscribe(*pVideoSink);
   }

   delete pFesVideo;
}



Thanks in advance for any suggestions,

-Ed




More information about the Qt-interest-old mailing list