We need to monitor memory usage of our high-loaded service every minute by cron.
For this we are reading /proc/PID/smaps
and somehow parse it.
But we are encountering timing problems exactly every minute. When monitoring cron is turned off, there is no timing problems.
Only expensive and suspicious operation in our code is that reading of /proc/PID/smaps
.
Is there in Linux kernel any lock/mutex/something else while reading smaps
?
And is there any other more transparent method to detect memory usage?