tech skills for future reference

ps -o thcount -p <pid of a process>    <--------------- we can get the thread count in a process

 ps -mLF <pid of a process>    <------- list the IDs(in fact not real thread id, but should be process id)

>>我们可以通过ps -mLF查看时哪个thread耗高cpu

gdb - {process-pid} < gdb_commands_script > process-gdb.txt 2>&1  

[content of gdb_commands_script]

generate-core-file
bt
info threads
info proc
info proc all
thread apply all bt   <---通过这个可以看出那个高cpu的thread是正在做什么(stack),至少可以看出是代码中那个大的包的thread
thread apply all bt full  



//****//

(gdb) info threads  <---thread infomationr
  14 Thread 70106000 (LWP 19563)  0x00a5c402 in __kernel_vsyscall ()
  13 Thread 97418128 (LWP 19564)  0x00a5c402 in __kernel_vsyscall ()
  12 Thread -1239426160 (LWP 19636)  0x00a5c402 in __kernel_vsyscall ()
  11 Thread -1249916016 (LWP 19639)  0x00a5c402 in __kernel_vsyscall ()
  10 Thread -1272976496 (LWP 19641)  0x00a5c402 in __kernel_vsyscall ()
  9 Thread -1283466352 (LWP 19642)  0x00a5c402 in __kernel_vsyscall ()
  8 Thread 41966480 (LWP 19643)  0x00a5c402 in __kernel_vsyscall ()
  7 Thread 84417424 (LWP 19645)  0x00a5c402 in __kernel_vsyscall ()
  6 Thread -1304446064 (LWP 19648)  0x00a5c402 in __kernel_vsyscall ()
  5 Thread -1293956208 (LWP 19649)  0x00a5c402 in __kernel_vsyscall ()
  4 Thread -1314935920 (LWP 19650)  0x00a5c402 in __kernel_vsyscall ()
  3 Thread -1424000112 (LWP 19671)  0x00a5c402 in __kernel_vsyscall ()
  2 Thread -1340081264 (LWP 19682)  0x00a5c402 in __kernel_vsyscall ()
  1 Thread -1214253360 (LWP 19562)  0x00a5c402 in __kernel_vsyscall ()

//****//

(gdb) info proc  <--- running command line on the process start
process 19562
cmdline = './cimserver'
cwd = '/opt/ibm/icc/cimom/bin'
exe = '/opt/ibm/icc/cimom/bin/cimserver'
///***///
info proc all <-- Mapped address spaces





RPM

rpm -qa | grep **** | xargs rpm -e --noscripts --nodeps

你可能感兴趣的:(thread,c,command,exe,reference,BT)