Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • The profile Module in python

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 254
    Comment on it

    The profile module is a standard Python profiler. And with the help of profile module we can run the profiler from the command line. For example you can see the below code.

    #!/usr/bin/python
    vara = 17
    varb = 400
    sum = vara + varb
    print "vara + varb = %d" % sum
    Now, try running cProfile.py over this file sum.py as follows 
    $cProfile.py sum.py
    vara + varb = 417
     4 function calls in 0.000 CPU seconds

    Note: Ordered by: standard name

    Output:

    ncalls  tottime  percall  cumtime  percall filename:lineno
       1    0.000    0.000    0.000    0.000 :1()
       1    0.000    0.000    0.000    0.000 sum.py:3()
       1    0.000    0.000    0.000    0.000 {execfile}
       1    0.000    0.000    0.000    0.000 {method ......}

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: