Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
c3881ede
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c3881ede
编写于
10月 15, 2012
作者:
A
Andrey Kamaev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor thread management in performance tests
上级
aedf5640
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
18 deletion
+25
-18
modules/ts/src/ts_perf.cpp
modules/ts/src/ts_perf.cpp
+25
-18
未找到文件。
modules/ts/src/ts_perf.cpp
浏览文件 @
c3881ede
...
...
@@ -15,7 +15,7 @@ const std::string command_line_keys =
"{ perf_min_samples |10 |minimal required numer of samples}"
"{ perf_force_samples |100 |force set maximum number of samples for all tests}"
"{ perf_seed |809564 |seed for random numbers generator}"
"{ perf_t
bb_nthreads |-1 |if TBB is enabled, the number of TBB threads
}"
"{ perf_t
hreads |-1 |the number of worker threads, if parallel execution is enabled
}"
"{ perf_write_sanity | |allow to create new records for sanity checks}"
#ifdef ANDROID
"{ perf_time_limit |6.0 |default time limit for a single test (in seconds)}"
...
...
@@ -39,18 +39,18 @@ static unsigned int param_min_samples;
static
unsigned
int
param_force_samples
;
static
uint64
param_seed
;
static
double
param_time_limit
;
static
int
param_t
bb_nt
hreads
;
static
int
param_threads
;
static
bool
param_write_sanity
;
#ifdef HAVE_CUDA
static
bool
param_run_cpu
;
static
int
param_cuda_device
;
#endif
#ifdef ANDROID
static
int
param_affinity_mask
;
static
bool
log_power_checkpoints
;
#include <sys/syscall.h>
#include <pthread.h>
static
void
setCurrentThreadAffinityMask
(
int
mask
)
...
...
@@ -64,13 +64,25 @@ static void setCurrentThreadAffinityMask(int mask)
LOGE
(
"Error in the syscall setaffinity: mask=%d=0x%x err=%d=0x%x"
,
mask
,
mask
,
err
,
err
);
}
}
#endif
#ifdef HAVE_CUDA
# include <opencv2/core/gpumat.hpp>
#endif
namespace
{
class
PerfEnvironment
:
public
::
testing
::
Environment
{
public:
void
TearDown
()
{
cv
::
setNumThreads
(
-
1
);
}
};
}
// namespace
static
void
randu
(
cv
::
Mat
&
m
)
{
const
int
bigValue
=
0x00000FFF
;
...
...
@@ -635,6 +647,8 @@ void TestBase::Init(int argc, const char* const argv[])
return
;
}
::
testing
::
AddGlobalTestEnvironment
(
new
PerfEnvironment
);
param_max_outliers
=
std
::
min
(
100.
,
std
::
max
(
0.
,
args
.
get
<
double
>
(
"perf_max_outliers"
)));
param_min_samples
=
std
::
max
(
1u
,
args
.
get
<
unsigned
int
>
(
"perf_min_samples"
));
param_max_deviation
=
std
::
max
(
0.
,
args
.
get
<
double
>
(
"perf_max_deviation"
));
...
...
@@ -642,7 +656,7 @@ void TestBase::Init(int argc, const char* const argv[])
param_time_limit
=
std
::
max
(
0.
,
args
.
get
<
double
>
(
"perf_time_limit"
));
param_force_samples
=
args
.
get
<
unsigned
int
>
(
"perf_force_samples"
);
param_write_sanity
=
args
.
has
(
"perf_write_sanity"
);
param_t
bb_nthreads
=
args
.
get
<
int
>
(
"perf_tbb_n
threads"
);
param_t
hreads
=
args
.
get
<
int
>
(
"perf_
threads"
);
#ifdef ANDROID
param_affinity_mask
=
args
.
get
<
int
>
(
"perf_affinity_mask"
);
log_power_checkpoints
=
args
.
has
(
"perf_log_power_checkpoints"
);
...
...
@@ -1039,16 +1053,14 @@ void TestBase::SetUp()
{
cv
::
theRNG
().
state
=
param_seed
;
// this rng should generate same numbers for each run
#ifdef HAVE_TBB
if
(
param_tbb_nthreads
>
0
)
{
p_tbb_initializer
.
release
();
p_tbb_initializer
=
new
tbb
::
task_scheduler_init
(
param_tbb_nthreads
);
}
#endif
if
(
param_threads
>=
0
)
cv
::
setNumThreads
(
param_threads
);
#ifdef ANDROID
if
(
param_affinity_mask
)
setCurrentThreadAffinityMask
(
param_affinity_mask
);
#endif
verified
=
false
;
lastTime
=
0
;
totalTime
=
0
;
...
...
@@ -1167,12 +1179,7 @@ TestBase::_declareHelper& TestBase::_declareHelper::time(double timeLimitSecs)
TestBase
::
_declareHelper
&
TestBase
::
_declareHelper
::
tbb_threads
(
int
n
)
{
#ifdef HAVE_TBB
test
->
p_tbb_initializer
.
release
();
if
(
n
>
0
)
test
->
p_tbb_initializer
=
new
tbb
::
task_scheduler_init
(
n
);
#endif
(
void
)
n
;
cv
::
setNumThreads
(
n
);
return
*
this
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录