-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsimulate.py
41 lines (31 loc) · 800 Bytes
/
simulate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
__author__ = 'pokey'
import getopt
import sys
from simulator import Simulator
import cProfile, pstats, StringIO
def usage():
print("BLABLABLA")
def main(argv):
fname = ""
try:
opts, args = getopt.getopt(argv, "hf:", ["help", "file="])
except getopt.GetoptError:
usage()
sys.exit(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit()
elif opt in ("-f", "--file"):
fname = arg
sim = Simulator()
# pr = cProfile.Profile()
# pr.enable()
sim.run(fname)
# s = StringIO.StringIO()
# sortby = 'cumulative'
# ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
# ps.print_stats()
# print s.getvalue()
if __name__ == "__main__":
main(sys.argv[1:])