Atoptool / atop

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

photosys.c: correct the numa number for NUM and NUC #217

Closed ShirleyFei closed 1 year ago

ShirleyFei commented 1 year ago

Current code uses array index to store the numa number, which may sort the numanr to a wrong value after the qsort() funtion in generic_samp().

Fix this by re-adding the 'numanr' member for struct mempernuma and cpupernuma to store the correct numa number. The permanent 'numanr' member can guarantee the numa number from adjusting after qsort(), while the qsort() function can continue working by sorting NUM from small to large according to free memory, and sorting NUC from small to large according to idle cpu.

Besides, add NUC for JSON output.

Fixes: 1fbda3f1081a ("Additions to NUMA counters") Reported-by: Qi Zheng zhengqi.arch@bytedance.com Signed-off-by: Fei Li lifei.shirley@bytedance.com