alpar@209: /* -*- mode: C++; indent-tabs-mode: nil; -*-
alpar@119:  *
alpar@209:  * This file is a part of LEMON, a generic C++ optimization library.
alpar@119:  *
alpar@440:  * Copyright (C) 2003-2009
alpar@119:  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@119:  * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@119:  *
alpar@119:  * Permission to use, modify and distribute this software is granted
alpar@119:  * provided that this copyright notice appears in all copies. For
alpar@119:  * precise terms see the accompanying LICENSE file.
alpar@119:  *
alpar@119:  * This software is provided "AS IS" with no warranty of any kind,
alpar@119:  * express or implied, and with no claim as to its suitability for any
alpar@119:  * purpose.
alpar@119:  *
alpar@119:  */
alpar@119: 
alpar@119: #include <lemon/time_measure.h>
alpar@119: 
alpar@119: using namespace lemon;
alpar@119: 
alpar@209: void f()
alpar@119: {
alpar@119:   double d=0;
alpar@119:   for(int i=0;i<1000;i++)
alpar@119:     d+=0.1;
alpar@119: }
alpar@119: 
alpar@209: void g()
alpar@119: {
alpar@119:   static Timer T;
alpar@209: 
alpar@119:   for(int i=0;i<1000;i++)
alpar@119:     TimeStamp x(T);
alpar@119: }
alpar@119: 
alpar@119: int main()
alpar@119: {
alpar@119:   Timer T;
alpar@119:   unsigned int n;
kpeter@558:   for(n=0;T.realTime()<0.1;n++) ;
alpar@119:   std::cout << T << " (" << n << " time queries)\n";
kpeter@558: 
alpar@119:   TimeStamp full;
alpar@119:   TimeStamp t;
kpeter@558:   t=runningTimeTest(f,0.1,&n,&full);
alpar@119:   std::cout << t << " (" << n << " tests)\n";
alpar@119:   std::cout << "Total: " << full << "\n";
alpar@209: 
kpeter@558:   t=runningTimeTest(g,0.1,&n,&full);
alpar@119:   std::cout << t << " (" << n << " tests)\n";
alpar@119:   std::cout << "Total: " << full << "\n";
alpar@209: 
alpar@119:   return 0;
alpar@119: }