alpar@209
|
1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*-
|
alpar@119
|
2 |
*
|
alpar@209
|
3 |
* This file is a part of LEMON, a generic C++ optimization library.
|
alpar@119
|
4 |
*
|
alpar@463
|
5 |
* Copyright (C) 2003-2009
|
alpar@119
|
6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
|
alpar@119
|
7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES).
|
alpar@119
|
8 |
*
|
alpar@119
|
9 |
* Permission to use, modify and distribute this software is granted
|
alpar@119
|
10 |
* provided that this copyright notice appears in all copies. For
|
alpar@119
|
11 |
* precise terms see the accompanying LICENSE file.
|
alpar@119
|
12 |
*
|
alpar@119
|
13 |
* This software is provided "AS IS" with no warranty of any kind,
|
alpar@119
|
14 |
* express or implied, and with no claim as to its suitability for any
|
alpar@119
|
15 |
* purpose.
|
alpar@119
|
16 |
*
|
alpar@119
|
17 |
*/
|
alpar@119
|
18 |
|
alpar@119
|
19 |
#include <lemon/time_measure.h>
|
alpar@1157
|
20 |
#include <lemon/concept_check.h>
|
alpar@119
|
21 |
|
alpar@119
|
22 |
using namespace lemon;
|
alpar@119
|
23 |
|
alpar@209
|
24 |
void f()
|
alpar@119
|
25 |
{
|
alpar@119
|
26 |
double d=0;
|
alpar@119
|
27 |
for(int i=0;i<1000;i++)
|
alpar@119
|
28 |
d+=0.1;
|
alpar@119
|
29 |
}
|
alpar@119
|
30 |
|
alpar@209
|
31 |
void g()
|
alpar@119
|
32 |
{
|
alpar@119
|
33 |
static Timer T;
|
alpar@209
|
34 |
|
alpar@119
|
35 |
for(int i=0;i<1000;i++)
|
alpar@1157
|
36 |
{
|
alpar@1157
|
37 |
TimeStamp x(T);
|
alpar@1257
|
38 |
::lemon::ignore_unused_variable_warning(x);
|
alpar@1157
|
39 |
}
|
alpar@119
|
40 |
}
|
alpar@119
|
41 |
|
alpar@119
|
42 |
int main()
|
alpar@119
|
43 |
{
|
alpar@119
|
44 |
Timer T;
|
alpar@119
|
45 |
unsigned int n;
|
kpeter@605
|
46 |
for(n=0;T.realTime()<0.1;n++) ;
|
alpar@119
|
47 |
std::cout << T << " (" << n << " time queries)\n";
|
kpeter@605
|
48 |
|
alpar@119
|
49 |
TimeStamp full;
|
alpar@119
|
50 |
TimeStamp t;
|
kpeter@605
|
51 |
t=runningTimeTest(f,0.1,&n,&full);
|
alpar@119
|
52 |
std::cout << t << " (" << n << " tests)\n";
|
alpar@119
|
53 |
std::cout << "Total: " << full << "\n";
|
alpar@209
|
54 |
|
kpeter@605
|
55 |
t=runningTimeTest(g,0.1,&n,&full);
|
alpar@119
|
56 |
std::cout << t << " (" << n << " tests)\n";
|
alpar@119
|
57 |
std::cout << "Total: " << full << "\n";
|
alpar@209
|
58 |
|
alpar@119
|
59 |
return 0;
|
alpar@119
|
60 |
}
|