20,741
edits
Line 272: | Line 272: | ||
== Proof of concept (patch) == | == Proof of concept (patch) == | ||
{{Note|The following patch [[Howto:Create new subsystems|implements a simple SGSubsystem]] by inheriting from the base class and wrapping access to <code>/proc/pid/smaps</code> (on Linux). | {{Note|The following patch [[Howto:Create new subsystems|implements a simple SGSubsystem]] by inheriting from the base class and wrapping access to <code>/proc/pid/smaps</code> (on Linux). | ||
This should probably be updated to use the [http://api-docs.freeflightsim.org/simgear/classSGTimeStamp.html SGTimeStamp] and [[Howto:Use Property Tree Objects|SGPropertyObject]] APIs respectively. For the time being, the patch should be considered out of date - it's been updated to also include VRAM utilization stats, and will probably evolve to also provide other metrics over time.}} | This should probably be updated to use the [http://api-docs.freeflightsim.org/simgear/classSGTimeStamp.html SGTimeStamp] and [[Howto:Use Property Tree Objects|SGPropertyObject]] APIs respectively. For the time being, the patch should be considered out of date - it's been updated to also include VRAM utilization stats, and will probably evolve to also provide other metrics over time (e.g. Nasal GC and active timers/listeners).}} | ||
Here's a first stab at a simple subsystem to monitor FlightGear memory usage on Linux at 5 second intervals, consider it a "proof of concept" prototype now, as this would need to be cleaned up and implemented for Mac/Windows respectively - on Linux it simply works such that it merely fopen()s /proc/pid/smaps and copies two metrics to the property tree: | Here's a first stab at a simple subsystem to monitor FlightGear memory usage on Linux at 5 second intervals, consider it a "proof of concept" prototype now, as this would need to be cleaned up and implemented for Mac/Windows respectively - on Linux it simply works such that it merely fopen()s /proc/pid/smaps and copies two metrics to the property tree: |