当前位置:网站首页>查看线程名and设置线程名

查看线程名and设置线程名

2022-06-09 12:01:00 aningxiaoxixi

1
先知道pid 在那一列

ps -aux | head -n 10

2
查看 进程pid

ps -aux | grep a.out

3
查看进程名字相关信息

ps -T -p 3680 # 可以看到pid tid
top -H -p 3759 # 可以查看cpu 利用率

4
如何设置linux 线程名字
参考:Linux 平台 C/C++ 代码中设置线程名

A 添加头文件
#include <sys/prctl.h>
B 在线程回调函数里面 添加名字设置
prctl(PR_SET_NAME, thread_name1);

原网站

版权声明
本文为[aningxiaoxixi]所创,转载请带上原文链接,感谢
https://blog.csdn.net/aningxiaoxixi/article/details/125111461