Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
15f4292a
Commit
15f4292a
authored
Nov 13, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Nov 13, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1788 from alalek:perf_test_skip
parents
411629a5
fb326a58
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
106 additions
and
21 deletions
+106
-21
perf_arithm.cpp
modules/ocl/perf/perf_arithm.cpp
+3
-0
perf_filters.cpp
modules/ocl/perf/perf_filters.cpp
+18
-0
perf_imgwarp.cpp
modules/ocl/perf/perf_imgwarp.cpp
+4
-1
perf_matrix_operation.cpp
modules/ocl/perf/perf_matrix_operation.cpp
+4
-0
perf_precomp.hpp
modules/ocl/perf/perf_precomp.hpp
+25
-3
perf_pyramid.cpp
modules/ocl/perf/perf_pyramid.cpp
+8
-2
perf_split_merge.cpp
modules/ocl/perf/perf_split_merge.cpp
+7
-2
ts_perf.hpp
modules/ts/include/opencv2/ts/ts_perf.hpp
+3
-0
ts_perf.cpp
modules/ts/src/ts_perf.cpp
+34
-13
No files found.
modules/ocl/perf/perf_arithm.cpp
View file @
15f4292a
...
...
@@ -1066,6 +1066,9 @@ PERF_TEST_P(RepeatFixture, Repeat,
const
int
nx
=
3
,
ny
=
2
;
const
Size
dstSize
(
srcSize
.
width
*
nx
,
srcSize
.
height
*
ny
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
checkDeviceMaxMemoryAllocSize
(
dstSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
dstSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
modules/ocl/perf/perf_filters.cpp
View file @
15f4292a
...
...
@@ -61,6 +61,8 @@ PERF_TEST_P(BlurFixture, Blur,
const
Size
srcSize
=
get
<
0
>
(
params
),
ksize
(
3
,
3
);
const
int
type
=
get
<
1
>
(
params
),
bordertype
=
BORDER_CONSTANT
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
@@ -99,6 +101,8 @@ PERF_TEST_P(LaplacianFixture, Laplacian,
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
ksize
=
3
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
@@ -138,6 +142,8 @@ PERF_TEST_P(ErodeFixture, Erode,
const
int
type
=
get
<
1
>
(
params
),
ksize
=
3
;
const
Mat
ker
=
getStructuringElement
(
MORPH_RECT
,
Size
(
ksize
,
ksize
));
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
).
in
(
ker
);
...
...
@@ -176,6 +182,8 @@ PERF_TEST_P(SobelFixture, Sobel,
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
dx
=
1
,
dy
=
1
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
,
sizeof
(
float
)
*
2
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
@@ -217,6 +225,8 @@ PERF_TEST_P(ScharrFixture, Scharr,
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
dx
=
1
,
dy
=
0
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
,
sizeof
(
float
)
*
2
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
@@ -258,6 +268,8 @@ PERF_TEST_P(GaussianBlurFixture, GaussianBlur,
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
ksize
=
7
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
@@ -295,6 +307,8 @@ PERF_TEST_P(filter2DFixture, filter2D,
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
ksize
=
3
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
),
kernel
(
ksize
,
ksize
,
CV_32SC1
);
declare
.
in
(
src
,
WARMUP_RNG
).
in
(
kernel
).
out
(
dst
);
randu
(
kernel
,
-
3.0
,
3.0
);
...
...
@@ -335,6 +349,8 @@ PERF_TEST_P(BilateralFixture, Bilateral,
const
int
type
=
get
<
1
>
(
params
),
d
=
7
;
const
double
sigmacolor
=
50.0
,
sigmaspace
=
50.0
;
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
@@ -374,6 +390,8 @@ PERF_TEST_P(adaptiveBilateralFixture, adaptiveBilateral,
const
double
sigmaspace
=
10.0
;
Size
ksize
(
9
,
9
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
modules/ocl/perf/perf_imgwarp.cpp
View file @
15f4292a
...
...
@@ -154,9 +154,12 @@ PERF_TEST_P(resizeFixture, resize,
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
),
interType
=
get
<
2
>
(
params
);
double
scale
=
get
<
3
>
(
params
);
const
Size
dstSize
(
cvRound
(
srcSize
.
width
*
scale
),
cvRound
(
srcSize
.
height
*
scale
));
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
checkDeviceMaxMemoryAllocSize
(
dstSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
;
const
Size
dstSize
(
cvRound
(
srcSize
.
width
*
scale
),
cvRound
(
srcSize
.
height
*
scale
));
dst
.
create
(
dstSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
if
(
interType
==
INTER_LINEAR
&&
type
==
CV_8UC4
&&
OCL_SIZE_4000
==
srcSize
)
...
...
modules/ocl/perf/perf_matrix_operation.cpp
View file @
15f4292a
...
...
@@ -63,6 +63,10 @@ PERF_TEST_P(ConvertToFixture, ConvertTo,
Mat
src
(
srcSize
,
type
),
dst
;
const
int
dstType
=
CV_MAKE_TYPE
(
CV_32F
,
src
.
channels
());
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
dstType
);
dst
.
create
(
srcSize
,
dstType
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
modules/ocl/perf/perf_precomp.hpp
View file @
15f4292a
...
...
@@ -103,8 +103,30 @@ using namespace cv;
CV_TEST_FAIL_NO_IMPL();
#endif
#define OCL_TEST_CYCLE_N(n) for(declare.iterations(n); startTimer(), next(); ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE() for(; startTimer(), next(); ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE_MULTIRUN(runsNum) for(declare.runs(runsNum); startTimer(), next(); stopTimer()) for(int r = 0; r < runsNum; ocl::finish(), ++r)
#define OCL_TEST_CYCLE_N(n) for(declare.iterations(n); startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE() for(; startTimer(), next(); cv::ocl::finish(), stopTimer())
#define OCL_TEST_CYCLE_MULTIRUN(runsNum) for(declare.runs(runsNum); startTimer(), next(); stopTimer()) for(int r = 0; r < runsNum; cv::ocl::finish(), ++r)
namespace
cvtest
{
namespace
ocl
{
inline
void
checkDeviceMaxMemoryAllocSize
(
const
Size
&
size
,
int
type
,
int
factor
=
1
)
{
assert
(
factor
>
0
);
if
(
!
(
IMPL_OCL
==
perf
::
TestBase
::
getSelectedImpl
()))
return
;
// OpenCL devices are not used
int
cn
=
CV_MAT_CN
(
type
);
int
cn_ocl
=
cn
==
3
?
4
:
cn
;
int
type_ocl
=
CV_MAKE_TYPE
(
CV_MAT_DEPTH
(
type
),
cn_ocl
);
size_t
memSize
=
size
.
area
()
*
CV_ELEM_SIZE
(
type_ocl
);
const
cv
::
ocl
::
DeviceInfo
&
devInfo
=
cv
::
ocl
::
Context
::
getContext
()
->
getDeviceInfo
();
if
(
memSize
*
factor
>=
devInfo
.
maxMemAllocSize
)
{
throw
perf
::
TestBase
::
PerfSkipTestException
();
}
}
}
// namespace cvtest::ocl
}
// namespace cvtest
using
namespace
cvtest
::
ocl
;
#endif
modules/ocl/perf/perf_pyramid.cpp
View file @
15f4292a
...
...
@@ -60,9 +60,12 @@ PERF_TEST_P(pyrDownFixture, pyrDown,
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Size
dstSize
((
srcSize
.
height
+
1
)
>>
1
,
(
srcSize
.
width
+
1
)
>>
1
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
checkDeviceMaxMemoryAllocSize
(
dstSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
;
Size
dstSize
((
srcSize
.
height
+
1
)
>>
1
,
(
srcSize
.
width
+
1
)
>>
1
);
dst
.
create
(
dstSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
@@ -97,9 +100,12 @@ PERF_TEST_P(pyrUpFixture, pyrUp,
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
type
=
get
<
1
>
(
params
);
Size
dstSize
(
srcSize
.
height
<<
1
,
srcSize
.
width
<<
1
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
checkDeviceMaxMemoryAllocSize
(
dstSize
,
type
);
Mat
src
(
srcSize
,
type
),
dst
;
Size
dstSize
(
srcSize
.
height
<<
1
,
srcSize
.
width
<<
1
);
dst
.
create
(
dstSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
).
out
(
dst
);
...
...
modules/ocl/perf/perf_split_merge.cpp
View file @
15f4292a
...
...
@@ -60,8 +60,10 @@ PERF_TEST_P(MergeFixture, Merge,
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
depth
=
get
<
1
>
(
params
),
channels
=
3
;
const
int
dstType
=
CV_MAKE_TYPE
(
depth
,
channels
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
dstType
);
Mat
dst
(
srcSize
,
dstType
);
vector
<
Mat
>
src
(
channels
);
for
(
vector
<
Mat
>::
iterator
i
=
src
.
begin
(),
end
=
src
.
end
();
i
!=
end
;
++
i
)
...
...
@@ -105,8 +107,11 @@ PERF_TEST_P(SplitFixture, Split,
const
Size_MatType_t
params
=
GetParam
();
const
Size
srcSize
=
get
<
0
>
(
params
);
const
int
depth
=
get
<
1
>
(
params
),
channels
=
3
;
const
int
type
=
CV_MAKE_TYPE
(
depth
,
channels
);
checkDeviceMaxMemoryAllocSize
(
srcSize
,
type
);
Mat
src
(
srcSize
,
CV_MAKE_TYPE
(
depth
,
channels
)
);
Mat
src
(
srcSize
,
type
);
declare
.
in
(
src
,
WARMUP_RNG
);
if
(
RUN_OCL_IMPL
)
...
...
modules/ts/include/opencv2/ts/ts_perf.hpp
View file @
15f4292a
...
...
@@ -243,6 +243,7 @@ typedef struct CV_EXPORTS performance_metrics
TERM_TIME
=
1
,
TERM_INTERRUPT
=
2
,
TERM_EXCEPTION
=
3
,
TERM_SKIP_TEST
=
4
,
// there are some limitations and test should be skipped
TERM_UNKNOWN
=
-
1
};
...
...
@@ -279,6 +280,8 @@ public:
static
enum
PERF_STRATEGY
getPerformanceStrategy
();
static
enum
PERF_STRATEGY
setPerformanceStrategy
(
enum
PERF_STRATEGY
strategy
);
class
PerfSkipTestException
:
public
cv
::
Exception
{};
protected
:
virtual
void
PerfTestBody
()
=
0
;
...
...
modules/ts/src/ts_perf.cpp
View file @
15f4292a
...
...
@@ -1175,7 +1175,14 @@ void TestBase::reportMetrics(bool toJUnitXML)
{
performance_metrics
&
m
=
calcMetrics
();
if
(
toJUnitXML
)
if
(
m
.
terminationReason
==
performance_metrics
::
TERM_SKIP_TEST
)
{
if
(
toJUnitXML
)
{
RecordProperty
(
"custom_status"
,
"skipped"
);
}
}
else
if
(
toJUnitXML
)
{
RecordProperty
(
"bytesIn"
,
(
int
)
m
.
bytesIn
);
RecordProperty
(
"bytesOut"
,
(
int
)
m
.
bytesOut
);
...
...
@@ -1267,21 +1274,30 @@ void TestBase::SetUp()
void
TestBase
::
TearDown
()
{
if
(
!
HasFailure
()
&&
!
verified
)
ADD_FAILURE
()
<<
"The test has no sanity checks. There should be at least one check at the end of performance test."
;
validateMetrics
();
if
(
HasFailure
())
reportMetrics
(
false
);
if
(
metrics
.
terminationReason
==
performance_metrics
::
TERM_SKIP_TEST
)
{
LOGI
(
"
\t
Test was skipped"
);
GTEST_SUCCEED
()
<<
"Test was skipped"
;
}
else
{
const
::
testing
::
TestInfo
*
const
test_info
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
const
char
*
type_param
=
test_info
->
type_param
();
const
char
*
value_param
=
test_info
->
value_param
();
if
(
value_param
)
printf
(
"[ VALUE ]
\t
%s
\n
"
,
value_param
),
fflush
(
stdout
);
if
(
type_param
)
printf
(
"[ TYPE ]
\t
%s
\n
"
,
type_param
),
fflush
(
stdout
);
reportMetrics
(
true
);
if
(
!
HasFailure
()
&&
!
verified
)
ADD_FAILURE
()
<<
"The test has no sanity checks. There should be at least one check at the end of performance test."
;
validateMetrics
();
if
(
HasFailure
())
{
reportMetrics
(
false
);
return
;
}
}
const
::
testing
::
TestInfo
*
const
test_info
=
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
();
const
char
*
type_param
=
test_info
->
type_param
();
const
char
*
value_param
=
test_info
->
value_param
();
if
(
value_param
)
printf
(
"[ VALUE ]
\t
%s
\n
"
,
value_param
),
fflush
(
stdout
);
if
(
type_param
)
printf
(
"[ TYPE ]
\t
%s
\n
"
,
type_param
),
fflush
(
stdout
);
reportMetrics
(
true
);
}
std
::
string
TestBase
::
getDataPath
(
const
std
::
string
&
relativePath
)
...
...
@@ -1331,6 +1347,11 @@ void TestBase::RunPerfTestBody()
{
this
->
PerfTestBody
();
}
catch
(
PerfSkipTestException
&
)
{
metrics
.
terminationReason
=
performance_metrics
::
TERM_SKIP_TEST
;
return
;
}
catch
(
PerfEarlyExitException
&
)
{
metrics
.
terminationReason
=
performance_metrics
::
TERM_INTERRUPT
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment