Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guillaume CLOCHARD
Ragnulf
Commits
934c8606
Commit
934c8606
authored
Jan 13, 2016
by
Guillaume CLOCHARD
Browse files
Merge branch 'temps_execution'
parents
1bb254f5
03cc13ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
stats_temps.py
0 → 100644
View file @
934c8606
import
time
import
json
from
Cube
import
*
from
algo
import
algo_cfop
from
lire_entree
import
lecture_cube
from
stats
import
*
"""
Génération de stats sur le temps
d'éxécution
"""
JEU_TEST
=
'tests/samples/liste-sample.json'
DEFAULT_CUBE
=
'OGRBWYBGBGYYOYOWOWGRYOOOBGBRRYRBWWWRBWYGROWGRYBRGYWBOG'
# Renvois le temps d'éxecution du cube test donné dans poqb.py
def
getTimeDefaultCube
():
tmps1
=
time
.
clock
()
b
,
c
=
lecture_cube
(
DEFAULT_CUBE
)
c
,
mouv
=
algo_cfop
(
c
)
# on fais l'algo
tmps2
=
time
.
clock
()
return
tmps2
-
tmps1
# Renvois dans une liste le temps d'éxecution des 11400 cubes
def
getTimes11400Cubes
():
liste
=
[]
with
open
(
JEU_TEST
)
as
data_file
:
#on parse le jeu de test JSON
data
=
json
.
load
(
data_file
)
tests
=
data
[
"cubes"
]
for
test
in
tests
:
# on parcours tout les cubes
tmps1
=
time
.
clock
()
b
,
c
=
lecture_cube
(
test
)
c
,
mouv
=
algo_cfop
(
c
)
# on fais l'algo
tmps2
=
time
.
clock
()
liste
.
append
(
tmps2
-
tmps1
)
return
liste
liste
=
getTimes11400Cubes
()
print
(
"Temps éxecution cube test : "
+
str
(
getTimeDefaultCube
())
+
"s"
)
# cube test
print
(
"Temps éxecution 11400 cubes : "
+
str
(
sum
(
liste
))
+
"s"
)
print
(
"Moyenne d'éxecution de 11400 cubes : "
+
str
(
moyenne
(
liste
))
+
"s"
)
print
(
"Écart type 11400 cubes : "
+
str
(
ecart_type
(
liste
))
+
"s"
)
Write
Preview
Supports
Markdown
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