Skip to content

Youtube dl : Profiling Guide

zerocity edited this page Aug 25, 2014 · 1 revision

Raw dump :) will be inproved later

git clone https://github.com/rg3/youtube-dl.git

....

 def main(argv=None):
     try:
+        print('USE cProfile')
+        #_real_main(argv)
+        import cProfile
+        import pstats
+        cProfile.runctx('_real_main(argv)',globals(),locals(),'cProfileDump')
+        p = pstats.Stats('cProfileDump')
+        p.sort_stats('time').print_stats(20)

to enable profiling

to start the python script :

python -m youtube_dl https://www.youtube.com/watch?v=07FYdnEawAQ -g --prefer-insecure

to analyse the the profiledata

gprof2dot -f pstats cProfileDump | dot -Tpng -o output.png
Clone this wiki locally