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
51e58aeb
Commit
51e58aeb
authored
Feb 07, 2013
by
Anna Kogan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added --failed-only option and multiple input files support
parent
f608df96
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 @
51e58aeb
...
@@ -15,20 +15,38 @@ if __name__ == "__main__":
...
@@ -15,20 +15,38 @@ if __name__ == "__main__":
help
=
"output results in text format (can be 'txt', 'html' or 'auto' - default)"
,
help
=
"output results in text format (can be 'txt', 'html' or 'auto' - default)"
,
metavar
=
'FMT'
,
default
=
'auto'
)
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
()
(
options
,
args
)
=
parser
.
parse_args
()
if
1
!=
len
(
args
):
parser
.
print_help
()
exit
(
0
)
options
.
generateHtml
=
detectHtmlOutputType
(
options
.
format
)
options
.
generateHtml
=
detectHtmlOutputType
(
options
.
format
)
input_file
=
args
[
0
]
files
=
[]
file
=
os
.
path
.
abspath
(
input_file
)
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
):
if
not
os
.
path
.
isfile
(
file
):
sys
.
stderr
.
write
(
"IOError reading
\"
"
+
file
+
"
\"
- "
+
str
(
err
)
+
os
.
linesep
)
sys
.
stderr
.
write
(
"IOError reading
\"
"
+
file
+
"
\"
- "
+
str
(
err
)
+
os
.
linesep
)
parser
.
print_help
()
parser
.
print_help
()
exit
(
0
)
exit
(
0
)
fname
=
os
.
path
.
basename
(
fname
)
find_module_name
=
re
.
search
(
r'([^_]*)'
,
fname
)
module_name
=
find_module_name
.
group
(
0
)
test_sets
=
[]
test_sets
=
[]
try
:
try
:
tests
=
testlog_parser
.
parseLogFile
(
file
)
tests
=
testlog_parser
.
parseLogFile
(
file
)
...
@@ -40,8 +58,7 @@ if __name__ == "__main__":
...
@@ -40,8 +58,7 @@ if __name__ == "__main__":
sys
.
stderr
.
write
(
"ExpatError reading
\"
"
+
file
+
"
\"
- "
+
str
(
err
)
+
os
.
linesep
)
sys
.
stderr
.
write
(
"ExpatError reading
\"
"
+
file
+
"
\"
- "
+
str
(
err
)
+
os
.
linesep
)
if
not
test_sets
:
if
not
test_sets
:
sys
.
stderr
.
write
(
"Error: no test data found"
+
os
.
linesep
)
continue
exit
(
0
)
# find matches
# find matches
setsCount
=
len
(
test_sets
)
setsCount
=
len
(
test_sets
)
...
@@ -56,9 +73,6 @@ if __name__ == "__main__":
...
@@ -56,9 +73,6 @@ if __name__ == "__main__":
test_cases
[
name
]
=
[
None
]
*
setsCount
test_cases
[
name
]
=
[
None
]
*
setsCount
test_cases
[
name
][
i
]
=
case
test_cases
[
name
][
i
]
=
case
testsuits
=
[]
# testsuit name, time, num, flag for failed tests
overall_time
=
0
prevGroupName
=
None
prevGroupName
=
None
suit_time
=
0
suit_time
=
0
suit_num
=
0
suit_num
=
0
...
@@ -70,8 +84,8 @@ if __name__ == "__main__":
...
@@ -70,8 +84,8 @@ if __name__ == "__main__":
if
groupName
!=
prevGroupName
:
if
groupName
!=
prevGroupName
:
if
prevGroupName
!=
None
:
if
prevGroupName
!=
None
:
suit_time
=
suit_time
/
60
#from seconds to minutes
suit_time
=
suit_time
/
60
#from seconds to minutes
testsuits
.
append
({
'name'
:
prevGroupName
,
'time'
:
suit_ti
me
,
\
testsuits
.
append
({
'module'
:
module_name
,
'name'
:
prevGroupNa
me
,
\
'num'
:
suit_num
,
'failed'
:
fails_num
})
'time'
:
suit_time
,
'num'
:
suit_num
,
'failed'
:
fails_num
})
overall_time
+=
suit_time
overall_time
+=
suit_time
suit_time
=
0
suit_time
=
0
suit_num
=
0
suit_num
=
0
...
@@ -87,16 +101,20 @@ if __name__ == "__main__":
...
@@ -87,16 +101,20 @@ if __name__ == "__main__":
if
case
.
get
(
'status'
)
==
'failed'
:
if
case
.
get
(
'status'
)
==
'failed'
:
fails_num
+=
1
fails_num
+=
1
testsuits
.
append
({
'name'
:
prevGroupName
,
'time'
:
suit_time
,
\
# last testsuit processing
'num'
:
suit_num
,
'failed'
:
fails_num
})
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
:
if
len
(
testsuits
)
==
0
:
print
'No testsuits found'
exit
(
0
)
exit
(
0
)
tbl
=
table
()
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
(
'name'
,
'Testsuit'
,
align
=
'left'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'time'
,
'Time (min)'
,
align
=
'center'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'time'
,
'Time (min)'
,
align
=
'center'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'num'
,
'Num of tests'
,
align
=
'center'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
'num'
,
'Num of tests'
,
align
=
'center'
,
cssclass
=
'col_name'
)
...
@@ -105,6 +123,7 @@ if __name__ == "__main__":
...
@@ -105,6 +123,7 @@ if __name__ == "__main__":
# rows
# rows
for
suit
in
sorted
(
testsuits
,
key
=
lambda
suit
:
suit
[
'time'
],
reverse
=
True
):
for
suit
in
sorted
(
testsuits
,
key
=
lambda
suit
:
suit
[
'time'
],
reverse
=
True
):
tbl
.
newRow
()
tbl
.
newRow
()
tbl
.
newCell
(
'module'
,
suit
[
'module'
])
tbl
.
newCell
(
'name'
,
suit
[
'name'
])
tbl
.
newCell
(
'name'
,
suit
[
'name'
])
tbl
.
newCell
(
'time'
,
formatValue
(
suit
[
'time'
],
''
,
''
),
suit
[
'time'
])
tbl
.
newCell
(
'time'
,
formatValue
(
suit
[
'time'
],
''
,
''
),
suit
[
'time'
])
tbl
.
newCell
(
'num'
,
suit
[
'num'
])
tbl
.
newCell
(
'num'
,
suit
[
'num'
])
...
@@ -112,18 +131,29 @@ if __name__ == "__main__":
...
@@ -112,18 +131,29 @@ if __name__ == "__main__":
tbl
.
newCell
(
'failed'
,
suit
[
'failed'
])
tbl
.
newCell
(
'failed'
,
suit
[
'failed'
])
else
:
else
:
tbl
.
newCell
(
'failed'
,
' '
)
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
# output table
if
rows
:
if
options
.
generateHtml
:
if
options
.
generateHtml
:
tbl
.
htmlPrintTable
(
sys
.
stdout
)
tbl
.
htmlPrintTable
(
sys
.
stdout
)
htmlPrintFooter
(
sys
.
stdout
)
htmlPrintFooter
(
sys
.
stdout
)
else
:
else
:
input_file
=
re
.
sub
(
r'^[\.\/]*'
,
''
,
input_file
)
if
not
options
.
failedOnly
:
find_module_name
=
re
.
search
(
r'([^_]*)'
,
input_file
)
print
'
\n
Overall time:
%.2
f min
\n
'
%
overall_time
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
tbl
.
consolePrintTable
(
sys
.
stdout
)
tbl
.
consolePrintTable
(
sys
.
stdout
)
print
4
*
'
\n
'
print
2
*
'
\n
'
\ No newline at end of file
\ 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