欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

【多线程调试】linux命令行下查看进程的线程状态和绑定的cpu核

时间:2023-07-22

方法一:

方法一:ps -eLF 查找 PSR 字段值

[test1280@localhost 20190227]$ ps -eLFUID PID PPID LWP C NLWP SZ RSS PSR STIME TTY TIME CMDroot 1 0 1 0 1 4836 1548 2 Feb25 ? 00:00:02 /sbin/initroot 2 0 2 0 1 0 0 2 Feb25 ? 00:00:00 [kthreadd]root 3 2 3 0 1 0 0 0 Feb25 ? 00:00:00 [migration/0]……

方法二:

taskset -pc $pid

[root@VM-16-15-centos ~]# taskset -pc 21390pid 21390's current affinity list: 0,1[root@VM-16-15-centos ~]# taskset -pc 21782taskset: failed to get pid 21782's affinity: No such process

[root@VM-16-15-centos ~]# taskset -pac 22378pid 22378's current affinity list: 0,1pid 22379's current affinity list: 0pid 22380's current affinity list: 1

-c: 被设置亲和性的cpu编号
-p:查看的进程id
-a: 查看进程的所有线程

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。