From: Clive M. <Cli...@ms...> - 2009-12-12 06:03:20
|
I've done some quick profiling of freeglut on Linux Ubuntu. I ran the same application two ways. First with the joystick 'unattended' and secondly with it explicitly disabled by calling: glutJoystickFunc(NULL, -1); // which should switch if off and cause the polling period to be infinite (no polling) The results are about the same. My application does useful work in the draw_image code and the idle loop is just that, however, the fact that fgJoystickPollWindow is called, means that polling isn't being turned off. There seems to be a call to the joystick polling code in the idle loop even if the joystick is disabled. Maybe it's my interpretation, but the idle loop is where non-critical things get done, but it's no place just to waste CPU cycles? Clive. These runs are NOT identical but representative: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 19.24 1.32 1.32 glutMainLoopEvent 15.60 2.39 1.07 31556628 0.00 0.00 glut_OpenGL_idle 13.85 3.34 0.95 fgEnumWindows 13.56 4.27 0.93 glutMainLoop 10.64 5.00 0.73 fghcbCheckJoystickPolls 8.75 5.60 0.60 fgJoystickPollWindow 8.02 6.15 0.55 37445 0.01 0.01 draw_image 2.84 6.34 0.20 fgEnumSubWindows 1.97 6.48 0.14 fghcbDisplayWindow 1.46 6.58 0.10 fgCloseWindows Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 25.36 2.47 2.47 glutMainLoopEvent 15.20 3.95 1.48 fgEnumWindows 14.68 5.38 1.43 53905731 0.00 0.00 glut_OpenGL_idle 12.53 6.60 1.22 fghcbCheckJoystickPolls 8.78 7.46 0.85 75819 0.01 0.01 draw_image 7.49 8.19 0.73 glutMainLoop 3.34 8.51 0.33 fghcbDisplayWindow 3.23 8.82 0.32 fgJoystickPollWindow 2.98 9.12 0.29 fgEnumSubWindows 1.64 9.28 0.16 fgCloseWindows |