File: profiler.py

package info (click to toggle)
pywavefront 1.3.3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,112 kB
  • sloc: python: 1,586; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (2)
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
import cProfile
import pstats
import sys

try:
    from StringIO import StringIO
except:
    from io import StringIO


if len(sys.argv) < 2:
    print("Usage: profiler.py <obj file>")
    exit(1)

# Run the profiler
pr = cProfile.Profile()
pr.enable()
import pywavefront
pywavefront.Wavefront(sys.argv[1])
pr.disable()

# Print the stats
s = StringIO()
sortby = 'tottime'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())