-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (32 loc) · 975 Bytes
/
main.cpp
File metadata and controls
41 lines (32 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <thread>
#include "jp/Stopwatch.hpp"
using namespace std;
using namespace std::chrono;
int main()
{
jp::Stopwatch w{};
w.start();
this_thread::sleep_for(1.2s);
w.stop();
w.start();
this_thread::sleep_for(0.5s);
w.stop();
w.start();
this_thread::sleep_for(0.75s);
w.stop();
cout << w.str() << "\n";
w.start();
this_thread::sleep_for(0.6s);
w.stop();
cout << w.str<milliseconds>() << "\n";
cout << w.str<milliseconds>(jp::INFO_LAST | jp::INFO_AVG) << "\n";
cout << w.str<milliseconds>(~jp::INFO_STDEV) << "\n";
cout << "\nsize " << w.size()
<< "\nlast " << w.last() << '\t' << w.last<milliseconds>()
<< "\navg " << w.avg() << '\t' << w.avg<milliseconds>()
<< "\nmedian " << w.median() << '\t' << w.median<milliseconds>()
<< "\nstdev " << w.stdev() << '\t' << w.stdev<milliseconds>()
<< "\n";
return 0;
}