[Qt-interest] how to computing costed time of a function?

Thiago Macieira thiago.macieira at trolltech.com
Thu Jul 16 11:40:45 CEST 2009


Em Quinta-feira 16 Julho 2009, às 11:28:54, Amit Pundir escreveu:
> On Thu, Jul 16, 2009 at 2:26 PM, Christopher Rasch-Olsen
>
> Raa<christopher at technophile.info> wrote:
> > You could use QTime for such measurement. Have a look at QTime::start().
> > QTime timer;
> > timer.start();
> > long_operation();
> > qDebug() << "Elapsed:" << timer.elapsed();
>
> Hi, is there any way to measure elapsed time in microseconds?

You need a high-resolution timer for that. You're going to need operating 
system help for that, in order to access some performance registers available 
in most modern CPUs.

So Qt doesn't offer any such thing. I recommend using valgrind (tool callgrind) 
and oprofile on Linux.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
     Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090716/94247592/attachment.bin 


More information about the Qt-interest-old mailing list