获取某个进程的CPU使用情况
2011-04-10 18:59
357 查看
Gain One Process Cpu Usage Info
First, top command to get all information
Then, grep command to get the process record that you want
Third,awk command to print out cpu info into file
The shell script file is attached here.
Use while sleep, get continuous cpu info of this process into log file.
And you have to use this script tool like this:
./getcpu.sh screen 2
First, top command to get all information
Then, grep command to get the process record that you want
Third,awk command to print out cpu info into file
The shell script file is attached here.
Use while sleep, get continuous cpu info of this process into log file.
And you have to use this script tool like this:
./getcpu.sh screen 2
#! /bin/bash if [ $# -ne 2 ] then echo "Usage: $0 ProcessName InternalTime" fi Process=$1 Internal=$2 LogFile="Cpu.txt" while sleep $Internal do top | grep $Process | awk '{ print $9, $10, $11}' >> $LogFile done |
相关文章推荐
- Linux上获取指定进程的cpu使用情况
- Linux上获取指定进程的cpu使用情况
- 获取进程的CPU使用情况
- linux下获取占用CPU资源最多的10个进程,可以使用如下命令组合: ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head linux下
- 查看基于Android 系统单个进程内存、CPU使用情况的几种方法
- 如何获取cpu占用率和 mem使用情况
- 用python计算top命令中某个进程的CPU,Memory使用情况
- Windows下用C语言获取进程cpu使用率,内存使用,IO情况
- linux下获取CPU利用率和内存使用情况
- C/C++获取Windows系统CPU和内存及硬盘使用情况
- Windows下用C语言获取进程cpu使用率,内存使用,IO情况
- 使用JConsole监控进程、线程、内存、cpu、类情况
- 如何利用Java获取系统的信息(CPU、内存、各盘符使用情况)
- C#获取硬盘编号、CPU编号及类型、内存大小及使用情况
- 转载:python获取linux系统内存、cpu、网络使用情况
- 用python计算top命令中某个进程的CPU,Memory使用情况
- C#获取硬盘编号、CPU编号及类型、内存大小及使用情况
- C/C++获取Linux系统CPU和内存及硬盘使用情况
- 编程获取Linux的cpu占用率和 mem使用情况
- Windows下用C语言获取进程cpu使用率,内存使用,IO情况