jaypipes / ghw

Go HardWare discovery/inspection library
Apache License 2.0
1.62k stars 174 forks source link

Support querying current resource usage #357

Open jaypipes opened 7 months ago

jaypipes commented 7 months ago

ghw was originally designed as a system capabilities library, allowing developers to query for system functionality, NUMA topology and hardware capabilities. We deliberately did not query for resource usage, instead calling out in the documentation that there were other systems that were designed for monitoring.

However, as the years have gone by, I've noticed that many systems that import ghw (and a few that call the ghwc example CLI tool) also import other libraries or shell out to many other tools (depending on the host system) to additionally collect resource usage information. And, I think it would be used for these consumer tools to be able to use ghw for both discovering capabilities as well as collecting current resource usage amounts. That way, these consumer tools don't need to shell out to other tools and can use a single library for collecting resource capability and usage information.

ffromani commented 7 months ago

I'm in favor of this enhancement. I wonder if we can implement the new functionality as add-on libraries on top of existing ghw packages, leaving the latter mostly unchanged. Perhaps is just more practical to bake in the new functionalities in the existing codebase?