|
Revision 2335, 0.6 kB
(checked in by arj..@yirdis.nl, 3 months ago)
|
more profile cleanup.
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
from demo import * |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
if __name__ == '__main__': |
|---|
| 7 |
try: |
|---|
| 8 |
import cProfile |
|---|
| 9 |
import pstats |
|---|
| 10 |
cProfile.run('main()', 'demo-gaphas.prof') |
|---|
| 11 |
p = pstats.Stats('demo-gaphas.prof') |
|---|
| 12 |
p.strip_dirs().sort_stats('time').print_stats(40) |
|---|
| 13 |
except ImportError, ex: |
|---|
| 14 |
import hotshot, hotshot.stats |
|---|
| 15 |
import gc |
|---|
| 16 |
prof = hotshot.Profile('demo-gaphas.prof') |
|---|
| 17 |
prof.runcall(main) |
|---|
| 18 |
prof.close() |
|---|
| 19 |
stats = hotshot.stats.load('demo-gaphas.prof') |
|---|
| 20 |
stats.strip_dirs() |
|---|
| 21 |
stats.sort_stats('time', 'calls') |
|---|
| 22 |
stats.print_stats(20) |
|---|
| 23 |
|
|---|
| 24 |
|
|---|