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 6789205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:34:33+00:00 2026-05-26T17:34:33+00:00

I am using Google CPU Profiling tool. http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html On the documentation it is given

  • 0

I am using Google CPU Profiling tool.

http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html

On the documentation it is given

Analyzing Text Output

Text mode has lines of output that look like this:

   14   2.1%  17.2%       58   8.7% std::_Rb_tree::find

Here is how to interpret the columns:

  • Number of profiling samples in this
    function
  • Percentage of profiling
    samples in this function
  • Percentage
    of profiling samples in the functions
    printed so far
  • Number of profiling
    samples in this function and its
    callees
  • Percentage of profiling
    samples in this function and its
    callees
  • Function name

But I am not able to understand which columns tell me exact or percentage CPU usages of function ?

How to get CPU uses of a function suing google profile ?

  • 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-05-26T17:34:34+00:00Added an answer on May 26, 2026 at 5:34 pm

    Text mode has lines of output that look like this:

    It will have a lot of lines, for example, collect profile:

    $ CPUPROFILE=a.pprof LD_PRELOAD=./libprofiler.so ./a.out
    

    The program a.out is the same as here: Kcachegrind/callgrind is inaccurate for dispatcher functions?

    Then analyze it with pprof top command:

    $ pprof ./a.out a.pprof
    Using local file ./a.out.
    Using local file a.pprof.
    Welcome to pprof!  For help, type 'help'.
    (pprof) top
    Total: 185 samples
          76  41.1%  41.1%       76  41.1% do_4
          51  27.6%  68.6%       51  27.6% do_3
          37  20.0%  88.6%       37  20.0% do_2
          21  11.4% 100.0%       21  11.4% do_1
           0   0.0% 100.0%      185 100.0% __libc_start_main
           0   0.0% 100.0%      185 100.0% dispatcher
           0   0.0% 100.0%       34  18.4% first2
           0   0.0% 100.0%       42  22.7% inner2
           0   0.0% 100.0%       68  36.8% last2
           0   0.0% 100.0%      185 100.0% main
    

    So, what is here: the total sample count is 185; and the Frequency is the default (1 sample every 10 ms; or 100 samples per second). Then total runtime is ~ 1.85 second.

    First column is the number of samples, which was taken when a.out works in the given function. If we divide it by Frequency, we will get total time estimation of given function, e.g. do_4 runs for ~0.8 sec

    Second column is the sample count in given function divided by total count, or the percentage of this function in total program run time. So do_4 is the slowest function (41% of total program time) and do_1 is only 11% of program runtime. I think you are interested in this column.

    Third column is the sum of current and preceding lines; so we can know that 2 slowest functions, do_4 and do_3 totally accounted for 68% of total run time (41%+27%)

    4rd and 5th columns are like first and second; but these one will account not only samples of the given function itself, but also samples of all functions called from given, both directly and indirectly. You can see, that main and all called from it is 100% of total run time (because main is the program itself; or root of calltree of program) and last2 with its children is 36.8% of runtime (its children in my program are: half of calls to do_4 and half of calls to do_3 = 41.1 + 27.6 /2 = 69.7/2 ~= 34% + some time in the function itself)

    PS: there are some other useful pprof commands, like callgrind or gv which shows graphic representation of call tree with profiling information added.

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

Sidebar

Related Questions

I am using google's perftools ( http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html ) for CPU profiling---it's a wonderful tool
Seems like both EnyimMemcached ( https://github.com/enyim/EnyimMemcached ) and BeITMemcached ( http://code.google.com/p/beitmemcached/ ) are popular
Using google's Protocul Buffers , I have a service already written in Java which
Using Google Apps for your Domain, is it possible to set up a catch-all
Using Google + Bing didn't yield an answer to what should be a simple
When using Google Chrome, I want to debug some JavaScript code. How can I
When using Google Reader and browsing RSS entries in the Expanded view, entries will
Currently using Google Analytics as a supplement to our paid tracking software, but neither
When using Google app engine is there any benefit to use a CDN if
Have just started using Google Chrome , and noticed in parts of our site,

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.