---
title: "监控linux的CPU内存进程工具sar "
author: "onlyor"
date: "2012-10-13T15:16:52Z"
tags: []
categories: ["操作系统"]
slug: "linux-cpu-sar"
draft: false
lastmod: "2012-10-13T15:17:35Z"
id: 1697822
url: "https://onlyor.iteye.com/blog/1697822"
---

监控linux的CPU内存进程工具sar 下载地址

[http://pagesperso-orange.fr/sebastien.godard/download.html](http://pagesperso-orange.fr/sebastien.godard/download.html) 

 

1 安装  
   tar zxvf  xxx.tar.gz

  ./configure

   make

   make install

 

2  使用  
 pidstat 2 5   
 //每隔2秒，显示5次，所有活动进程的CPU使用情况  
 pidstat -p 3132 2 5   
 //每隔2秒，显示5次，PID为３１３２的进程的CPU使用情况显示  
 pidstat -p 3132 2 5 -r  
 //每隔2秒，显示5次，PID为３１３２的进程的内存使用情况显示

　　

查看CPU使用情况

sar 2 5  
//每隔2秒，显示5次，CPU使用的情况

 

　　%usr：CPU处在用户模式下的时间百分比。   
　　%sys：CPU处在系统模式下的时间百分比。   
　　%wio：CPU等待输入输出完成时间的百分比。   
　　%idle：CPU空闲时间百分比。