ps&CPU

简介:
#include <pthread.h>

void f();
int main() {
f();
return 0;
}

void f() {
int i=0;
//volatile int i=0;
while (i<100) { i=10; }
}
 
root@x:~# ps aux|grep xxx|grep -v grep
root 825 96.5 0.0 2460 724 pts/2 R+ 11:33 0:03 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 95.6 0.0 2460 724 pts/2 R+ 11:33 0:04 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 93.0 0.0 2460 724 pts/2 R+ 11:33 0:05 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 107 0.0 2460 724 pts/2 R+ 11:33 0:06 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 100 0.0 2460 724 pts/2 R+ 11:33 0:07 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 96.2 0.0 2460 724 pts/2 R+ 11:33 0:07 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 104 0.0 2460 724 pts/2 R+ 11:33 0:08 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 99.5 0.0 2460 724 pts/2 R+ 11:33 0:08 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 97.0 0.0 2460 724 pts/2 R+ 11:33 0:09 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 103 0.0 2460 724 pts/2 R+ 11:33 0:10 ./xxx
root@x:~# ps aux|grep xxx|grep -v grep
root 825 102 0.0 2460 724 pts/2 R+ 11:33 0:11 ./xxx
 
 
#include <pthread.h>

void f();
int main() {
f();
return 0;
}

void f() {
//int i=0;
volatile int i=0;
while (i<100) {
++i; i=10;
}
}    本文转自eyjian 51CTO博客,原文链接:http://blog.51cto.com/mooon/904863,如需转载请自行联系原作者


相关文章
|
2月前
|
监控 Linux
性能分析之 Linux 系统中 ps&top 中 CPU 百分比不一致?
【8月更文挑战第18天】性能分析之 Linux 系统中 ps&top 中 CPU 百分比不一致?
43 4
|
3月前
|
监控 Unix Linux
ps aux 命令使用查看内存、cpu使用排名与top的区别
ps aux 命令使用查看内存、cpu使用排名与top的区别
376 1
|
5月前
|
缓存 监控 网络协议
cpu相关指标(top、uptime、vmstat、mpstat、sar、pidstat、ps、dstat、perf、tcpdump、lscpu)等常见使用方法(三)
cpu相关指标(top、uptime、vmstat、mpstat、sar、pidstat、ps、dstat、perf、tcpdump、lscpu)等常见使用方法
129 0
|
5月前
|
监控 Unix Linux
cpu相关指标(top、uptime、vmstat、mpstat、sar、pidstat、ps、dstat、perf、tcpdump、lscpu)等常见使用方法(二)
cpu相关指标(top、uptime、vmstat、mpstat、sar、pidstat、ps、dstat、perf、tcpdump、lscpu)等常见使用方法
139 0
|
5月前
|
JSON 缓存 监控
cpu相关指标(top、uptime、vmstat、mpstat、sar、pidstat、ps、dstat、perf、tcpdump、lscpu)等常见使用方法(一)
cpu相关指标(top、uptime、vmstat、mpstat、sar、pidstat、ps、dstat、perf、tcpdump、lscpu)等常见使用方法
100 0
|
Linux Perl
linux ps命令,查看某进程cpu和内存占用率情况, linux ps命令,查看进程cpu和内存占用率排序。 不指定
背景:有时需要单看某个进程的CPU及占用情况,有时需要看整体进程的一个占用情况。一、 linux ps命令,查看某进程cpu和内存占用率情况[root@test vhost]# ps auxUSER       PID  %CPU    %MEM    VSZ   RSS TTY      STAT...
4822 0
|
Shell Linux Perl
Linux系统小技巧(2):利用ps工具统计CPU/MEM消耗高或者负载高的进程
如果通过ps列出CPU消耗高或者内存消耗高的线程,如何统计线程消耗的总的CPU或者内存,请看此短文。
5993 0
|
Linux
ps&amp;CPU
#include  void f();int main() {        f();        return 0;} void f() {        int i=0;        //volatile int ...
941 0
为什么ps中CPU占用率会有超出%100的现象?
前面的关于ps中的%CPU的含义一文已经介绍了CPU占用率的含义,那么为什么有时会在ps的输出中看到CPU占用率超出%100的现象呢?我们知道在/proc目录下每个进程都会有一个以它的PID以名字的目录,这个目录中有一个stat文件,它包含了和这个进程状态相关的各种信息,它的各个数值对应的含义在内核文档的Documentation/filesystems/proc.
719 0
ps&CPU
#include  void f();int main() {        f();        return 0;} void f() {        int i=0;        //volatile int i=0;        while (i}   roo...
574 0
下一篇
无影云桌面