Generated on Wed Nov 1 15:04:28 2006 for Gecode by doxygen 1.4.5

timer.hh

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2004
00007  *
00008  *  Bugfixes provided by:
00009  *     Javier Andrés Mena Zapata <javimena@gmail.com>
00010  *
00011  *  Last modified:
00012  *     $Date: 2006-04-11 15:58:37 +0200 (Tue, 11 Apr 2006) $ by $Author: tack $
00013  *     $Revision: 3188 $
00014  *
00015  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  See the file "LICENSE" for information on usage and
00020  *  redistribution of this file, and for a
00021  *     DISCLAIMER OF ALL WARRANTIES.
00022  *
00023  */
00024 
00025 #ifndef __GECODE_EXAMPLES_TIMER_HH__
00026 #define __GECODE_EXAMPLES_TIMER_HH__
00027 
00028 #include <ctime>
00029 #include <cmath>
00030 
00031 #include "gecode/config.icc"
00032 
00033 /*
00034  * Support for measuring time
00035  *
00036  */
00037 
00039 class Timer {
00040 private:
00041   clock_t t0;
00042 public:
00043   void start(void);
00044   double stop(void);
00045 };
00046 
00047 forceinline void
00048 Timer::start(void) {
00049   t0 = clock();
00050 }
00051 forceinline double
00052 Timer::stop(void) {
00053   return (static_cast<double>(clock()-t0) / CLOCKS_PER_SEC) * 1000.0;
00054 }
00055 
00056 
00061 double
00062 am(double t[], int n);
00067 double
00068 dev(double t[], int n);
00069 
00070 #endif
00071 
00072 // STATISTICS: example-any