Tips for finding Knowledge Articles

  • - Enter just a few key words related to your question or problem
  • - Add Key words to refine your search as necessary
  • - Do not use punctuation
  • - Search is not case sensitive
  • - Avoid non-descriptive filler words like "how", "the", "what", etc.
  • - If you do not find what you are looking for the first time,reduce the number of key words you enter and try searching again.
  • - Minimum supported Internet Explorer version is IE9
Home  >
article

[HOWTO] Identify the thread/process consuming a high amount of CPU utilization using PS

Auditing and Monitoring Service ,   Authentication Service ,   Privileged Access Service ,   PC Auditing and Monitoring Service ,  

11 January,21 at 07:32 AM

In this article we will be walking through the steps to locate what process / thread(s) is consuming a high amount of CPU
using the PS command. All commands being used in this article has been tested in Unix and Linux environments. I will use DirectControl (adclient) as a test in the steps to locate the process / thread showing the amount of CPU utilization.  (NOTE: These steps can be used  to identify any application/process a customer has reported using a large amount of CPU.)


1.) First locate the process ID for the client/agent or application with the command below:

#ps -ef|grep -i adclient   

Output:

The process id for DirectControl (adclient) is (20995). (NOTE: The id could be different in other environments)

User-added image

2.) To see all the processes PID's currently running under DirectControl (adclient) run the following command below:


#ps -Lp 20995 -o pid,ppid,pcpu,pmem,lwp

Output:

User-added image

We can see that process 21027 (in the example) is consuming high CPU in this demonstration. 

NOTE: LWP stands for, "Light weight process"

FYI, To see a single LWP thread consuming high CPU to get the CMD run the command below. (CMD: Shows the command used to launch the process)


#ps -e -q 21027

Output: 

User-added image

3.)
To see all LWP related threads consuming high CPU for the process run command below:


#ps -eLf | head -1; ps -eLf | egrep "20995" | grep -v grep

Output: 

User-added image