LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-02-2010, 02:17 AM   #1
gomes1333
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 0
CPU consumption - %usr and %sys ??


On Linux, top shows how much % of CPU is consumed by "user" as well as "sys" like below.


Tasks: 272 total, 3 running, 268 sleeping, 0 stopped, 1 zombie
Cpu(s): 65.9%us, 33.8%sy, 0.0%ni, 0.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 16300960k total, 16212488k used, 88472k free, 9508k buffers
Swap: 33554424k total, 5112656k used, 28441768k free, 3502720k cached


In above example I see that there is 33.8% consumed by "sys". How do I find which process(es) is/are contributing to the "sys" cpu consumption?
 
Old 04-02-2010, 02:36 AM   #2
Mr-Bisquit
Member
 
Registered: Feb 2009
Distribution: FreeBSD, OpenBSD, NetBSD, Debian, Fedora
Posts: 770
Blog Entries: 52

Rep: Reputation: 68
Eliminate the processes by user such as Desktop environment, networking that is controlled, open apps.
Open two terminals and line them side by side.
In one type top and in the other
Code:
ps -U <your username>
. That will make it easier.
 
Old 04-02-2010, 03:12 AM   #3
gomes1333
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
i can get the cpu utilization of a process.. how do i know how much of it is consumed as "sys" and "user"?

The ps doesn't help in that case.
 
Old 04-02-2010, 04:54 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
You can't. Once you're in kernel context you're no longer a (userspace) "process".
 
Old 04-02-2010, 05:06 AM   #5
gomes1333
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
So, I guess there is no way I can find what is consuming the %sys CPU
 
Old 04-02-2010, 01:41 PM   #6
Mr-Bisquit
Member
 
Registered: Feb 2009
Distribution: FreeBSD, OpenBSD, NetBSD, Debian, Fedora
Posts: 770
Blog Entries: 52

Rep: Reputation: 68
Follow the directions.
Open two terminals again
Left terminal
Code:
top -U <your username>
; right terminal
Code:
ps -U <your username>
.
I'm currently using OpenBSD;but, these commands will work on both Linux/GNU and BSD with the same results.

You will see a difference in the output and know what processes are user.
 
Old 04-03-2010, 06:13 AM   #7
gomes1333
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Here is what I see on my RH Linux.. and this doesn't help.

----

=> ps -U userid
PID TTY TIME CMD
10000 ? 00:00:01 perl
23703 pts/1 00:00:00 ksh
23885 ? 00:00:00 sshd
23886 pts/4 00:00:00 ksh
23979 pts/4 00:00:00 ps
32283 ? 00:00:00 startWebLogic.s
32328 ? 1-15:23:04 java

----
=> top -U userid
top - 03:10:28 up 32 days, 18:24, 4 users, load average: 2.33, 2.39, 2.44
Tasks: 272 total, 1 running, 271 sleeping, 0 stopped, 0 zombie
Cpu(s): 17.6%us, 8.8%sy, 0.0%ni, 73.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 16300960k total, 16205404k used, 95556k free, 269200k buffers
Swap: 33554424k total, 3099020k used, 30455404k free, 3480636k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
32328 userid 16 0 4047m 2.5g 232m S 100.9 16.2 2369:23 java
24007 userid 15 0 12880 1260 832 R 0.7 0.0 0:01.33 top
10000 userid 18 0 26516 3704 1628 S 0.0 0.0 0:01.42 perl
23703 userid 16 0 65432 2180 1196 S 0.0 0.0 0:00.03 ksh
23885 userid 15 0 91312 2328 1036 S 0.0 0.0 0:00.00 sshd
23886 userid 15 0 65432 2188 1196 S 0.0 0.0 0:00.00 ksh
32283 userid 20 0 63968 1016 1012 S 0.0 0.0 0:00.01 startWebLogic.s
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I trashed /usr/include/sys/mman.h where did it come from? brfindla Linux - Software 3 08-18-2009 08:48 AM
CentOs5.1- - - cannot find /sys/devices/system/cpu/cpu0/cpufreq/ lukegong Red Hat 4 02-27-2008 11:15 AM
CPU Consumption yusufs Linux - Newbie 5 11-12-2007 01:17 AM
Sys-Admin-Print-Add Error at /usr/share/ppd/custom/HP-OfficeJet_300-hpijs.ppd suguru Ubuntu 0 10-02-2006 12:11 PM
limit CPU consumption eantoranz Linux - Security 3 07-19-2005 09:32 PM


All times are GMT -5. The time now is 07:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration