Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CoPaR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
CoPaR
Commits
139877fb
Commit
139877fb
authored
4 years ago
by
Bastian Kauschke
Browse files
Options
Downloads
Patches
Plain Diff
refactor Main.hs
parent
e38e705e
Branches
Branches containing commit
No related tags found
1 merge request
!47
refactor some more
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/Main.hs
+67
-92
67 additions, 92 deletions
src/main/Main.hs
with
67 additions
and
92 deletions
src/main/Main.hs
+
67
−
92
View file @
139877fb
...
...
@@ -27,6 +27,7 @@ import Options.Applicative
import
Copar.Algorithm
import
qualified
Copar.Parser
as
P
import
Copar.Coalgebra.Parser
(
SymbolTable
)
import
Copar.PartitionPrinter
import
Copar.FunctorPrinter
import
Copar.Functors
...
...
@@ -448,52 +449,11 @@ main = do
stats
<-
initStats
(
refineStats
r
)
(
refineStatsJson
r
)
withTimeStat
stats
"overall-duration"
$
do
(
_
,
(
symbolTable
,
encoding
))
<-
withTimeStat
stats
"parse-duration"
$
do
readCoalgebra
(
refineParseConfig
r
)
(
refineInputFile
r
)
>>=
\
case
Left
err
->
hPutStrLn
stderr
err
>>
exitFailure
Right
res
->
evaluate
res
logStat
stats
"states"
(
tshow
(
Encoding
.
size
encoding
))
logStat
stats
"edges"
(
tshow
(
Encoding
.
numEdges
encoding
))
let
isFirstSort
x
=
sortedSort
x
==
1
logStat
stats
"explicit-states"
(
tshow
(
length
(
V
.
filter
isFirstSort
(
Encoding
.
structure
encoding
))))
partition
<-
case
statsType
stats
of
NoStats
->
withTimeStat
stats
"algorithm-duration"
(
stToIO
(
refine
(
Proxy
::
Proxy
(
Desorted
SomeFunctor
))
encoding
(
refineEnableOpt
r
))
)
_
->
do
(
part
,
algoStats
)
<-
withTimeStat
stats
"algorithm-duration"
$
refineWithStats
(
Proxy
::
Proxy
(
Desorted
SomeFunctor
))
encoding
(
refineEnableOpt
r
)
logStat
stats
"initial-partition-size"
(
tshow
(
initialBlocks
algoStats
))
logStat
stats
"initialize-duration"
(
showTimeDiff
(
initTime
algoStats
))
logStat
stats
"split-operation-count"
(
tshow
(
splitCount
algoStats
))
logStat
stats
"refine-duration"
(
showTimeDiff
(
refineTime
algoStats
))
logStat
stats
"size1-skipped"
(
tshow
(
size1Skipped
algoStats
))
return
part
logStat
stats
"final-partition-size"
(
tshow
(
Partition
.
numBlocks
partition
))
logStat
stats
"explicit-final-partition-size"
(
tshow
(
length
(
restrictPartitionToSort1
encoding
partition
)))
(
_f
,
symbolTable
,
encoding
,
partition
)
<-
refinementStep
stats
(
refineInputFile
r
)
(
refineParseConfig
r
)
(
refineEnableOpt
r
)
withTimeStat
stats
...
...
@@ -506,52 +466,11 @@ main = do
stats
<-
initStats
(
minimizeStats
r
)
(
minimizeStatsJson
r
)
withTimeStat
stats
"overall-duration"
$
do
(
f
,
(
symbolTable
,
encoding
))
<-
withTimeStat
stats
"parse-duration"
$
do
readCoalgebra
(
minimizeParseConfig
r
)
(
minimizeInputFile
r
)
>>=
\
case
Left
err
->
hPutStrLn
stderr
err
>>
exitFailure
Right
res
->
evaluate
res
logStat
stats
"states"
(
tshow
(
Encoding
.
size
encoding
))
logStat
stats
"edges"
(
tshow
(
Encoding
.
numEdges
encoding
))
let
isFirstSort
x
=
sortedSort
x
==
1
logStat
stats
"explicit-states"
(
tshow
(
length
(
V
.
filter
isFirstSort
(
Encoding
.
structure
encoding
))))
part
<-
case
statsType
stats
of
NoStats
->
withTimeStat
stats
"algorithm-duration"
(
stToIO
(
refine
(
Proxy
::
Proxy
(
Desorted
SomeFunctor
))
encoding
(
minimizeEnableOpt
r
))
)
_
->
do
(
part
,
algoStats
)
<-
withTimeStat
stats
"algorithm-duration"
$
refineWithStats
(
Proxy
::
Proxy
(
Desorted
SomeFunctor
))
encoding
(
minimizeEnableOpt
r
)
logStat
stats
"initial-partition-size"
(
tshow
(
initialBlocks
algoStats
))
logStat
stats
"initialize-duration"
(
showTimeDiff
(
initTime
algoStats
))
logStat
stats
"split-operation-count"
(
tshow
(
splitCount
algoStats
))
logStat
stats
"refine-duration"
(
showTimeDiff
(
refineTime
algoStats
))
logStat
stats
"size1-skipped"
(
tshow
(
size1Skipped
algoStats
))
return
part
logStat
stats
"final-partition-size"
(
tshow
(
Partition
.
numBlocks
part
))
logStat
stats
"explicit-final-partition-size"
(
tshow
(
length
(
restrictPartitionToSort1
encoding
part
)))
(
f
,
symbolTable
,
encoding
,
part
)
<-
refinementStep
stats
(
minimizeInputFile
r
)
(
minimizeParseConfig
r
)
(
minimizeEnableOpt
r
)
(
encoding'
,
symbolTable'
)
<-
withTimeStat
stats
"minimize-duration"
$
evaluate
(
minimize
f
encoding
symbolTable
part
)
...
...
@@ -661,6 +580,62 @@ helpOverview argv0 =
paragraph
=
line
<>
line
noflow
x
=
softline
<>
x
<>
softline
refinementStep
::
Stats
->
Maybe
FilePath
->
P
.
Config
->
Bool
->
IO
(
FunctorExpression
SomeFunctor
Sort
,
SymbolTable
,
Encoding
.
Encoding
_
_
,
Partition
.
Partition
)
refinementStep
stats
inputFile
parseConfig
enableOpt
=
do
(
f
,
(
symbolTable
,
encoding
))
<-
withTimeStat
stats
"parse-duration"
$
do
readCoalgebra
(
parseConfig
)
(
inputFile
)
>>=
\
case
Left
err
->
hPutStrLn
stderr
err
>>
exitFailure
Right
res
->
evaluate
res
logStat
stats
"states"
(
tshow
(
Encoding
.
size
encoding
))
logStat
stats
"edges"
(
tshow
(
Encoding
.
numEdges
encoding
))
let
isFirstSort
x
=
sortedSort
x
==
1
logStat
stats
"explicit-states"
(
tshow
(
length
(
V
.
filter
isFirstSort
(
Encoding
.
structure
encoding
))))
part
<-
case
statsType
stats
of
NoStats
->
withTimeStat
stats
"algorithm-duration"
(
stToIO
(
refine
(
Proxy
::
Proxy
(
Desorted
SomeFunctor
))
encoding
enableOpt
)
)
_
->
do
(
part
,
algoStats
)
<-
withTimeStat
stats
"algorithm-duration"
$
refineWithStats
(
Proxy
::
Proxy
(
Desorted
SomeFunctor
))
encoding
enableOpt
logStat
stats
"initial-partition-size"
(
tshow
(
initialBlocks
algoStats
))
logStat
stats
"initialize-duration"
(
showTimeDiff
(
initTime
algoStats
))
logStat
stats
"split-operation-count"
(
tshow
(
splitCount
algoStats
))
logStat
stats
"refine-duration"
(
showTimeDiff
(
refineTime
algoStats
))
logStat
stats
"size1-skipped"
(
tshow
(
size1Skipped
algoStats
))
return
part
logStat
stats
"final-partition-size"
(
tshow
(
Partition
.
numBlocks
part
))
logStat
stats
"explicit-final-partition-size"
(
tshow
(
length
(
restrictPartitionToSort1
encoding
part
)))
return
(
f
,
symbolTable
,
encoding
,
part
)
printHelp
::
Text
->
Maybe
HelpCommand
->
IO
()
printHelp
argv0
Nothing
=
putDoc
(
helpOverview
argv0
)
>>
putStrLn
""
printHelp
_
(
Just
HelpListFunctors
)
=
...
...
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