Skip to content

Commit e0edf7a

Browse files
authored
Reduce execution time of test_parallel_phase (#1723)
Signed-off-by: Isaev, Ilya <[email protected]>
1 parent 7dfe7e7 commit e0edf7a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/tbb/test_parallel_phase.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ struct dummy_func {
4545
template <typename F1 = dummy_func, typename F2 = dummy_func>
4646
std::size_t measure_median_start_time(tbb::task_arena* ta, const F1& start = F1{}, const F2& end = F2{}) {
4747
std::size_t num_threads = ta ? ta->max_concurrency() : tbb::this_task_arena::max_concurrency();
48-
std::size_t num_runs = 500;
48+
// TODO: propagate worker threads blocking time to the test
49+
std::size_t max_wait = 1000;
50+
std::size_t num_runs = 100;
4951
std::vector<std::size_t> longest_start_times;
5052
longest_start_times.reserve(num_runs);
5153

@@ -77,13 +79,14 @@ std::size_t measure_median_start_time(tbb::task_arena* ta, const F1& start = F1{
7779
longest_start_times.push_back(get_longest_start(start_time));
7880
};
7981

80-
for (std::size_t i = 1; i < num_runs; ++i) {
82+
std::size_t step = max_wait / num_runs;
83+
for (std::size_t i = 0; i <= max_wait; i += step) {
8184
if (ta) {
8285
ta->execute(work);
8386
} else {
8487
work();
8588
}
86-
active_wait_for(std::chrono::microseconds(i*2));
89+
active_wait_for(std::chrono::microseconds(i));
8790
}
8891
return utils::median(longest_start_times.begin(), longest_start_times.end());
8992
}

0 commit comments

Comments
 (0)