青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆 - 87  文章 - 279  trackbacks - 0
<2010年11月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊(cè)

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 219407
  • 排名 - 118

最新評(píng)論

閱讀排行榜

評(píng)論排行榜


1:查看CPU負(fù)載--mpstat
mpstat -P ALL [internal [count]]

參數(shù)的含義如下:
-P ALL 表示監(jiān)控所有CPU
internal 相鄰的兩次采樣的間隔時(shí)間
count 采樣的次數(shù)

mpstat命令從/proc/stat獲得數(shù)據(jù)輸出
輸出的含義如下:


CPU 處理器ID
user 在internal時(shí)間段里,用戶態(tài)的CPU時(shí)間(%) ,不包含 nice值為負(fù) 進(jìn)程 ?usr/?total*100
nice 在internal時(shí)間段里,nice值為負(fù)進(jìn)程的CPU時(shí)間(%) ?nice/?total*100
system 在internal時(shí)間段里,核心時(shí)間(%) ?system/?total*100
iowait 在internal時(shí)間段里,硬盤IO等待時(shí)間(%) ?iowait/?total*100
irq 在internal時(shí)間段里,軟中斷時(shí)間(%) ?irq/?total*100
soft 在internal時(shí)間段里,軟中斷時(shí)間(%) ?softirq/?total*100
idle 在internal時(shí)間段里,CPU除去等待磁盤IO操作外的因?yàn)槿魏卧蚨臻e的時(shí)間閑置時(shí)間 (%) ?idle/?total*100

intr/s 在internal時(shí)間段里,每秒CPU接收的中斷的次數(shù) ?intr/?total*100
CPU總的工作時(shí)間total_cur=user+system+nice+idle+iowait+irq+softirq

total_pre=pre_user+ pre_system+ pre_nice+ pre_idle+ pre_iowait+ pre_irq+ pre_softirq
user=user_cur – user_pre
total=total_cur-total_pre

其中_cur 表示當(dāng)前值,_pre表示interval時(shí)間前的值。上表中的所有值可取到兩位小數(shù)點(diǎn)。

2:查看磁盤io情況及CPU負(fù)載--vmstat
usage: vmstat [-V] [-n] [delay [count]]
              -V prints version.
              -n causes the headers not to be reprinted regularly.
              -a print inactive/active page stats.
              -d prints disk statistics
              -D prints disk table
              -p prints disk partition statistics
              -s prints vm table
              -m prints slabinfo
              -S unit size
              delay is the delay between updates in seconds. 
              unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)
              count is the number of updates.

vmstat從/proc/stat獲得數(shù)據(jù)

輸出的含義如下: 
FIELD DESCRIPTION FOR VM MODE
   Procs
       r: The number of processes waiting for run time.
       b: The number of processes in uninterruptible sleep.

   Memory
       swpd: the amount of virtual memory used.
       free: the amount of idle memory.
       buff: the amount of memory used as buffers.
       cache: the amount of memory used as cache.
       inact: the amount of inactive memory. (-a option)
       active: the amount of active memory. (-a option)

   Swap
       si: Amount of memory swapped in from disk (/s).
       so: Amount of memory swapped to disk (/s).

   IO
       bi: Blocks received from a block device (blocks/s).
       bo: Blocks sent to a block device (blocks/s).

   System
       in: The number of interrupts per second, including the clock.
       cs: The number of context switches per second.

   CPU
       These are percentages of total CPU time.
       us: Time spent running non-kernel code. (user time, including nice time)
       sy: Time spent running kernel code. (system time)
       id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
       wa: Time spent waiting for IO. Prior to Linux 2.5.41, shown as zero.
       st: Time spent in involuntary wait. Prior to Linux 2.6.11, shown as zero.

3:查看內(nèi)存使用情況--free
usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]
  -b,-k,-m,-g show output in bytes, KB, MB, or GB
  -l show detailed low and high memory statistics
  -o use old format (no -/+buffers/cache line)
  -t display total for RAM + swap
  -s update every [delay] seconds
  -c update [count] times
  -V display version information and exit

[root@Linux /tmp]# free

            total     used        free       shared    buffers   cached
Mem:       255268    238332      16936         0        85540   126384
-/+ buffers/cache:   26408       228860 
Swap:      265000      0         265000

Mem:表示物理內(nèi)存統(tǒng)計(jì) 
-/+ buffers/cached:表示物理內(nèi)存的緩存統(tǒng)計(jì) 
Swap:表示硬盤上交換分區(qū)的使用情況,這里我們不去關(guān)心。
系統(tǒng)的總物理內(nèi)存:255268Kb(256M),但系統(tǒng)當(dāng)前真正可用的內(nèi)存b并不是第一行free 標(biāo)記的 16936Kb,它僅代表未被分配的內(nèi)存。

第1行  Mem:
total:表示物理內(nèi)存總量。 
used:表示總計(jì)分配給緩存(包含buffers 與cache )使用的數(shù)量,但其中可能部分緩存并未實(shí)際使用。 
free:未被分配的內(nèi)存。 
shared:共享內(nèi)存,一般系統(tǒng)不會(huì)用到,這里也不討論。 
buffers:系統(tǒng)分配但未被使用的buffers 數(shù)量。 
cached:系統(tǒng)分配但未被使用的cache 數(shù)量。buffer 與cache 的區(qū)別見后面。 
total = used + free    
第2行   -/+ buffers/cached:
used:也就是第一行中的used - buffers-cached   也是實(shí)際使用的內(nèi)存總量。 
free:未被使用的buffers 與cache 和未被分配的內(nèi)存之和,這就是系統(tǒng)當(dāng)前實(shí)際可用內(nèi)存。
free 2= buffers1 + cached1 + free1   //free2為第二行、buffers1等為第一行

buffer 與cache 的區(qū)別
A buffer is something that has yet to be "written" to disk. 
A cache is something that has been "read" from the disk and stored for later use
第3行:
對(duì)操作系統(tǒng)來講是Mem的參數(shù).buffers/cached 都是屬于被使用,所以它認(rèn)為free只有16936.
對(duì)應(yīng)用程序來講是(-/+ buffers/cach).buffers/cached 是等同可用的,因?yàn)閎uffer/cached是為了提高文件讀取的性能,當(dāng)應(yīng)用程序需在用到內(nèi)存的時(shí)候,buffer/cached會(huì)很快地被回收。
所以從應(yīng)用程序的角度來說,可用內(nèi)存=系統(tǒng)free memory+buffers+cached.

swap
swap就是LINUX下的虛擬內(nèi)存分區(qū),它的作用是在物理內(nèi)存使用完之后,將磁盤空間(也就是SWAP分區(qū))虛擬成內(nèi)存來使用.

4:查看網(wǎng)卡情況--sar
詳細(xì)見man
4.1:查看網(wǎng)卡流量:sar -n DEV delay count 
服務(wù)器網(wǎng)卡最大能承受流量由網(wǎng)卡本身決定,分為10M、10/100自適應(yīng)、100+以及1G網(wǎng)卡,一般普通服務(wù)器用的是百兆,也有用千兆的。

輸出解釋:
IFACE
       Name of the network interface for which statistics are reported.

rxpck/s
       Total number of packets received per second.

txpck/s
       Total number of packets transmitted per second.

rxbyt/s
       Total number of bytes received per second.

txbyt/s
       Total number of bytes transmitted per second.

rxcmp/s
       Number of compressed packets received per second (for cslip etc.).

txcmp/s
       Number of compressed packets transmitted per second.

rxmcst/s
       Number of multicast packets received per second.

4.2:查看網(wǎng)卡失敗情況:sar -n EDEV delay count 
輸出解釋:
IFACE
       Name of the network interface for which statistics are reported.

rxerr/s
       Total number of bad packets received per second.

txerr/s
       Total number of errors that happened per second while transmitting packets.

coll/s
       Number of collisions that happened per second while transmitting packets.

rxdrop/s
       Number of received packets dropped per second because of a lack of space in linux buffers.

txdrop/s
       Number of transmitted packets dropped per second because of a lack of space in linux buffers.

txcarr/s
       Number of carrier-errors that happened per second while transmitting packets.

rxfram/s
       Number of frame alignment errors that happened per second on received packets.

rxfifo/s
       Number of FIFO overrun errors that happened per second on received packets.

txfifo/s
       Number of FIFO overrun errors that happened per second on transmitted packets.


5:定位問題進(jìn)程--top, ps
top -d delay,詳細(xì)見man
ps aux 查看進(jìn)程詳細(xì)信息
ps axf 查看進(jìn)程樹

6:查看某個(gè)進(jìn)程與文件關(guān)系--losf
需要root權(quán)限才能看到全部,否則只能看到登錄用戶權(quán)限范圍內(nèi)的內(nèi)容

lsof -p 77//查看進(jìn)程號(hào)為77的進(jìn)程打開了哪些文件
lsof -d 4//顯示使用fd為4的進(jìn)程 
lsof abc.txt//顯示開啟文件abc.txt的進(jìn)程
lsof -i :22//顯示使用22端口的進(jìn)程
lsof -i tcp//顯示使用tcp協(xié)議的進(jìn)程
lsof -i tcp:22//顯示使用tcp協(xié)議的22端口的進(jìn)程
lsof +d /tmp//顯示目錄/tmp下被進(jìn)程打開的文件
lsof +D /tmp//同上,但是會(huì)搜索目錄下的目錄,時(shí)間較長
lsof -u username//顯示所屬user進(jìn)程打開的文件

7:查看程序運(yùn)行情況--strace
usage: strace [-dffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]
              [-p pid] ... [-s strsize] [-u username] [-E var=val] ...
              [command [arg ...]]
   or: strace -c [-e expr] ... [-O overhead] [-S sortby] [-E var=val] ...
              [command [arg ...]]

常用選項(xiàng):
-f:除了跟蹤當(dāng)前進(jìn)程外,還跟蹤其子進(jìn)程。
-c:統(tǒng)計(jì)每一系統(tǒng)調(diào)用的所執(zhí)行的時(shí)間,次數(shù)和出錯(cuò)的次數(shù)等. 
-o file:將輸出信息寫到文件file中,而不是顯示到標(biāo)準(zhǔn)錯(cuò)誤輸出(stderr)。
-p pid:綁定到一個(gè)由pid對(duì)應(yīng)的正在運(yùn)行的進(jìn)程。此參數(shù)常用來調(diào)試后臺(tái)進(jìn)程。

8:查看磁盤使用情況--df
test@wolf:~$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              3945128   1810428   1934292  49% /
udev                    745568        80    745488   1% /dev
/dev/sda3             12649960   1169412  10837948  10% /usr/local
/dev/sda4             63991676  23179912  37561180  39% /data

9:查看網(wǎng)絡(luò)連接情況--netstat
常用:netstat -lpn
選項(xiàng)說明:
 -p, --programs           display PID/Program name for sockets
 -l, --listening          display listening server sockets
 -n, --numeric            don't resolve names
 -a, --all, --listening   display all sockets (default: connected)
posted on 2010-11-21 12:25 閱讀(1379) 評(píng)論(1)  編輯 收藏 引用

FeedBack:
# re: [轉(zhuǎn)] linux 常用定位問題命令總結(jié) 2011-08-19 10:14 白癜風(fēng)癥狀
不錯(cuò)  回復(fù)  更多評(píng)論
  

只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              影音先锋久久久| 久久精视频免费在线久久完整在线看| 欧美香蕉大胸在线视频观看| 久久精品视频亚洲| 午夜精品视频一区| 亚洲欧美日韩久久精品| 亚洲黄页视频免费观看| 久久精品国产精品亚洲综合| 亚洲欧美资源在线| 欧美在线视频a| 久久成人免费网| 久久久中精品2020中文| 久久综合国产精品| 亚洲国产免费| 亚洲视频二区| 欧美亚洲一区二区三区| 久久人人97超碰精品888| 欧美二区在线看| 欧美日韩在线精品| 国产亚洲成精品久久| 在线不卡视频| 一区二区免费在线视频| 午夜在线成人av| 欧美大色视频| 一区二区三区国产在线观看| 欧美在线观看视频| 欧美韩国在线| 国产日韩视频| 一本色道久久加勒比精品| 午夜欧美不卡精品aaaaa| 另类尿喷潮videofree | 欧美电影在线免费观看网站| 亚洲人成网站777色婷婷| 99在线精品观看| 欧美怡红院视频一区二区三区| 亚洲第一级黄色片| 亚洲一区二区三区午夜| 蜜臀av国产精品久久久久| 欧美伦理91| 伊人狠狠色j香婷婷综合| 99re在线精品| 欧美国产日韩精品| 欧美在线一区二区三区| 欧美视频在线不卡| 亚洲精品欧美一区二区三区| 久久亚洲欧美| 亚洲欧美日韩一区二区三区在线 | 亚洲精品视频在线看| 最新热久久免费视频| 亚洲午夜精品在线| 亚洲第一区在线| 欧美一区二区视频97| 国产精品久久久久久久午夜| 亚洲精品乱码| 欧美成人午夜激情在线| 欧美亚洲系列| 国产色婷婷国产综合在线理论片a| 国产精品成人在线| 亚洲最黄网站| 91久久黄色| 老司机成人网| 国产日韩在线看| 久久av一区二区三区漫画| 亚洲午夜激情| 国产精品日本精品| 亚洲欧美日韩区| 亚洲视频一区在线| 国产精品久久久久影院亚瑟| 亚洲欧美偷拍卡通变态| 亚洲精品一区二区三区在线观看| 亚洲一区二区三区高清不卡| 欧美精品情趣视频| 亚洲免费电影在线| 亚洲精品一二区| 国产精品爱久久久久久久| 亚洲一区二区不卡免费| 一区二区三区四区在线| 欧美午夜免费影院| 欧美一区二区久久久| 欧美一区午夜视频在线观看| 黄色成人小视频| 最新国产の精品合集bt伙计| 欧美日产在线观看| 午夜免费日韩视频| 久久久久国色av免费看影院| 亚洲欧洲一区| 宅男噜噜噜66一区二区| 国产精品免费视频xxxx| 久久久精品国产免大香伊 | 日韩亚洲欧美一区| 欧美午夜精品一区| 久久久久在线| 欧美日本一道本在线视频| 午夜精品久久久久久久蜜桃app| 久久精品理论片| 米奇777在线欧美播放| 亚洲视频在线免费观看| 欧美在线视频免费播放| 亚洲精品1区| 午夜国产精品视频| 尤物在线精品| 一区二区三区毛片| 在线成人av.com| 一级成人国产| 美国三级日本三级久久99| 欧美1区2区| 亚洲视频精选在线| 久久国产精品一区二区| 夜夜嗨一区二区三区| 中文日韩在线| 久久女同互慰一区二区三区| 亚洲欧洲三级| 欧美成人午夜激情视频| 亚洲欧美激情精品一区二区| 欧美一区二区三区视频| 亚洲二区在线视频| 亚洲精品久久久蜜桃| 欧美va天堂va视频va在线| 亚洲综合视频在线| 亚洲靠逼com| 免费亚洲电影| 国产视频久久久久| 亚洲国产福利在线| 91久久精品国产91久久| 一区二区三区视频在线看| 香蕉国产精品偷在线观看不卡| 在线日韩视频| 亚洲激情在线观看| 久久久999| 91久久久久久久久| 美女图片一区二区| 久久精品2019中文字幕| 久久久女女女女999久久| 午夜日韩av| 乱码第一页成人| 一区二区三区中文在线观看 | 99视频一区| 日韩一级黄色大片| 亚洲激情视频网| 欧美激情bt| 欧美日韩精品在线| 欧美多人爱爱视频网站| 国产一区二区三区在线观看免费视频 | 亚洲国产精品ⅴa在线观看 | 欧美成人a∨高清免费观看| 欧美影院一区| 国产欧美日韩精品专区| 亚洲一区亚洲二区| 欧美在线观看一区二区| 国产欧美一区视频| 久久动漫亚洲| 欧美二区乱c少妇| 亚洲免费激情| 国产精品超碰97尤物18| 亚洲午夜女主播在线直播| 欧美一级日韩一级| 国产综合色产| 欧美肥婆在线| 亚洲一区国产| 久久在线免费| 亚洲美女视频在线观看| 欧美日韩妖精视频| 午夜伦欧美伦电影理论片| 久久精品在线免费观看| 亚洲国产另类久久精品| 欧美色视频一区| 欧美在线国产| 亚洲国产一区二区精品专区| 亚洲免费电影在线观看| 国产精品自拍在线| 久久影视精品| 亚洲一区免费在线观看| 免费一级欧美片在线观看| 国产精品99久久久久久久vr| 国产欧美一区二区色老头 | 先锋影音网一区二区| 国产主播在线一区| 欧美啪啪一区| 久久久久成人精品| 亚洲高清自拍| 久久国产欧美精品| 日韩一级在线| 伊伊综合在线| 国产欧美日韩一区二区三区在线观看| 欧美国产日韩一区| 亚洲一区在线观看视频| 国产日韩专区在线| 国产精品高潮在线| 欧美国产日韩a欧美在线观看| 亚洲欧美国产三级| 亚洲国产日韩一级| 欧美日韩视频在线观看一区二区三区| 久久久久久噜噜噜久久久精品| 欧美三级精品| 牛牛精品成人免费视频| 久久av一区二区三区漫画| 亚洲欧洲精品一区二区三区不卡 | 亚洲激情综合| 99伊人成综合| 久久综合久久综合这里只有精品 |