forked from bnnm/wwiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwwiser.py
48 lines (38 loc) · 870 Bytes
/
wwiser.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
42
43
44
45
46
47
48
#!/usr/bin/env python3
# (should work for python2 and 3)
#
# Wwiser bnk parser by bnnm
import sys
from wwiser import wcli
from wwiser import wgui
_PROFILE = False
def main():
if len(sys.argv) > 1:
wcli.Cli().start()
else:
wgui.Gui().start()
def profile_simple():
try:
import cProfile as profile
except:
import profile
profile.run('wcli.Cli().start()')
def profile_complex():
import pstats
try:
import cProfile as profile
except:
import profile
#profile.run('wcli.Cli().start()')
profiler = profile.Profile()
profiler.enable()
main()
profiler.disable()
sort = 'cumtime' #tottime ncalls
stats = pstats.Stats(profiler).sort_stats(sort)
stats.print_stats()
if __name__ == "__main__":
if _PROFILE:
profile_complex()
else:
main()