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@463: * 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 alpar@1157: #include 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@1157: { alpar@1157: TimeStamp x(T); alpar@1157: ignore_unused_variable_warning(x); alpar@1157: } alpar@119: } alpar@119: alpar@119: int main() alpar@119: { alpar@119: Timer T; alpar@119: unsigned int n; kpeter@605: for(n=0;T.realTime()<0.1;n++) ; alpar@119: std::cout << T << " (" << n << " time queries)\n"; kpeter@605: alpar@119: TimeStamp full; alpar@119: TimeStamp t; kpeter@605: 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@605: 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: }