linux查看nec进程状态,【linux】 /proc/PID/stat
//proc/9744$ cat status
Name: gedit /*进程的程序名*/
State: S (sleeping) /*进程的状态信息,具体参见http://blog.chinaunix.net/u2/73528/showart_1106510.html*/
Tgid: 9744 /*线程组号*/
Pid: 9744 /*进程pid*/
PPid: 7672 /*父进程的pid*/
TracerPid: 0 /*跟踪进程的pid*/
Uid: 1000 1000 1000 1000 /*uid euid suid fsuid*/
Gid: 1000 1000 1000 1000 /*gid egid sgid fsgid*/
FDSize: 256 /*文件描述符的最大个数,file->fds*/
Groups: 0 4 20 24 25 29 30 44 46 107 109 115 124 1000 /*启动该进程的用户所属的组的id*/
VmPeak: 60184 kB /*进程地址空间的大小*/
VmSize: 60180 kB /*进程虚拟地址空间的大小reserved_vm:进程在预留或特殊的内存间的物理页*/
VmLck: 0 kB /*进程已经锁住的物理内存的大小.锁住的物理内存不能交换到硬盘*/
VmHWM: 18020 kB /*文件内存映射和匿名内存映射的大小*/
VmRSS: 18020 kB /*应用程序正在使用的物理内存的大小,就是用ps命令的参数rss的值 (rss)*/
VmData: 12240 kB /*程序数据段的大小(所占虚拟内存的大小),存放初始化了的数据*/
VmStk: 84 kB /*进程在用户态的栈的大小*/
VmExe: 576 kB /*程序所拥有的可执行虚拟内存的大小,代码段,不包括任务使用的库 */
VmLib: 21072 kB /*被映像到任务的虚拟内存空间的库的大小*/
VmPTE: 56 kB /*该进程的所有页表的大小*/
Threads: 1 /*共享使用该信号描述符的任务的个数*/
SigQ: 0/8183 /*待处理信号的个数/目前最大可以处理的信号的个数*/
SigPnd: 0000000000000000 /*屏蔽位,存储了该线程的待处理信号*/
ShdPnd: 0000000000000000 /*屏蔽位,存储了该线程组的待处理信号*/
SigBlk: 0000000000000000 /*存放被阻塞的信号*/
SigIgn: 0000000000001000 /*存放被忽略的信号*/
SigCgt: 0000000180000000 /*存放被俘获到的信号*/
CapInh: 0000000000000000 /*能被当前进程执行的程序的继承的能力*/
CapPrm: 0000000000000000 /*进程能够使用的能力,可以包含CapEff中没有的能力,这些能力是被进程自己临时放弃的*/
CapEff: 0000000000000000 /*是CapPrm的一个子集,进程放弃没有必要的能力有利于提高安全性*/
Cpus_allowed: 01 /*可以执行该进程的CPU掩码集*/
Mems_allowed: 1 /**/
voluntary_ctxt_switches: 1241 /*进程主动切换的次数*/
nonvoluntary_ctxt_switches: 717 /*进程被动切换的次数*/
/proc/PID/stat各个字段的描述
Is there a pgm that will interpret all the fields that are printed by
cat /proc/PID/stat ( or statm, or any of the info on a per process basis
)
See if the following simple function and the associated structure
that I put together sometime ago while checking out some threads-
related stuff on Linux/Alpha is of use. Also note that the format
characters as given in the man page for proc are not all correct
on Alpha. I just when to the sources to get them right (RTFS?:-))
typedef struct statstruct_proc {
1、int pid; /** The process id. **/
2、char exName [_POSIX_PATH_MAX]; /** The filename of the executable **/
3、char state; /** 1 **/ /** R is running, S is sleeping,
D is sleeping in an uninterruptible wait,
Z is zombie, T is traced or stopped **/
4、unsigned euid, /** effective user id **/
egid; /** effective group id */
5、int ppid; /** The pid of the parent. **/
6、int pgrp; /** The pgrp of the process. process group**/
7、int session; /** The session id of the process. **/
8、int tty; /** The tty the process uses **/
9、int tpgid; /** (too long) **/
10、unsigned intflags; /** The flags of the process. **/
11、unsigned intminflt; /** The number of minor faults **/
12、unsigned intcminflt; /** The number of minor faults with childs **/
13、unsigned intmajflt; /** The number of major faults **/
14、unsigned int cmajflt; /** The number of major faults with childs **/
15、int utime; /** user mode jiffies **/
16、int stime; /** kernel mode jiffies **/
17、int cutime; /** user mode jiffies with childs **/
18、int cstime; /** kernel mode jiffies with childs **/
19、int counter; /** process's next timeslice **/
20、int priority; /** the standard nice value, plus fifteen **/
21、unsigned int timeout; /** The time in jiffies of the next timeout **/
22、unsigned int itrealvalue; /** The time before the next SIGALRM is sent to the process **/
23、int starttime; /** 20 **/ /** Time the process started after system boot **/
24、unsigned int vsize; /** Virtual memory size **/
25、unsigned int rss; /** Resident Set Size **/
26、unsigned int rlim; /** Current limit in bytes on the rss **/
27、unsigned int startcode; /** The address above which program text can run **/
28、unsigned intendcode; /** The address below which program text can run **/
29、unsigned int startstack; /** The address of the start of the stack **/
30、unsigned int kstkesp; /** The current value of ESP **/
31、unsigned int kstkeip; /** The current value of EIP **/
32、intsignal; /** The bitmap of pending signals **/
33、int blocked; /** 30 **/ /** The bitmap of blocked signals **/
34、int sigignore; /** The bitmap of ignored signals **/
35、int sigcatch; /** The bitmap of catched signals **/
36、unsigned int wchan; /** 33 **/ /** (too long) **/
37、intsched, /** scheduler **/
sched_priority; /** scheduler priority **/
} procinfo;
int get_proc_info(pid_t pid, procinfo * pinfo)
{
char szFileName [_POSIX_PATH_MAX],
szStatStr [2048],
*s, *t;
FILE *fp;
struct stat st;
if (NULL == pinfo) {
errno = EINVAL;
return -1;
}
sprintf (szFileName, "/proc/%u/stat", (unsigned) pid);
if (-1 == access (szFileName, R_OK)) {
return (pinfo->pid = -1);
} /** if **/
if (-1 != stat (szFileName, &st)) {
pinfo->euid = st.st_uid;
pinfo->egid = st.st_gid;
} else {
pinfo->euid = pinfo->egid = -1;
}
if ((fp = fopen (szFileName, "r")) == NULL) {
return (pinfo->pid = -1);
} /** IF_NULL **/
if ((s = fgets (szStatStr, 2048, fp)) == NULL) {
fclose (fp);
return (pinfo->pid = -1);
}
/** pid **/
sscanf (szStatStr, "%u", &(pinfo->pid));
s = strchr (szStatStr, '(') + 1;
t = strchr (szStatStr, ')');
strncpy (pinfo->exName, s, t - s);
pinfo->exName [t - s] = '';
sscanf (t + 2, "%c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u",
/* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33*/
&(pinfo->state),
&(pinfo->ppid),
&(pinfo->pgrp),
&(pinfo->session),
&(pinfo->tty),
&(pinfo->tpgid),
&(pinfo->flags),
&(pinfo->minflt),
&(pinfo->cminflt),
&(pinfo->majflt),
&(pinfo->cmajflt),
&(pinfo->utime),
&(pinfo->stime),
&(pinfo->cutime),
&(pinfo->cstime),
&(pinfo->counter),
&(pinfo->priority),
&(pinfo->timeout),
&(pinfo->itrealvalue),
&(pinfo->starttime),
&(pinfo->vsize),
&(pinfo->rss),
&(pinfo->rlim),
&(pinfo->startcode),
&(pinfo->endcode),
&(pinfo->startstack),
&(pinfo->kstkesp),
&(pinfo->kstkeip),
&(pinfo->signal),
&(pinfo->blocked),
&(pinfo->sigignore),
&(pinfo->sigcatch),
&(pinfo->wchan));
fclose (fp);
return 0;
}
linux查看nec进程状态,【linux】 /proc/PID/stat相关推荐
- linux查看显卡核心数,linux查看硬件信息,linux查看硬盘信息,linux查看CPU信息,linux查看显卡,硬件型号信息 | 帮助信息-动天数据...
linux查看硬件信息,linux查看硬盘信息,linux查看CPU信息,linux查看显卡,硬件型号信息 作者:dthost | 时间:2015-09-30 | 8,325 次阅读 linux服务器 ...
- linux查看显示器名称命令,linux 查看显示器信息Linux下查看硬件信息命令大全
/proc 虚拟的目录,是系统内存的映射.可直接访问这个目录来获取系统信息.其中也包含下面的信息: 主机CPU信息:cpuinfo 主机DMA通道信息:dma 文件系统信息:filesystems 主 ...
- 通过命令查看linux 密码,linux查看用户密码(linux查看用户密码命令)
linux查看用户密码(linux查看用户密码命令) 2020-05-15 13:18:30 共10个回答 1.用户名和密码的存储位置存储帐号的文件:/etc/passwd存储密码的文件:/etc/s ...
- suse linux 查看内存,Suse linux查询内存大小的指令是什么?
满意答案 CJTHI 2013.08.18 采纳率:49% 等级:12 已帮助:5850人 下面和大家分享在Linux系统下查看内存使用情况的free命令: [root@scs-2 tmp]# ...
- linux查看端口属性,linux如何查看系统属性指令?
linux是一款非常免费资源的操作系统,但是很多用户不知道怎么查看系统信息,今天小编就给大家带来了linux查看系统属性指令分享.喜欢的快点下载吧. linux查看系统属性指令分享 1.查看cpu信息 ...
- linux 查看虚拟机内存,Linux基础教程:Linux下查看内存使用情况
/proc/meminfo 机器的内存使用信息 /proc/pid/maps pid为进程号,显示当前进程所占用的虚拟地址. /proc/pid/statm 进程所占用的内存 [root@localh ...
- linux查看软件包信息,Linux查看系统信息的一些命令及查看已安装软件包的命令...
Linux查看系统信息的一些命令及查看已安装软件包的命令 系统 # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看操作系统版本 # cat ...
- linux查看根目录使用率,Linux 查看空间使用情况的实例详解
Linux 查看空间使用情况的实例详解 在日常的Linux巡检中,我们会遇到文件系统目录使用空间很高的情况,例如如下利用"df -h "查看到根目录空间使用超过80%.而我们仅仅知 ...
- linux 查看主机版本,Linux下如何查看版本信息的方法步骤
Linux下如何查看版本信息, 包括位数.版本信息以及CPU内核信息.CPU具体型号等等,整个CPU信息一目了然. 1.# uname -a (Linux查看版本当前操作系统内核信息) Linux ...
最新文章
- 人人必须要知道的语义分割模型:DeepLabv3+
- 疫情可以来,但比赛不能断
- Android项目出现main.xml编译出错和 出现main.out.xml无法编译的解决办法
- 主线程如何等待多线程完成 返回数据_多线程基础体系知识清单
- android studio 连不上设备,Android Studio-设备已连接但“脱机”
- 常用的sql server 函数、存储过程、临时表总结
- 互联网巨头基于全球产业链打造ARM CPU
- 抛弃扎克伯格!拦不住的 Facebook 离职潮
- RAII(Resource Acquisition Is Initialization:资源获取即初始化)
- windows下sakai配置过程
- 微信appid、openid、unionid的区别和关联
- keil添加华大芯片支持jflash下载
- 阿里云服务器 发送邮件无法连接smtp的解决方案
- Android双清卸载木马,刷机如何清除木马病毒
- 数据库对三大范式简单易懂的理解
- 长江后浪推前浪, “趣出行”死在“火牛”的沙滩上
- 计算机c盘空间满了应该怎么办,C盘空间越来越小怎么办?电脑C盘满了怎么办?...
- 如何升级pycharm 中pip的版本
- 用好 DIV 和 API,在前端系统中轻松嵌入数据分析模块
- Servlet——映射细节、3.0注解配置、Servlet是单例会造成线程不安全问题
热门文章
- Java —— eclipse.zip
- qt调用外部程序(exe)
- FreeBSD 11.0-发布公告
- qpython3绘图_比Excel制图更强大,Python可视化工具Altair入门教程
- axios, ajax和fetch的比较
- web前端基础(05htmlimg标签和滚动标签)
- idea下如何正确导入多个module
- SpringCloud概念理解
- 跨屏html ui,Amaze UI(HTML5 跨屏前端框架) v2.7.2
- TypeScript 3.9 发布