FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpp-taskflow/benchmark/linear_chain/taskflow.cpp at master · cppwanderboy/cpp-taskflow · GitHub
cppwanderboy
/
cpp-taskflow
Public
forked from
taskflow/taskflow
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpp-taskflow
/
benchmark
/
linear_chain
/
taskflow.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (24 loc) · 809 Bytes
Breadcrumbs
cpp-taskflow
/
benchmark
/
linear_chain
/
taskflow.cpp
Copy path
File metadata and controls
34 lines (24 loc) · 809 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
"
linear_chain.hpp
"
#
include
<
taskflow/taskflow.hpp
>
//
binary_tree_taskflow
void
binary_tree_taskflow
(
size_t
length,
unsigned
num_threads) {
size_t
counter {
0
};
std::vector<tf::Task>
tasks
(length);
tf::Executor
executor
(num_threads);
tf::Taskflow taskflow;
for
(
size_t
i=
0
; i<length; ++i) {
tasks[i] = taskflow.
emplace
([&] () { counter++; });
}
taskflow.
linearize
(tasks);
executor.
run
(taskflow).
get
();
assert
(counter == tasks.
size
());
}
std::chrono::microseconds
measure_time_taskflow
(
size_t
length,
unsigned
num_threads
) {
auto
beg =
std::chrono::high_resolution_clock::now
();
binary_tree_taskflow
(length, num_threads);
auto
end =
std::chrono::high_resolution_clock::now
();
return
std::chrono::duration_cast<std::chrono::microseconds>(end - beg);
}
Back
|
FazBrowse Home
|
New Git URL