Blender
V4.3
intern
cycles
test
util_task_test.cpp
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2
*
3
* SPDX-License-Identifier: Apache-2.0 */
4
5
#include "testing/testing.h"
6
7
#include "
util/task.h
"
8
9
CCL_NAMESPACE_BEGIN
10
11
namespace
{
12
13
void
task_run
() {}
14
15
}
// namespace
16
17
TEST
(util_task, basic)
18
{
19
TaskScheduler::init
(0);
20
TaskPool
pool;
21
for
(
int
i = 0; i < 100; ++i) {
22
pool.
push
(
function_bind
(task_run));
23
}
24
TaskPool::Summary
summary;
25
pool.
wait_work
(&summary);
26
TaskScheduler::exit
();
27
EXPECT_EQ
(summary.
num_tasks_handled
, 100);
28
}
29
30
TEST
(util_task, multiple_times)
31
{
32
for
(
int
N
= 0;
N
< 1000; ++
N
) {
33
TaskScheduler::init
(0);
34
TaskPool
pool;
35
for
(
int
i = 0; i < 100; ++i) {
36
pool.
push
(
function_bind
(task_run));
37
}
38
TaskPool::Summary
summary;
39
pool.
wait_work
(&summary);
40
TaskScheduler::exit
();
41
EXPECT_EQ
(summary.
num_tasks_handled
, 100);
42
}
43
}
44
45
CCL_NAMESPACE_END
EXPECT_EQ
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
TaskScheduler::exit
static void exit()
Definition
task.cpp:82
TaskScheduler::init
static void init(int num_threads=0)
Definition
task.cpp:61
function_bind
#define function_bind
Definition
depsgraph_type.hh:54
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
N
#define N
Definition
mball_tessellate.cc:274
CCL_NAMESPACE_BEGIN
Definition
python.cpp:44
CCL_NAMESPACE_BEGIN::task_run
void task_run()
Definition
util_task_test.cpp:13
TaskPool::Summary
Definition
task.h:31
TaskPool::Summary::num_tasks_handled
int num_tasks_handled
Definition
task.h:36
TaskPool
Definition
task_pool.cc:148
TaskPool::push
void push(TaskRunFunction &&task)
Definition
task.cpp:22
TaskPool::wait_work
void wait_work(Summary *stats=NULL)
Definition
task.cpp:28
task.h
TEST
TEST(util_task, basic)
Definition
util_task_test.cpp:17
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0