关于cpu的分析--us,sys百分比代表什么

top
us 用户空间占用CPU百分比
sy 内核空间占用CPU百分比
ni 用户进程空间内改变过优先级的进程占用CPU百分比
id 空闲CPU百分比
wa 等待输入输出的CPU时间百分比
hi 硬件中断
si 软件中断 

 

wa 数值高的话,一般是由io阻塞引起的。考虑数据库或文件读写有问题



在top下按1,显示逻辑cpu信息


Summary: The user counters show time spent in user mode; the system counters

show time

   spent in system mode.



Ayaz 





########################

I am not real clear on the difference myself, but basically I believe the
user counters increase when CPU is executing code in user space, and the
system counters increase when CPU is executing system calls.  I am not sure
if all system calls increase system counters or only when the CPU is running
in kernel mode.



But basically when your C code opens a file, it will make system calls, part
of which runs kernel modules, and will cause an increase in system
utilization (and the rest of the code increases user util).

Tom Payerle 





########################

The user counters show time spent in user mode; the system counters show
time

   spent in system mode.

   

Most C functions actually call system functions to do some of the work.
E.g.,

   printf()/scanf() call the write()/read() system functions.

Solaris is actually in system mode for the system functions.

Hence the system counters increment to show the time in the system
functions,

   even in a non-root user program.



Michael Schulte

########################



This is one of the core concepts of UNIX.



When operating on user data, a process (or thread) has limited access to
other processes, memory, devices, etc.  CPU used by such a thread is counted
as "user time".  If it needs to interact with the system, it makes a kernel
or system call (like read()).  When the call starts, it has to have extra
privileges, so it operates in kernel or system context.  Time accumulated by
the thread is counted as system time.



http://www.uwsg.iu.edu/UAU/process/manage.html



A process that did nothing but make system call in a tight loop might
accumulate significant system time, but it would be an unusual process that
did that.  A process that interacted with the system rarely (perhaps doing
extensive mathematical calculations), might accumulate less than 1% system
time.

Darren Dunham



########################

System can be thought of as "things done by the OS directly", for example,
time spent in device drivers, running the network stack, paging, running the
kernel. User is "time spent running user applications (including those of
the root user)". 





Thomas Carter

########################

System can be thought of as "things done by the OS directly", for example,
time spent in device drivers, running the network stack, paging, running the
kernel. User is "time spent running user applications (including those of
the root user)". 



Thomas Carter

########################

Go to the link below.  Great explanation for vmstat.

http://www.adminschoice.com/docs/iostat_vmstat_netstat.htm#Virtual%20Memory%
20Statistics%20(%20vmstat%20)

########################

no matter what you run for an application, the sys counters will increase,
as the application will need system resources to run.  sys represents the
activity by all the daemons that the system runs to keep it working i.e.
memory management, IO etc..



where as the usr counters are the processes stictly by the user application.




regards, Don

########################



User = time spent in the context of your process.

System = time spent in the system context on the behalf of your process.



Example:

If you have the classic numerical application that reads in a few numbers,
performs large amounts of math on those numbers, and then prints a single
number as the result, you'll see large user times, and very little system
time (system time is need to do the read/write as well as some process
startup).



If you have an application that creates (or removes) several thousand files,
it will have minimal user time, but very large system time, since most of
the time spent is in the kernel processing the creat() or unlink() calls.



Of course, most processes fall somewhere in between those extremes.



Hope this is of some help,

Ric Anderson (ric at opus1.com)



########################

user: time spend in user processes (not in the kernel)

system: time spend in the kernel





Casper

########################



Standard unix/posix behavior. See just about any textbook.



man rusage can be educational (man sar, etc.). For advanced and indepth
coverage, see the new pair of tomes on Performance/System internals by Mauro
and McDougal.



     ru_utime     the total amount of time spent executing in user mode.



      ru_stime     the total amount of time spent in the system  

executing on

                   behalf of the process(es).



Let's consider an illustrative (but not entirely correct) example.



    Say you have an application which performs something like:



        1) read data into a buffer

        2) do a lot of computations on the buffer

        3) write the results



During the read activity, a lot of time is spent "in the kernel"  

doing "system things" on your behalf. That is accounted as "system"  

time. The time spent doing computational things in the buffer is nearly all
user time (unless you have a lot of floating point exceptions or pointer
errors ;>), followed by the write, which again invokes a variety of system
services for causing I/O to actually occur.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值