Blender
V3.3
intern
cycles
test
util_task_test.cpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: Apache-2.0
2
* Copyright 2011-2022 Blender Foundation */
3
4
#include "testing/testing.h"
5
6
#include "
util/task.h
"
7
8
CCL_NAMESPACE_BEGIN
9
10
namespace
{
11
12
void
task_run
()
13
{
14
}
15
16
}
// namespace
17
18
TEST
(util_task, basic)
19
{
20
TaskScheduler::init
(0);
21
TaskPool
pool
;
22
for
(
int
i = 0; i < 100; ++i) {
23
pool
.
push
(
function_bind
(
task_run
));
24
}
25
TaskPool::Summary
summary;
26
pool
.
wait_work
(&summary);
27
TaskScheduler::exit
();
28
EXPECT_EQ
(summary.
num_tasks_handled
, 100);
29
}
30
31
TEST
(util_task, multiple_times)
32
{
33
for
(
int
N
= 0;
N
< 1000; ++
N
) {
34
TaskScheduler::init
(0);
35
TaskPool
pool
;
36
for
(
int
i = 0; i < 100; ++i) {
37
pool
.
push
(
function_bind
(
task_run
));
38
}
39
TaskPool::Summary
summary;
40
pool
.
wait_work
(&summary);
41
TaskScheduler::exit
();
42
EXPECT_EQ
(summary.
num_tasks_handled
, 100);
43
}
44
}
45
46
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:83
TaskScheduler::init
static void init(int num_threads=0)
Definition:
task.cpp:62
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
cuda/compat.h:9
function_bind
#define function_bind
Definition:
depsgraph_type.h:54
N
#define N
Definition:
mball_tessellate.c:265
CCL_NAMESPACE_BEGIN
Definition:
python.cpp:37
CCL_NAMESPACE_BEGIN::task_run
void task_run()
Definition:
util_task_test.cpp:12
blender::compositor::pool
TaskPool * pool
Definition:
COM_WorkScheduler.cc:68
TaskPool::Summary
Definition:
task.h:30
TaskPool::Summary::num_tasks_handled
int num_tasks_handled
Definition:
task.h:35
TaskPool
Definition:
task_pool.cc:141
TaskPool::push
void push(TaskRunFunction &&task)
Definition:
task.cpp:23
TaskPool::wait_work
void wait_work(Summary *stats=NULL)
Definition:
task.cpp:29
task.h
TEST
TEST(util_task, basic)
Definition:
util_task_test.cpp:18
Generated on Tue Oct 22 2024 13:18:25 for Blender by
doxygen
1.9.1