d1168b493a
Norman Vine wrote : > Frederic Bouvier writes: > >> Quoting Andy Ross: >>> * Hopefully in a CPU-friendly way. I know that older versions of >>> the NVidia drivers did this by spinning in a polling loop >>> inside the driver. I'm not sure if this has been fixed or not. >>> >>> From my experience, the latest non-beta Windows NVidia driver seems to eat CPU >> >> even with sync to vblank enabled. The CPU usage is always 100%. > > Buried in the PPE sources is a 'hackish' but portable way to limit CPU usage if the desired framerate is met > > /* > Frame Rate Limiter. > > This prevents any one 3D window from updating faster than > about 60Hz. This saves a ton of CPU time on fast machines. > > ! I THINK I MUNGED THE VALUE FOR ulMilliSecondSleep() NHV ! > */ > > static ulClock *ck = NULL ; > > if ( frame_rate_limiter ) > { > if ( ck == NULL ) > { > ck = new ulClock ; > ck -> update () ; > } > > int t_ms = (int) ( ck->getDeltaTime() * 1000.0 ) ; /* Convert to ms */ > > if ( t_ms < 16 ) > ulMilliSecondSleep ( 16 - t_ms ) ; > } > > I implemented the method pointed out by Norman. It works great on windows and saves me a lot of CPU cycles. This way, I can get the same framerate in moderately populated areas and have CPU idle 50% of the time instead of wildly looping in the NVidia driver while waiting to sync on vblank. It has been tested on Linux by Melchior. He saw the same gain in CPU cycles. |
||
---|---|---|
.. | ||
.cvsignore | ||
3dfx.sh | ||
bootstrap.cxx | ||
fg_commands.cxx | ||
fg_commands.hxx | ||
fg_init.cxx | ||
fg_init.hxx | ||
fg_io.cxx | ||
fg_io.hxx | ||
fg_os.cxx | ||
fg_os.hxx | ||
fg_os_sdl.cxx | ||
fg_props.cxx | ||
fg_props.hxx | ||
globals.cxx | ||
globals.hxx | ||
logger.cxx | ||
logger.hxx | ||
main.cxx | ||
main.hxx | ||
Makefile.am | ||
metar_main.cxx | ||
options.cxx | ||
options.hxx | ||
README | ||
renderer.cxx | ||
renderer.hxx | ||
runfgfs.bat.in | ||
runfgfs.in | ||
splash.cxx | ||
splash.hxx | ||
util.cxx | ||
util.hxx | ||
viewer.cxx | ||
viewer.hxx | ||
viewmgr.cxx | ||
viewmgr.hxx |
Last updated $Date$ This directory contains the main routine for FlightGear, together with various utility classes and functions that do not fit in anywhere else, and subsystems that have not yet graduated to having their own directories (because the maintainers are lazy, not because the subsystems are not important). fg_commands.cxx fg_commands.hxx This module defines a global function to register FlightGear's built-in commands. fg_init.cxx fg_init.hxx This module defines global functions to initialize for the various subsystems. Code is gradually being moved out of here and into the subsystems' own init() methods, so this module will eventually disappear. fg_io.cxx fg_io.hxx This module defines high-level global I/O functions for FlightGear. I don't know how widely these are used, yet. fg_props.cxx fg_props.hxx This module provides a FlightGear layer over the SimGear property manager. This module performs two roles: it provides global convenience functions for accessing the FlightGear property tree, and it ties some properties to its own static functions. The second role has mostly disappeared, since subsystems now tie their own properties in their bind() methods, and eventually this module will contain only the convenience functions. fgfs.cxx fgfs.hxx This module defines FGSubsystem, the abstract base class (or interface) for subsystems in FlightGear. Most of the important subsystems already extend this class, and eventually, all subsystems will. globals.cxx globals.hxx This module defines FGGlobals, a class that holds pointers to subsystems and other variables used by a FlightGear session. Many global variables have migrated into here, and eventually, all will, so that the program can maintain state for more than one session at once. logger.cxx logger.hxx This module defines the FGLogger subsystem, which allows the user to log any property value to any number of CSV files, somewhat like an overenthusiastic flight data recorder. main.cxx This file defines the main() function for FlightGear as well as the top-level loop. Currently, there is a still lot of code in here that belongs in the individual subsystems' init() and update() methods; eventually, this will be a short, simple file defining the top-level flow logic of the program. options.cxx options.hxx This module defines global functions for parsing command-line options and transferring them to the property tree. runfgfs.bat runfgfs.bat.in This is a batch file for launching FlightGear under MSWindows. runfgfs.bat is autogenerated from runfgfs.bat.in, so any changes should be made to the latter file. splash.cxx splash.hxx This module defines global functions for displaying and updating the splash screen. viewer.cxx viewer.hxx This module defines the FGViewer subsystem, which calculates the viewpoint in world coordinates and provides transformation matrices for the scenery code. FGViewer has methods that allow the program to rotate or move the current view direction. viewmgr.cxx viewmgr.hxx This module defines the FGViewMgr subsystem, which manages all of the different views available in FlightGear.