Atoptool / atop

System and process monitor for Linux
GNU General Public License v2.0
789 stars 110 forks source link

atopacct: move semophore checking more earlier #233

Closed ShirleyFei closed 1 year ago

ShirleyFei commented 1 year ago

If no client is using the process accounting shadow files, like the atop.service is masked, or atopacct.service restarts but atop.service not, which happens from time to time in production environments, there is no need to run pass2shadow() or even read new process accounting record(s) from pacct_source file.

Thus move semaphore checking more earlier to avoid the unnecessary read SYSCALL.

Signed-off-by: Fei Li lifei.shirley@bytedance.com

Atoptool commented 1 year ago

Reading and truncation of the source process accounting file is a permanent task for atopacctd, so this has to be done before leaving the function in the piece of code that you propose to move.