Thanks all.
I think I have some hints on where I should start digging now.
Regarding this, I was hoping there was a way for user-space programs to avoid this parsing issue.
It could make monitoring programs (like htop) work more efficiently and maybe poll the CPU data more frequently without causing performance issues.
Although, it is nice that kernel-space has no such limitations.
And perhaps the performance penalty of this parsing is not too bad.
But if adding more virtual files to Linux is not a problem, perhaps having differently-formatted virtual files like these would be of some value:
Code:
/proc/stat
/proc/stat.json
/proc/stat.bin
Even as an end-user, I would prefer to read JSON data than to count columns and cross-reference against manuals to figure out what each value means. But it might be because I am lazy.
But this will probably require more code in the Linux code-base, and more complexity, so it is not without a cost.
Anyway, I think I will go the htop way for CPU monitoring now.