3

When I execute top -u postgres or ps -C postgres -o %cpu,%mem,cmd in linux machine I am getting the list of postgres processors in my database machine. I need a consolidated %cpu and %ram usage by postgres.

1 Answer 1

0

Try and test:

top -b -n 1 -u tomcat | awk 'NR>7 { cpusum += $9; ramsum += $10; } END { print cpusum, ramsum; }'
Sign up to request clarification or add additional context in comments.

4 Comments

If it uses top, it counts the shared memory segment multiple times.
I have received output as "247.5 418.1 ". What it means could you explain, please?
I have received output as below. 247.5 418.1 What it means could you explain, please?
First number is the total CPU usage, second one is the total memory used

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.