test/time_measure_test.cc
author deba
Fri, 14 Oct 2005 10:58:54 +0000
changeset 1724 b20777184ba8
parent 1435 8e85e6bbefdf
child 1847 7cbc12e42482
permissions -rw-r--r--
Heap not for the dijkstra

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