Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
N
nofib
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
nofib
Commits
e16b42a5
Commit
e16b42a5
authored
May 20, 2019
by
Ben Gamari
🐢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make relative mode configurable
parent
88b92b82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
Compare.hs
shake/Compare.hs
+20
-9
No files found.
shake/Compare.hs
View file @
e16b42a5
...
...
@@ -20,22 +20,27 @@ import qualified MeasurementTree as MTree
import
MeasurementTree
(
Measurements
,
Label
)
import
LabelMatch
args
::
Parser
[
FilePath
]
args
=
some
$
argument
str
(
metavar
"FILE"
<>
help
"results.json file"
)
data
Mode
=
RelativeMode
|
AbsoluteMode
args
::
Parser
(
Mode
,
[
FilePath
])
args
=
(,)
<$>
flag
RelativeMode
AbsoluteMode
(
long
"absolute"
<>
short
'a'
<>
help
"show absolute metrics"
)
<*>
some
(
argument
str
(
metavar
"FILE"
<>
help
"results.json file"
))
-- | Pick out the interesting part of a set of filenames for use as a friendly
-- name. Essentially we just break up all paths into their components and drop
-- all components common to all.
friendlyNameFiles
::
[
FilePath
]
->
M
.
Map
String
FilePath
friendlyNameFiles
files
=
M
.
fromList
friendlyNameFiles
files
=
M
.
fromList
[
(
joinPath
$
toList
name
,
path
)
|
(
path
,
name
)
<-
M
.
toList
friendlyNames
]
where
friendlyNames
::
M
.
Map
FilePath
(
Seq
.
Seq
String
)
friendlyNames
=
fmap
(
fmap
snd
.
Seq
.
filter
(
not
.
fst
)
.
Seq
.
zip
isCommon
)
splitPaths
fmap
(
fmap
snd
.
Seq
.
filter
(
not
.
fst
)
.
Seq
.
zip
isCommon
)
splitPaths
where
isCommon
::
Seq
.
Seq
Bool
isCommon
=
Seq
.
fromList
$
fmap
isCommonComp
[
0
..
maximum
$
fmap
length
splitPaths
]
...
...
@@ -51,7 +56,7 @@ friendlyNameFiles files =
main
::
IO
()
main
=
do
files
<-
execParser
$
info
(
helper
<*>
args
)
mempty
(
mode
,
files
)
<-
execParser
$
info
(
helper
<*>
args
)
mempty
let
filesWithFriendlyNames
=
friendlyNameFiles
files
-- Yuck. Figure out friendly name of reference set
[
ref
]
=
[
name
...
...
@@ -68,9 +73,15 @@ main = do
[
heading
,
replicate
20
'='
,
""
,
let
showRel
=
(
maybe
"-"
(
showRelative
$
showGFloat
(
Just
3
)))
table
=
toTable
$
toRelativeChange
ref
xs
in
render
show
show
showRel
table
,
case
mode
of
RelativeMode
->
let
showRel
=
(
maybe
"-"
(
showRelative
$
showGFloat
(
Just
3
)))
table
=
toTable
$
toRelativeChange
ref
xs
in
render
show
show
showRel
table
AbsoluteMode
->
let
showVal
=
(
maybe
"-"
(
\
x
->
showGFloat
(
Just
3
)
x
""
))
table
=
toTable
xs
in
render
show
show
showVal
table
,
""
]
where
...
...
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