Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexis King
GHC
Commits
c2cb5e9a
Commit
c2cb5e9a
authored
3 years ago
by
Ben Gamari
Committed by
Marge Bot
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
testsuite: Print geometric mean of stat metrics
As suggested in #20733.
parent
0833ad55
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testsuite/driver/runtests.py
+14
-0
14 additions, 0 deletions
testsuite/driver/runtests.py
with
14 additions
and
0 deletions
testsuite/driver/runtests.py
+
14
−
0
View file @
c2cb5e9a
...
@@ -9,11 +9,13 @@ import signal
...
@@ -9,11 +9,13 @@ import signal
import
sys
import
sys
import
os
import
os
import
io
import
io
import
operator
import
shutil
import
shutil
import
tempfile
import
tempfile
import
time
import
time
import
re
import
re
import
traceback
import
traceback
from
functools
import
reduce
from
pathlib
import
Path
from
pathlib
import
Path
# We don't actually need subprocess in runtests.py, but:
# We don't actually need subprocess in runtests.py, but:
...
@@ -361,6 +363,9 @@ def cleanup_and_exit(exitcode):
...
@@ -361,6 +363,9 @@ def cleanup_and_exit(exitcode):
shutil
.
rmtree
(
tempdir
,
ignore_errors
=
True
)
shutil
.
rmtree
(
tempdir
,
ignore_errors
=
True
)
exit
(
exitcode
)
exit
(
exitcode
)
def
geometric_mean
(
xs
:
List
[
float
])
->
float
:
return
reduce
(
operator
.
mul
,
xs
)
**
(
1.
/
len
(
xs
))
def
tabulate_metrics
(
metrics
:
List
[
PerfMetric
])
->
None
:
def
tabulate_metrics
(
metrics
:
List
[
PerfMetric
])
->
None
:
abbrevLen
=
get_abbrev_hash_length
()
abbrevLen
=
get_abbrev_hash_length
()
hasBaseline
=
any
([
x
.
baseline
is
not
None
for
x
in
metrics
])
hasBaseline
=
any
([
x
.
baseline
is
not
None
for
x
in
metrics
])
...
@@ -399,6 +404,15 @@ def tabulate_metrics(metrics: List[PerfMetric]) -> None:
...
@@ -399,6 +404,15 @@ def tabulate_metrics(metrics: List[PerfMetric]) -> None:
"
{}
"
.
format
(
x
.
change
.
hint
())
"
{}
"
.
format
(
x
.
change
.
hint
())
))
for
x
in
sorted
(
metrics
,
key
=
))
for
x
in
sorted
(
metrics
,
key
=
lambda
m
:
(
m
.
stat
.
test
,
m
.
stat
.
way
,
m
.
stat
.
metric
))]
lambda
m
:
(
m
.
stat
.
test
,
m
.
stat
.
way
,
m
.
stat
.
metric
))]
geoMean
=
geometric_mean
([
x
.
stat
.
value
/
x
.
baseline
.
perfStat
.
value
for
x
in
metrics
if
x
.
baseline
is
not
None
])
dataRows
+=
[
row
((
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
)),
row
((
"
geo. mean
"
,
""
,
""
,
""
,
""
,
""
,
"
{:+4.1f}%
"
.
format
(
100
*
(
geoMean
-
1
)),
""
))
]
print_table
(
headerRows
,
dataRows
,
1
)
print_table
(
headerRows
,
dataRows
,
1
)
print
(
""
)
print
(
""
)
if
hasBaseline
:
if
hasBaseline
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment