I've an application which runs on linux where I need to gather the performance statistics (CPU usage, Memory usage, Disk usage etc) from inside the application itself.
As I observed there are two methods to achieve this.
First one is to execute a tool like pidstat or sar from the c++ code and process the result and gather information and save them in a database Second method is to follow the method mentioned in below ticket.
How to determine CPU and memory consumption from inside a process?
I need to know the recommended way of doing this. I might need to gather around 10 performance statistics fields (like CPU Usage, Memory Usage, Disk Usage etc).