alpar@906: /* -*- C++ -*- ladanyi@1435: * test/time_measure_test.cc - Part of LEMON, a generic C++ optimization library alpar@906: * alpar@1164: * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@1359: * (Egervary Research Group on Combinatorial Optimization, EGRES). alpar@906: * alpar@906: * Permission to use, modify and distribute this software is granted alpar@906: * provided that this copyright notice appears in all copies. For alpar@906: * precise terms see the accompanying LICENSE file. alpar@906: * alpar@906: * This software is provided "AS IS" with no warranty of any kind, alpar@906: * express or implied, and with no claim as to its suitability for any alpar@906: * purpose. alpar@906: * alpar@906: */ alpar@906: alpar@921: #include alpar@545: alpar@545: ///\file \brief Test cases for time_measure.h alpar@545: /// alpar@545: ///\todo To be extended alpar@545: alpar@545: alpar@921: using namespace lemon; alpar@545: alpar@1689: void f() alpar@1689: { alpar@1689: double d=0; alpar@1689: for(int i=0;i<10000;i++) alpar@1689: d+=0.1; alpar@1689: } alpar@1689: alpar@545: int main() alpar@545: { alpar@545: Timer T; alpar@1689: int n; alpar@1689: for(n=0;T.realTime()<1.0;n++) ; alpar@1689: std::cout << T << " (" << n << " time queries)\n"; alpar@1847: T.restart(); alpar@1689: while(T.realTime()<2.0) ; alpar@545: std::cout << T << '\n'; alpar@1689: TimeStamp full; alpar@1689: TimeStamp t=runningTimeTest(f,1,&n,&full); alpar@1689: std::cout << t << " (" << n << " tests)\n"; alpar@1689: std::cout << "Total: " << full << "\n"; alpar@567: alpar@566: return 0; alpar@545: }