|
Rcpp Version 0.9.10
|
00001 // -*- mode: c++; compile-command: "g++ -Wall -O3 -o Timertest Timertest.cpp"; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 00002 00003 // from http://www.cs.uiowa.edu/~sriram/30/fall03/ 00004 00005 #include <iostream> 00006 #include <unistd.h> 00007 #include "Timer.h" 00008 00009 int main() { 00010 Timer test; 00011 00012 std::cout << "Sleeping 2 seconds" << std::endl; 00013 test.Start(); 00014 sleep(2); 00015 test.Stop(); 00016 std::cout << "Sleep lasted for " << test.ElapsedTime() << " seconds." << std::endl; 00017 std::cout << "Sleeping 1 second" << std::endl; 00018 test.Start(); 00019 sleep(1); 00020 test.Stop(); 00021 std::cout << "Sleep lasted for " << test.ElapsedTime() << " seconds." << std::endl; 00022 std::cout << "Cumulative time is " << test.CumulativeTime() << " seconds." << std::endl; 00023 std::cout << "Reseting" << std::endl; 00024 test.Reset(); 00025 std::cout << "Sleeping 2 seconds" << std::endl; 00026 test.Start(); 00027 sleep(2); 00028 test.Stop(); 00029 std::cout << "Sleep lasted for " << test.ElapsedTime() << " seconds." << std::endl; 00030 std::cout << "Cumulative time is " << test.CumulativeTime() << " seconds." << std::endl; 00031 }