Boost logo

Boost Users :

From: Tan, Tom (Shanghai) (TTan_at_[hidden])
Date: 2008-07-24 01:32:37


>I've been struggling with how to use the Date_Time library to measure
>time elapsed (like to measure how long code takes to execute).

>Could somebody provide me with an example? Resolution should be around
>msec. I could not find any in the reference that particularly
>addresses this.

I would suggest using boost::timer instead. It's quite simple:

#include <boost/timer.hpp>

boost::timer t;
// code to be measured....
Double e = t.elapsed();
t.restart();
// code to be measured....
e = t.elapsed();


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net