[arch-general] most efficient way to get linux kernel statistics
gdamjan at gmail.com
Mon Mar 7 20:20:18 UTC 2016
>>> The free command gets its information from /proc/meminfo.
>>> Performance-wise, it doesn't really matter if a few additional lines
>>> need to be parsed.
>> Thank you Florian. Actually, I already knew it's the same, I just
>> thought that he could use the free command instead of parsing it
>> himself. You're right. Performance-wise, it's pretty much the same.
> Sorry, I didn't express myself properly. I didn't mean to criticize
> free. What I meant to say was that the time it takes to parse
> /proc/meminfo or free is negligible. It doesn't need to be any more
> efficient. free parses /proc/meminfo. libgtop parses /proc/meminfo.
> Querying the information probably takes much more time than parsing it.
> Your suggestion to use free may indeed be useful if the original poster
> wants parsing to be slightly simpler and does not mind the additional
> dependency. My impression was that they considered parsing to be too
there's also `sysinfo(2)`
More information about the arch-general