Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8353589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:18:34+00:00 2026-06-09T09:18:34+00:00

I tried to use Python profiler statprof for profiling some of my code. The

  • 0

I tried to use Python profiler statprof for profiling some of my code. The documentation says that if a procedure is encountered multiple times, it is only counted once. However in the output of the profile i see multiple occurrences of the same procedure with different line numbers. Anybody has any idea what this might be showing?

eg output

  0.00      0.01      0.00  box.py:1305:**do_forever**

  0.00      0.01      0.00  httplib.py:981:_send_request

  0.00      0.01      0.00  box.py:1295:**do_forever**

  0.00      0.01      0.00  box.py:1295:**do_forever**

  0.00      0.01      0.00  sre_compile.py:486:_code

  0.00      0.01      0.00  box.py:923:get_user_file_info

  0.00      0.00      0.00  box.py:776:update_all_internal_user_stats_batch
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:18:35+00:00Added an answer on June 9, 2026 at 9:18 am

    I just looked at the doc and what it says is if a procedure is encountered more than once in a single stack sample, it is only counted once.
    (I assume here the term “procedure” should really be “line of code in a procedure”.)

    What that means is – if there is recursion going on, you don’t want the time cost of a function to be artificially amplified by the depth of the recursion.

    Also, I would point out some other things (explained in more detail here):

    The first column is “% time” not counting children, i.e. self percent. That’s a useless statistic, because there is almost nothing that is not a procedure call, and looking at the line you can tell if it is a procedure call.

    The second column is “cumulative time” including children. That’s fine, but it should be percent, so that you don’t have to divide by total time to see what percent it is.
    The reason that number matters is it represents what the line is responsible for – the fraction of total time that could be saved if that line were not there.

    The third column is “self time” which, as I explained, is a useless statistic.
    The fact that it’s extremely small or zero reflects its uselessness.
    Since it is included in the cumulative time, if it were not extremely small, the cumulative time would also show it, so it tells you nothing that the cumulative time doesn’t.

    Also, as the author points out, samples are suspended during I/O,
    so if it is doing some I/O that you didn’t want or ask for, deep in some library,
    and if that is making the program take 100 times as long as it otherwise would,
    the profiler (and you) will be totally unaware of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use python-rest-client package into my project. I tried several times for
I tried IronPython some time ago and it seemed that it implements only python
I tried to use Cleaver, that is PhoneGap / Cordova as a component of
I tried to run the following code from http://docs.python.org/library/mmap.html import mmap # write a
I have tried to use Python's ConfigParser module to save settings. For my app
I read that I can use Python's Format Specification Mini-Language to have more control
I want to use python to write code for another language which doesn't understand
When I need code template, I can use Python as follows. templateString = %s
I installed python-mysqldb using sudo apt-get install python-mysqldb I have tried to use it
I'm trying to install said library for use with Python. I tried downloading the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.