TOP Command for Memory Monitoring

The top command is used for memory monitoring. It works only on Linux platform.

The top command produces an ordered list of running processes selected by user-specified criteria, and updates it periodically. By default, ordering is by CPU usage, and it shows processes that consume maximum CPU. The top command also shows how much processing power and memory are being used, as well as the other information about the running processes.

The top command output monitors the RSS memory as well as the CPU utilization of the TIBCO BusinessWorks™ Container Edition AppNode.

top -p PID > top.txt

Sample output is as follows:

Cpu(s):  4.7%us,  1.1%sy,  0.0%ni, 94.1%id,  0.0%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:  65914304k total, 59840516k used,  6073788k free,  3637208k buffers
Swap: 15359996k total,   119216k used, 15240780k free, 43597120k cached

  PID USER  	PR  NI  VIRT  RES  SHR S %CPU %MEM	TIME+  COMMAND                                                                                                                                                                    	 
  925 root  	20   0 3650m 997m  27m S  4.0  1.6 238:05.72 bwappnode-Http

Press 1 on same top output window and it would give usage per core

top - 02:13:25 up 160 days, 15:16, 26 users,  load average: 0.00, 0.00, 0.00
Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie
Cpu0  :  8.3%us,  6.7%sy,  0.0%ni, 85.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  4.7%us,  0.5%sy,  0.0%ni, 94.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  4.2%us,  0.4%sy,  0.0%ni, 95.1%id,  0.0%wa,  0.0%hi,  0.3%si,  0.0%st
Cpu3  :  3.8%us,  0.4%sy,  0.0%ni, 95.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:  65914304k total, 59839448k used,  6074856k free,  3637208k buffers
Swap: 15359996k total,   119216k used, 15240780k free, 43597124k cached

  PID USER  	PR  NI  VIRT  RES  SHR S %CPU %MEM	TIME+  COMMAND                                                                                                                                                                    	 
  925 root  	20   0 3650m 997m  27m S  4.7  1.6 238:08.62 bwappnode-Http