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
f57d692c
Commit
f57d692c
authored
Dec 24, 2012
by
Anna Kogan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved code
parent
e1331b44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
perf_tests_timing.py
modules/ts/misc/perf_tests_timing.py
+22
-24
No files found.
modules/ts/misc/perf_tests_timing.py
View file @
f57d692c
...
@@ -7,28 +7,24 @@ from operator import itemgetter, attrgetter
...
@@ -7,28 +7,24 @@ from operator import itemgetter, attrgetter
from
summary
import
getSetName
,
alphanum_keyselector
from
summary
import
getSetName
,
alphanum_keyselector
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
usage
=
"
%
prog <log_name>.xml"
usage
=
"
%
prog <log_name>.xml
[...]
"
parser
=
OptionParser
(
usage
=
usage
)
parser
=
OptionParser
(
usage
=
usage
)
for
arg
in
sys
.
argv
:
parser
.
add_option
(
"-o"
,
"--output"
,
dest
=
"format"
,
print
arg
help
=
"output results in text format (can be 'txt', 'html' or 'auto' - default)"
,
metavar
=
'FMT'
,
default
=
'auto'
)
parser
.
add_option
(
"-o"
,
"--output"
,
dest
=
"format"
,
help
=
"output results in text format (can be 'txt', 'html' or 'auto' - default)"
,
metavar
=
"FMT"
,
default
=
"auto"
)
(
options
,
args
)
=
parser
.
parse_args
()
(
options
,
args
)
=
parser
.
parse_args
()
options
.
generateHtml
=
detectHtmlOutputType
(
options
.
format
)
if
1
!=
len
(
args
):
if
1
!=
len
(
args
):
parser
.
print_help
()
parser
.
print_help
()
exit
(
0
)
exit
(
0
)
options
.
generateHtml
=
detectHtmlOutputType
(
options
.
format
)
# expand wildcards and filter duplicates
# expand wildcards and filter duplicates
file
=
os
.
path
.
abspath
(
args
[
0
])
file
=
os
.
path
.
abspath
(
args
[
0
])
if
not
os
.
path
.
isfile
(
file
):
if
not
os
.
path
.
isfile
(
file
):
print
'Incorrect file name!'
sys
.
stderr
.
write
(
"IOError reading
\"
"
+
file
+
"
\"
- "
+
str
(
err
)
+
os
.
linesep
)
parser
.
print_help
()
parser
.
print_help
()
exit
(
0
)
exit
(
0
)
...
@@ -71,7 +67,8 @@ if __name__ == "__main__":
...
@@ -71,7 +67,8 @@ if __name__ == "__main__":
groupName
=
next
(
c
for
c
in
cases
if
c
)
.
shortName
()
groupName
=
next
(
c
for
c
in
cases
if
c
)
.
shortName
()
if
groupName
!=
prevGroupName
:
if
groupName
!=
prevGroupName
:
if
prevGroupName
!=
None
:
if
prevGroupName
!=
None
:
testsuits
.
append
((
prevGroupName
,
suit_time
,
has_failed
))
testsuits
.
append
({
'name'
:
prevGroupName
,
'time'
:
suit_time
,
\
'failed'
:
has_failed
})
has_failed
=
False
has_failed
=
False
suit_time
=
0
suit_time
=
0
prevGroupName
=
groupName
prevGroupName
=
groupName
...
@@ -79,29 +76,30 @@ if __name__ == "__main__":
...
@@ -79,29 +76,30 @@ if __name__ == "__main__":
for
i
in
range
(
setsCount
):
for
i
in
range
(
setsCount
):
case
=
cases
[
i
]
case
=
cases
[
i
]
if
not
case
is
None
:
if
not
case
is
None
:
if
case
.
get
(
"status"
)
==
"run"
:
if
case
.
get
(
'status'
)
==
'run'
:
suit_time
+=
case
.
get
(
"time"
)
suit_time
+=
case
.
get
(
'time'
)
if
case
.
get
(
"status"
)
==
"failed"
:
if
case
.
get
(
'status'
)
==
'failed'
:
has_failed
=
True
has_failed
=
True
tbl
=
table
()
tbl
=
table
()
# header
# header
tbl
.
newColumn
(
"name"
,
"Name"
,
align
=
"left"
,
cssclass
=
"col_name"
)
tbl
.
newColumn
(
'name'
,
'Name of testsuit'
,
align
=
'left'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
"time"
,
"Time (ms)"
,
align
=
"left"
,
cssclass
=
"col_name"
)
tbl
.
newColumn
(
'time'
,
'Time (ms)'
,
align
=
'left'
,
cssclass
=
'col_name'
)
tbl
.
newColumn
(
"failed"
,
"Failed tests"
,
align
=
"center"
,
cssclass
=
"col_name"
)
tbl
.
newColumn
(
'failed'
,
'Failed tests'
,
align
=
'center'
,
cssclass
=
'col_name'
)
# rows
# rows
for
suit
in
sorted
(
testsuits
,
key
=
lambda
suit
:
suit
[
1
],
reverse
=
True
):
for
suit
in
sorted
(
testsuits
,
key
=
lambda
suit
:
suit
[
'time'
],
reverse
=
True
):
tbl
.
newRow
()
tbl
.
newRow
()
tbl
.
newCell
(
"name"
,
suit
[
0
])
tbl
.
newCell
(
'name'
,
suit
[
'name'
])
tbl
.
newCell
(
"time"
,
formatValue
(
suit
[
1
],
""
,
""
),
suit
[
1
])
tbl
.
newCell
(
'time'
,
formatValue
(
suit
[
'time'
],
''
,
''
),
suit
[
'time'
])
if
(
suit
[
2
]):
if
(
suit
[
'failed'
]):
tbl
.
newCell
(
"failed"
,
"Yes"
)
tbl
.
newCell
(
'failed'
,
'Yes'
)
else
:
tbl
.
newCell
(
'failed'
,
' '
)
# output table
# output table
if
options
.
generateHtml
:
if
options
.
generateHtml
:
htmlPrintHeader
(
sys
.
stdout
,
"Timings of
%
s tests from
%
s test logs"
%
(
len
(
test_cases
),
setsCount
))
tbl
.
htmlPrintTable
(
sys
.
stdout
)
tbl
.
htmlPrintTable
(
sys
.
stdout
)
htmlPrintFooter
(
sys
.
stdout
)
htmlPrintFooter
(
sys
.
stdout
)
else
:
else
:
...
...
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