test/time_measure_test.cc
author alpar
Mon, 06 Feb 2006 09:10:43 +0000
changeset 1959 264811b995f3
parent 1875 98698b69a902
child 1960 a60b681d0825
permissions -rw-r--r--
Spellcheck
alpar@906
     1
/* -*- C++ -*-
alpar@906
     2
 *
alpar@1956
     3
 * This file is a part of LEMON, a generic C++ optimization library
alpar@1956
     4
 *
alpar@1956
     5
 * Copyright (C) 2003-2006
alpar@1956
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@906
     8
 *
alpar@906
     9
 * Permission to use, modify and distribute this software is granted
alpar@906
    10
 * provided that this copyright notice appears in all copies. For
alpar@906
    11
 * precise terms see the accompanying LICENSE file.
alpar@906
    12
 *
alpar@906
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@906
    14
 * express or implied, and with no claim as to its suitability for any
alpar@906
    15
 * purpose.
alpar@906
    16
 *
alpar@906
    17
 */
alpar@906
    18
alpar@921
    19
#include <lemon/time_measure.h>
alpar@545
    20
alpar@545
    21
///\file \brief Test cases for time_measure.h
alpar@545
    22
///
alpar@545
    23
///\todo To be extended
alpar@545
    24
alpar@545
    25
alpar@921
    26
using namespace lemon;
alpar@545
    27
alpar@1689
    28
void f() 
alpar@1689
    29
{
alpar@1689
    30
  double d=0;
alpar@1689
    31
  for(int i=0;i<10000;i++)
alpar@1689
    32
    d+=0.1;
alpar@1689
    33
}
alpar@1689
    34
alpar@545
    35
int main()
alpar@545
    36
{
alpar@545
    37
  Timer T;
alpar@1689
    38
  int n;
alpar@1689
    39
  for(n=0;T.realTime()<1.0;n++) ;
alpar@1689
    40
  std::cout << T << " (" << n << " time queries)\n";
alpar@1847
    41
  T.restart();
alpar@1689
    42
  while(T.realTime()<2.0) ;
alpar@545
    43
  std::cout << T << '\n';
alpar@1689
    44
  TimeStamp full;
alpar@1689
    45
  TimeStamp t=runningTimeTest(f,1,&n,&full);
alpar@1689
    46
  std::cout << t << " (" << n << " tests)\n";
alpar@1689
    47
  std::cout << "Total: " << full << "\n";
alpar@567
    48
  
alpar@566
    49
  return 0;
alpar@545
    50
}