Skip to content

Instantly share code, notes, and snippets.

@benwei
Last active November 28, 2017 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benwei/130d69351371c513c5dfca2714149605 to your computer and use it in GitHub Desktop.
Save benwei/130d69351371c513c5dfca2714149605 to your computer and use it in GitHub Desktop.
How to check thread load within a process in embedded linux system?
How to check threads status within a process in embedded linux system?
Author: Ben Wei 2017-11-28
system linux kernel 3.10.73+
# ps aux | grep pulseaudio | grep -v grep
pulse 142 7.5 4.3 44312 4664 ? S<sl Nov24 406:35 /usr/bin/pulseaudio --daemonize=no
## use top command with -H, you can browse the thread load in the file
# top -H -p 142
top - 11:28:11 up 3 days, 17:15, 0 users, load average: 4.86, 4.43, 4.19
Threads: 3 total, 1 running, 2 sleeping, 0 stopped, 0 zombie
%Cpu(s): 51.0 us, 28.4 sy, 0.0 ni, 19.7 id, 0.0 wa, 0.0 hi, 1.0 si, 0.0 st
KiB Mem : 107248 total, 10544 free, 42236 used, 54468 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 33426 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
155 pulse -6 -11 44312 4664 3096 S 6.2 4.3 362:28.63 alsa-source+
142 pulse 9 -11 44312 4664 3096 R 1.0 4.3 44:04.68 pulseaudio
154 pulse -6 -11 44312 4664 3096 S 0.0 4.3 0:00.03 alsa-sink-r+
* you can watch out the RES field which indicates memory usage of the thread to check memory leak or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment