Atoptool / atop

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

calibrate the calculation of exited process info #234

Closed ShirleyFei closed 1 year ago

ShirleyFei commented 1 year ago

When calculating the acctsize (the previous size of account file) via acctprocnt(), sometimes atop gets a wrong number of exited processes, which makes the 'nrprocs' input parameter for acctphotoproc() become a dummy huge value, like MAXACCTPROCS.

In this case, after acctphotoproc(), we get a wrong acctsize and then lseek() a wrong position via acctrepos().

To fix this, add a flag to prove the successful filling process info from accounting-record. Only the flag is true, do we make the calculation, which includes increasing nprocexit, accumulating the acctsize, and moving the struct tstat structure pointer forward.

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

ShirleyFei commented 1 year ago

Will rework this

ShirleyFei commented 1 year ago

Related pr is here: https://github.com/Atoptool/atop/pull/244