3

Please help me to find a reliable way to compute (in a bash script) a jboss PID cpu load.

To be specific, I don't know how to aggregate /proc/[pid]/stat fields to obtain the load a specific process makes on a multiple cpu 64 bit env. Ubuntu.

Thanks a lot, Xander

Sid
  • 10,643
Mark
  • 63

1 Answers1

2

The tool that interprets the /proc/[pid]/stat information is ps, this tools allows you to get the cpu load of any single process on the system:

ps S -p [pid] -o pcpu=

To monitor using this command, you can use watch:

watch ps S -p [pid] -o pcpu=

This command outputs a percentage of total cpu use of the agregate of all child processes. If you want to see the tree of processes, use pstree:

pstree -p [pid]