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
2a98c1f8
Commit
2a98c1f8
authored
Feb 11, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Feb 11, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #446 from AnnaKogan8:updated-perf-timing-script
parents
716e0192
51e58aeb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
25 deletions
+55
-25
perf_tests_timing.py
modules/ts/misc/perf_tests_timing.py
+55
-25
No files found.
modules/ts/misc/perf_tests_timing.py
View file @
2a98c1f8
...
...
@@ -15,20 +15,38 @@ if __name__ == "__main__":
help
=
"output results in text format (can be 'txt', 'html' or 'auto' - default)"
,
metavar
=
'FMT'
,
default
=
'auto'
)
parser
.
add_option
(
"--failed-only"
,
action
=
"store_true"
,
dest
=
"failedOnly"
,
help
=
"print only failed tests"
,
default
=
False
)
(
options
,
args
)
=
parser
.
parse_args
()
if
1
!=
len
(
args
):
parser
.
print_help
()
exit
(
0
)
options
.
generateHtml
=
detectHtmlOutputType
(
options
.
format
)
input_file
=
args
[
0
]
file
=
os
.
path
.
abspath
(
input_file
)
files
=
[]
testsuits
=
[]
# testsuit module, name, time, num, flag for failed tests
overall_time
=
0
seen
=
set
()
for
arg
in
args
:
if
(
"*"
in
arg
)
or
(
"?"
in
arg
):
flist
=
[
os
.
path
.
abspath
(
f
)
for
f
in
glob
.
glob
(
arg
)]
flist
=
sorted
(
flist
,
key
=
lambda
text
:
str
(
text
)
.
replace
(
"M"
,
"_"
))
files
.
extend
([
x
for
x
in
flist
if
x
not
in
seen
and
not
seen
.
add
(
x
)])
else
:
fname
=
os
.
path
.
abspath
(
arg
)
if
fname
not
in
seen
and
not
seen
.
add
(
fname
):
files
.
append
(
fname
)
file
=
os
.
path
.
abspath
(
fname
)
if
not
os
.
path
.
isfile
(
file
):
sys
.
stderr
.
write
(
"IOError reading
\"
"
+
file
+
"
\"
- "
+
str
(
err
)
+
os
.
linesep
)
parser
.
print_help
()
exit
(
0
)
fname
=
os
.
path
.
basename
(
fname
)
find_module_name
=
re
.
search
(
r'([^_]*)'
,
fname
)
module_name
=
find_module_name
.
group
(
0
)
test_sets
=
[]
try
:
tests
=
testlog_parser
.
parseLogFile
(
file
)
...
...
@@ -40,8 +58,7 @@ if __name__ == "__main__":
sys
.
stderr
.
write
(
"ExpatError reading
\"
"
+
file
+
"
\"
- "
+
str
(
err
)
+
os
.
linesep
)
if
not
test_sets
:
sys
.
stderr
.
write
(
"Error: no test data found"
+
os
.
linesep
)
exit
(
0
)
continue
# find matches
setsCount
=
len
(
test_sets
)
...
...
@@ -56,9 +73,6 @@ if __name__ == "__main__":
test_cases
[
name
]
=
[
None
]
*
setsCount
test_cases
[
name
][
i
]
=
case
testsuits
=
[]
# testsuit name, time, num, flag for failed tests
overall_time
=
0
prevGroupName
=
None
suit_time
=
0
suit_num
=
0
...
...
@@ -70,8 +84,8 @@ if __name__ == "__main__":
if
groupName
!=
prevGroupName
:
if
prevGroupName
!=
None
:
suit_time
=
suit_time
/
60
#from seconds to minutes
testsuits
.
append
({
'name'
:
prevGroupName
,
'time'
:
suit_ti
me
,
\
'num'
:
suit_num
,
'failed'
:
fails_num
})
testsuits
.
append
({
'module'
:
module_name
,
'name'
:
prevGroupNa
me
,
\
'time'
:
suit_time
,
'num'
:
suit_num
,
'failed'
:
fails_num
})
overall_time
+=
suit_time
suit_time
=
0
suit_num
=
0
...
...
@@ -87,16 +101,20 @@ if __name__ == "__main__":
if
case
.
get
(
'status'
)
==
'failed'
:
fails_num
+=
1
testsuits
.
append
({
'name'
:
prevGroupName
,
'time'
:
suit_time
,
\
'num'
:
suit_num
,
'failed'
:
fails_num
})
# last testsuit processing
suit_time
=
suit_time
/
60
testsuits
.
append
({
'module'
:
module_name
,
'name'
:
prevGroupName
,
\
'time'
:
suit_time
,
'num'
:
suit_num
,
'failed'
:
fails_num
})
overall_time
+=
suit_time
if
len
(
testsuits
)
==
0
:
print
'No testsuits found'
exit
(
0
)
tbl
=
table
()
rows
=
0
# header
if
not
options
.
failedOnly
:
tbl
.
newColumn
(
'module'
,
'Module'
,
align
=
'left'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'name'
,
'Testsuit'
,
align
=
'left'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'time'
,
'Time (min)'
,
align
=
'center'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'num'
,
'Num of tests'
,
align
=
'center'
,
cssclass
=
'col_name'
)
...
...
@@ -105,6 +123,7 @@ if __name__ == "__main__":
# rows
for
suit
in
sorted
(
testsuits
,
key
=
lambda
suit
:
suit
[
'time'
],
reverse
=
True
):
tbl
.
newRow
()
tbl
.
newCell
(
'module'
,
suit
[
'module'
])
tbl
.
newCell
(
'name'
,
suit
[
'name'
])
tbl
.
newCell
(
'time'
,
formatValue
(
suit
[
'time'
],
''
,
''
),
suit
[
'time'
])
tbl
.
newCell
(
'num'
,
suit
[
'num'
])
...
...
@@ -112,18 +131,29 @@ if __name__ == "__main__":
tbl
.
newCell
(
'failed'
,
suit
[
'failed'
])
else
:
tbl
.
newCell
(
'failed'
,
' '
)
rows
+=
1
else
:
tbl
.
newColumn
(
'module'
,
'Module'
,
align
=
'left'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'name'
,
'Testsuit'
,
align
=
'left'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'failed'
,
'Failed'
,
align
=
'center'
,
cssclass
=
'col_name'
)
# rows
for
suit
in
sorted
(
testsuits
,
key
=
lambda
suit
:
suit
[
'time'
],
reverse
=
True
):
if
(
suit
[
'failed'
]
!=
0
):
tbl
.
newRow
()
tbl
.
newCell
(
'module'
,
suit
[
'module'
])
tbl
.
newCell
(
'name'
,
suit
[
'name'
])
tbl
.
newCell
(
'failed'
,
suit
[
'failed'
])
rows
+=
1
# output table
if
rows
:
if
options
.
generateHtml
:
tbl
.
htmlPrintTable
(
sys
.
stdout
)
htmlPrintFooter
(
sys
.
stdout
)
else
:
input_file
=
re
.
sub
(
r'^[\.\/]*'
,
''
,
input_file
)
find_module_name
=
re
.
search
(
r'([^_]*)'
,
input_file
)
module_name
=
find_module_name
.
group
(
0
)
splitter
=
15
*
'*'
print
'
\n
%
s
\n
%
s
\n
%
s
\n
'
%
(
splitter
,
module_name
,
splitter
)
print
'Overall time:
%.2
f min
\n
'
%
overall_time
if
not
options
.
failedOnly
:
print
'
\n
Overall time:
%.2
f min
\n
'
%
overall_time
tbl
.
consolePrintTable
(
sys
.
stdout
)
print
4
*
'
\n
'
\ No newline at end of file
print
2
*
'
\n
'
\ No newline at end of file
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