| 111 | | import hotshot, hotshot.stats |
|---|
| 112 | | prof = hotshot.Profile('demo-gaphas.prof') |
|---|
| 113 | | prof.runcall(main) |
|---|
| 114 | | prof.close() |
|---|
| 115 | | stats = hotshot.stats.load('demo-gaphas.prof') |
|---|
| 116 | | stats.strip_dirs() |
|---|
| 117 | | stats.sort_stats('time', 'calls') |
|---|
| 118 | | stats.print_stats(20) |
|---|
| | 111 | try: |
|---|
| | 112 | import cProfile |
|---|
| | 113 | import pstats |
|---|
| | 114 | cProfile.run('main()', 'demo-gaphas.prof') |
|---|
| | 115 | p = pstats.Stats('demo-gaphas.prof') |
|---|
| | 116 | p.strip_dirs().sort_stats('time').print_stats(20) |
|---|
| | 117 | except ImportError, ex: |
|---|
| | 118 | import hotshot, hotshot.stats |
|---|
| | 119 | import gc |
|---|
| | 120 | prof = hotshot.Profile('demo-gaphas.prof') |
|---|
| | 121 | prof.runcall(main) |
|---|
| | 122 | prof.close() |
|---|
| | 123 | stats = hotshot.stats.load('demo-gaphas.prof') |
|---|
| | 124 | stats.strip_dirs() |
|---|
| | 125 | stats.sort_stats('time', 'calls') |
|---|
| | 126 | stats.print_stats(20) |
|---|