|
|
|
|
|
|
| Author |
Message |
Darren Dunham *nix forums Guru
Joined: 22 Feb 2005
Posts: 1120
|
Posted: Tue Jun 27, 2006 2:54 pm Post subject:
Re: discrepency about CPU usage between iostat and prstat
|
|
|
bill_j_chen@yahoo.com wrote:
| Quote: | But at same time, prstat shows the program uses around 35% CPU and NO
other process is using much CPU power at all). Of course the CPU usage
by the testing process keeps increasing. About one minute later, the
usage by this process reported in prstat command gets to 99%.
|
It's kind of like an average over time. So it takes several seconds to
get close to 99%.
Run 'prstat -m' to enable microstate accounting. Then it'll do actual
interval calculations rather than just display the time-weighted value
that the kernel keeps track of.
| Quote: | Definitely there is no paging or disk activity going on as my code
doesn't read or write anything.
|
Yup.
| Quote: | My question is why we see this kind discrepency in the first minute? .
|
It's not an instantaneous value.
--
Darren Dunham ddunham@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. > |
|
| Back to top |
|
 |
Casper H.S. Dik *nix forums Guru
Joined: 20 Feb 2005
Posts: 1634
|
Posted: Thu Jun 22, 2006 11:31 am Post subject:
Re: discrepency about CPU usage between iostat and prstat
|
|
|
bill_j_chen@yahoo.com writes:
| Quote: | My question is why we see this kind discrepency in the first minute? .
|
The CPU% is a decaying average; it shows how much CPU you used over the
last few minutes.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth. |
|
| Back to top |
|
 |
thomas@maier-komor.de *nix forums addict
Joined: 28 Mar 2006
Posts: 98
|
Posted: Thu Jun 22, 2006 10:43 am Post subject:
Re: discrepency about CPU usage between iostat and prstat
|
|
|
bill_j_chen@yahoo.com wrote:
| Quote: | Hi, Solaris guru,
The scenario I am talking about here might be interesting to you.
I have a netra t1 box running the latest solaris 10. It is a standalone
machine. That means there is no TCP/IP traffic etc. And actually there
is no any application or server running. The CPU idle is 99~100%
I wrote a sample C program which simply caculate the sin and atan for
degree 1~36000000. This testing code is apparently pure CPU intensive
(I didn't put any output line in the code, so no IO, no system call.
This makes sure the process will run in user-mode) and runs very long.
before I invoke the program, I have been running "iostat 3" and "prstat
3" to check the system activity. Actually nothing is going on. CPU is
totally idle. Which is good.
Then I invoke the testing program. iostat immediately shows that all
the CPU is being used by the testing program. user-mode 100%, system
mode 0%, CPU idle 0% (NOTE: kernel mode CPU usage: 0)
But at same time, prstat shows the program uses around 35% CPU and NO
other process is using much CPU power at all). Of course the CPU usage
by the testing process keeps increasing. About one minute later, the
usage by this process reported in prstat command gets to 99%.
Definitely there is no paging or disk activity going on as my code
doesn't read or write anything.
My question is why we see this kind discrepency in the first minute? .
|
the interval that you give prstat as a parameter only denotes the update
time interval. The cpu percentage use by a specific process isn't
calculated by prstat. It is calculated by the kernel and exposed via the
proc(4) filesystem. There is no way for prstat to tell the kernel which
time interval should be the base for calculating cpu percentage.
HTH,
Tom |
|
| Back to top |
|
 |
bill_j_chen@yahoo.com *nix forums beginner
Joined: 22 Jun 2006
Posts: 2
|
Posted: Thu Jun 22, 2006 7:49 am Post subject:
discrepency about CPU usage between iostat and prstat
|
|
|
Hi, Solaris guru,
The scenario I am talking about here might be interesting to you.
I have a netra t1 box running the latest solaris 10. It is a standalone
machine. That means there is no TCP/IP traffic etc. And actually there
is no any application or server running. The CPU idle is 99~100%
I wrote a sample C program which simply caculate the sin and atan for
degree 1~36000000. This testing code is apparently pure CPU intensive
(I didn't put any output line in the code, so no IO, no system call.
This makes sure the process will run in user-mode) and runs very long.
before I invoke the program, I have been running "iostat 3" and "prstat
3" to check the system activity. Actually nothing is going on. CPU is
totally idle. Which is good.
Then I invoke the testing program. iostat immediately shows that all
the CPU is being used by the testing program. user-mode 100%, system
mode 0%, CPU idle 0% (NOTE: kernel mode CPU usage: 0)
But at same time, prstat shows the program uses around 35% CPU and NO
other process is using much CPU power at all). Of course the CPU usage
by the testing process keeps increasing. About one minute later, the
usage by this process reported in prstat command gets to 99%.
Definitely there is no paging or disk activity going on as my code
doesn't read or write anything.
My question is why we see this kind discrepency in the first minute? . |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Jan 09, 2009 10:36 pm | All times are GMT
|
|
Personal Finance | Credit Cards | Bankruptcy | Sailor Moon Music | Lingerie
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|