MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / main

Function main

inst/examples/SugarPerformance/Timertest.cpp:9–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include "Timer.h"
8
9int main() {
10 Timer test;
11
12 std::cout << "Sleeping 2 seconds" << std::endl;
13 test.Start();
14 sleep(2);
15 test.Stop();
16 std::cout << "Sleep lasted for " << test.ElapsedTime() << " seconds." << std::endl;
17 std::cout << "Sleeping 1 second" << std::endl;
18 test.Start();
19 sleep(1);
20 test.Stop();
21 std::cout << "Sleep lasted for " << test.ElapsedTime() << " seconds." << std::endl;
22 std::cout << "Cumulative time is " << test.CumulativeTime() << " seconds." << std::endl;
23 std::cout << "Reseting" << std::endl;
24 test.Reset();
25 std::cout << "Sleeping 2 seconds" << std::endl;
26 test.Start();
27 sleep(2);
28 test.Stop();
29 std::cout << "Sleep lasted for " << test.ElapsedTime() << " seconds." << std::endl;
30 std::cout << "Cumulative time is " << test.CumulativeTime() << " seconds." << std::endl;
31}

Callers

nothing calls this directly

Calls 5

StartMethod · 0.80
StopMethod · 0.80
ElapsedTimeMethod · 0.80
CumulativeTimeMethod · 0.80
ResetMethod · 0.80

Tested by

no test coverage detected