add profiling scripts
#279
Python provides cProfile module to help us profiling python codes. A common usage can be:
python -m cProfile -o train.prof train.py
Since train.prof is a binary file, we have to transfer it into readable text or graph. The Pstats module’s Stats class has a variety of methods for manipulating and printing the data saved into a profile results file. Following is the usage:
import pstats
p = pstats.Stats('train.prof)
p.strip_dirs().sort_stats("time").print_stats(20)
p.strip_dirs().sort_stats("cumtime").print_stats(20)
And gprof2dot is a Python script to convert the output from profilers into a dot graph. Following is the usage:
gprof2dot -f pstats train.prof | dot -Tpng -o train.prof.png
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.