Python: Exemple de profilage d’un programme

Author:

 module
{filelink=16951}

import profile
 
def func1(x):
    for i in range(x):
        pass
 
def func2():
    for i in range(1000):
        func1(i)
 
profile.run("func2()")
 
"""
 ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.112    0.112 <string>:0(<module>)
     1000    0.091    0.000    0.091    0.000 Profilage.py:4(func1)
        1    0.021    0.021    0.112    0.112 Profilage.py:8(func2)
        1    0.035    0.035    0.147    0.147 profile:0(func2())
        0    0.000             0.000          profile:0(profiler)
 
       """

Livres Sur ce Sujet

Apprendre à programmer avec Python 3 Apprenez à programmer en Python Python : Petit guide à l’usage du développeur agile Apprendre à programmer avec Python 3 : Avec plus de 50 pages de corigés d’exercices !

Leave a Reply

Your email address will not be published. Required fields are marked *


one × = 5