Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Any one has idea how to find cpu utilization of functions in a process in linux platform. top command will give process cpu utilization. I need to know cpu utilization of individual functions in the process..
Click here to see the post LQ members have rated as the most helpful post in this thread.
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
% the percentage of the total running time of the
time program used by this function.
cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.
self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.
calls the number of times this function was invoked, if
this function is profiled, else blank.
self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled,
else blank.
total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this
function is profiled, else blank.
name the name of the function. This is the minor sort
for this listing. The index shows the location of
the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in
the gprof listing if it were to be printed.
Any one has idea how to find cpu utilization of functions in a process in linux platform. top command will give process cpu utilization. I need to know cpu utilization of individual functions in the process..
Hello Try with Sar or vmstat. It gives more info to you.
Probably the simplest way to do that sort of thing is to build instrumentation into the program itself: snapshot the timer before-and-after. Or, measure the system in terms of the work that it is actually doing, "for its customers" instead of "for the CPUs." One benefit of this strategy is that you can leave the instrumentation in, and you can glean statistics with minimal impact. The execution environment created by a profiler can be very different from the one that a program experiences in "normal" operation.
Another consideration is that, with multiple CPUs, many things can be happening at the same time such that a profiler's output is quite difficult to map to useful program improvements. I therefore prefer to try to understand a machine's operation in terms of what's going in and what's coming out (and when...), vs. counting the rotations of the internal gears.
Last edited by sundialsvcs; 12-16-2011 at 07:33 AM.
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420
Rep:
Hello manohar,
Simply you can use mpstat or vmstat -a.
Output of mpstat on my RHEL5.3 Server: 07:46:36 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
07:46:36 PM all 0.77 0.00 0.12 0.68 0.00 0.05 0.00 98.38 694.26
Output of vmstat -a : procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free inact active si so bi bo in cs us sy id wa st
0 0 263512 46396 2105472 4364256 0 0 6 28 0 0 1 0 98 1 0
Last edited by Satyaveer Arya; 12-16-2011 at 08:20 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.