niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » Solaris
discrepency about CPU usage between iostat and prstat
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
Darren Dunham
*nix forums Guru


Joined: 22 Feb 2005
Posts: 1120

PostPosted: Tue Jun 27, 2006 2:54 pm    Post subject: Re: discrepency about CPU usage between iostat and prstat Reply with quote

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

PostPosted: Thu Jun 22, 2006 11:31 am    Post subject: Re: discrepency about CPU usage between iostat and prstat Reply with quote

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

PostPosted: Thu Jun 22, 2006 10:43 am    Post subject: Re: discrepency about CPU usage between iostat and prstat Reply with quote

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

PostPosted: Thu Jun 22, 2006 7:49 am    Post subject: discrepency about CPU usage between iostat and prstat Reply with 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? .
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 10:36 pm | All times are GMT
navigation Forum index » *nix » Solaris
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts vxdmpadm iostat and iostat shows different io rates utkanbir Solaris 0 Fri Jul 21, 2006 12:04 pm
No new posts ECPG (usage of simple select statement) Jasbinder Bali PostgreSQL 0 Fri Jul 21, 2006 3:28 am
No new posts ECPG usage Jasbinder Bali PostgreSQL 0 Thu Jul 20, 2006 7:56 pm
No new posts High paging usage on database process mychrislo@gmail.com AIX 0 Wed Jul 19, 2006 9:59 am
No new posts df - k/ usage 100% how clear spatial/ Table of contents 阿吉 Server 2 Tue Jul 18, 2006 2:15 am

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
[ Time: 0.4956s ][ Queries: 20 (0.4041s) ][ GZIP on - Debug on ]