Howto:Optimizing FlightGear for mobile devices: Difference between revisions

Jump to navigation Jump to search
Line 168: Line 168:


== Tracking Memory Utilization at the Subsystem-level ==
== Tracking Memory Utilization at the Subsystem-level ==
It's getting obvious that it might be beneficial to extend the build-in performance monitor system such that it also supports tracking memory consumption per subsystem.  
It might be beneficial to extend the build-in performance monitor system such that it also supports tracking memory consumption per subsystem.  
 
The performance monitor is initialized in fg_init.cxx: https://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_init.cxx#line1083
The performance monitor is implemented as part of SimGear, <simgear/structure/SGPerfMon.hxx>
As can be seen, it hooks into the SGSubsystem code, so that it gets invoked by all subsystems in order to create runtime samples.
 
The commits implementing the performance monitor are these:
* [http://gitorious.org/fg/simgear/commit/27a1c02/diffs SimGear commit]
* [https://gitorious.org/fg/flightgear/commit/4b2506d/diffs FlightGear commit]


It would probably suffice to use "placement new" (i.e. pool memory) here, and overload the new operator at the SGSubsystem level (i.e. in SimGear), so that all subsystems use the overloaded new operator automatically. This would allow us to keep track of the number of memory allocations per subsystem, and also the amount of total RAM allocated by single subsystems. In addition, we could also track freeing via delete, too. And publish all the info to the property tree.
It would probably suffice to use "placement new" (i.e. pool memory) here, and overload the new operator at the SGSubsystem level (i.e. in SimGear), so that all subsystems use the overloaded new operator automatically. This would allow us to keep track of the number of memory allocations per subsystem, and also the amount of total RAM allocated by single subsystems. In addition, we could also track freeing via delete, too. And publish all the info to the property tree.

Navigation menu