-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (38 loc) · 826 Bytes
/
main.cpp
File metadata and controls
46 lines (38 loc) · 826 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
42
43
44
45
46
#include <iostream>
#include <thread>
#include "profiler.h"
int func1() {
PROFILE_FUNCTION();
int i = 0;
for(; i < 3; ++i) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
return i;
}
int func2() {
PROFILE_FUNCTION();
int i = 0;
for(; i < 2; ++i) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
return i;
}
void func3() {
PROFILE_FUNCTION();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
auto x = func1();
auto y = func2();
}
void func4() {
PROFILE_FUNCTION();
std::this_thread::sleep_for(std::chrono::seconds(5));
}
int main()
{
ProfileWriter::beginSession("start");
std::thread thr(func4);
func3();
thr.join();
ProfileWriter::endSession();
return EXIT_SUCCESS;
}