# profile_PyText3.py
# Written by Todd Wareham for CS 2500
"""
This script illustrates an elementary profiling analysis of the runtimes of 
 the various functions in textfile comparison script PyText2.py.
 
This analysis is implemented using the profile and pstats modules.
 """

import sys
import PyText3
import profile
import pstats


if len(sys.argv) != 2:
    print "usage: profile_PyText3 <PyText3-script>"
    sys.exit(1)

profile.run("PyText3.interpret(\"%s\")" % (sys.argv[1],), 
            sys.argv[1] + ".prof")
s = pstats.Stats(sys.argv[1] + ".prof")
s.sort_stats("calls")
s.print_stats()

