Jump to content
Sign in to follow this  
Guest Ron Freimuth

Variable assignment and initialization

Recommended Posts

Guest Ron Freimuth

>Ron,>>The gauges continue to run even with FS Paused. At>>least, if 'Pause' isn't used in some way to stop execution.>Actually nothing stops running when sim is paused EXCEPT that>sim vars (A/E/P) are NOT updated. But (L/G) vars indeed are.>Every piece of code is still executed, so there is not really>a big save in CPU cycles. >Tom If Paused and Minimized, Task Manager shows CPU load may drop quite low. Unless there is a lot of gauge code in the sim. So, what's that (A:Sim Disabled,bool) related to? I guess one could look at the FS time, and if it isn't changing, the sim is paused. One could then jump around some or all code blocks with an if{ block. Since I Strobe my XML calculation blocks, I could change the Strobe rate dynamically if I wanted to. But, other than stopping the Strobes when Paused, I don't see much reason to do that. OTOH, if one is calculating a lot of navigation trig stuff, then there are probably times the rate can be decreased. And, if XML gauges tend to slow down the FPS or add pauses, then one might slow down the less important XML blocks so the important ones can continue to run as fast as necessary. That suggests a user adjustment so he can Tailor the slow down for his PC speed. Ron

Share this post


Link to post
Share on other sites

Tom,Interesting. I wonder if Update Hidden has a different effect in the absence if an block. Using FRAPS I can see large performance gains, but I'm not seeing any slowdown in the execution of structures. For example I plot lots of symbology in HSI and radar pages, and even if there was a slowdown it would certainly be noticeable (particularly if it was 90%!). I still get smooth rotations and displayed variables are updating just as they had before. The only difference is there's much less CPU being utilized.Again, my results were that there was no execution within a 0 and all visible elements still performed at what seemed like normal levels. I guess the next step is to place a filter in a block and see what the frequency is.--Jon

Share this post


Link to post
Share on other sites

>So, what's that (A:Sim Disabled,bool) related to?I don't know. I always read it as 0, even when using the PAUSE_TOGGLE event.>I guess one could look at the FS time, and if it isn't>changing, the sim is paused. One could then jump around some>or all code blocks with an if{ block.Yes, I agree with this option. FS time stops when Paused. Interesting is, the WHOLE sim execution stops when a menu is selected.>Since I Strobe my XML calculation blocks, I could change>the Strobe rate dynamically if I wanted to. But, other than>stopping the Strobes when Paused, I don't see much reason to>do that. OTOH, if one is calculating a lot of navigation>trig stuff, then there are probably times the rate can be>decreased. I also use strobes rather than FS time and found the problem that strobes still run when sim is paused. Still didn't make code to handle pauses. That would be one of my next tasks.>And, if XML gauges tend to slow down the FPS or add>pauses, I don't think this applies to XML gauges only but also C/C++ ones. What really eats CPU time and FPS is OUTPUT , everything that is shown on the screen. On a maximixed FS window, CPU percent use nears or is 100 %. When the sim is paused, there is no percetible decrease of CPU usage (maybe 1 % or less) but the memory usange in bytes remains unchanged . This last one seems logic, as there is no sim vars actualization.But, when FS is minimized (no output to screen), CPU usage drops to a 15-17 %, for my 757 with 130 XML custom gauges, to 1 % for the Piper Cub and 45 % for LevelD 767. I think the difference is pure data and structural code actualization, which indeed happens because Lvars still update at their set frequencies .Tom

Share this post


Link to post
Share on other sites

Jon,>Interesting. I wonder if Update Hidden has a different effect in >the absence if an block. "Hidden" is a flag. I've found no different effect when usingor code>For example I plot lots of symbology in HSI and radar pages, and >even if there was a slowdown it would certainly be noticeable > (particularly if it was 90%!). I still get smooth rotations and >displayed variables are updating just as they had before.Maybe I've done a different test. You could try this:-In a gauge that is placed on a subpanel which can be displayed/hidden (Like the GPS), add an structure. -Then, add an (L:VarTest,enum) ++ (>L:VarTest,enum)-In a gauge placed on the main fs panel (always visible), add a test string like %(L:VarTest,enum)%!5.3f!-Then toggle the subpanel display and see how it affects the update's rate of the Lvar.-Change in the subpanel's gauge with (L:VarTest,enum) ++ (>L:VarTest,enum)-Then remove the that refered to (L:VarTest,enum) previously.-Then toggle the subpanel display and see the difference.>I guess the next step is to place a filter in a block and see what >the frequency is.I'd be glad to know the result of your tests :-)Tom

Share this post


Link to post
Share on other sites
Guest Ron Freimuth

>>So, what's that (A:Sim Disabled,bool) related to?>I don't know. I always read it as 0, even when using the>PAUSE_TOGGLE event. A whole window of A:Var,bool variables displayed as 1 or 0 would help. >>I guess one could look at the FS time, and if it isn't>>changing, the sim is paused. >Yes, I agree with this option. FS time stops when Paused.>Interesting is, the WHOLE sim execution stops when a menu is>selected. It even stops for a moment when a mouse button is pressed and the cursor is on the View screen.>>Since I Strobe my XML calculation blocks, I could change>>the Strobe rate dynamically if I wanted to. ...>I also use strobes rather than FS time and found the problem>that strobes still run when sim is paused. Still didn't make>code to handle pauses. That would be one of my next tasks. I display all my strobes as 0110100 at the top of one or more Test Display windows. That way I could see if they are working. At times, some heaver FS load on the CPU makes the Count (also displayed) slow down a bit. Let me know when you find a good way to detect Pause. Since my XML stuff is running all the time, the Integrators 'wind up' when Paused. That would put a jerk in the SPD controller. I also saw a jerk in one of my Pitch controllers after un-pausing. Regardless, I need to think a bit more about initializing some of the Integrators I use. It appears others aren't critical.>>And, if XML gauges tend to slow down the FPS or add>>pauses, ....>What really eats CPU time and FPS is OUTPUT , everything that>is shown on the screen. On a maximized FS window, CPU percent>use nears or is 100 %. When the sim is paused, there is no>percetible decrease of CPU usage (maybe 1 % or less) but the>But, when FS is minimized (no output to screen), CPU usage>drops to a 15-17 %, for my 757 with 130 XML custom gauges, to>1 % for the Piper Cub and 45 % for LevelD 767. I think the>difference is pure data and structural code actualization,>which indeed happens because Lvars still update at their set>frequencies .>Tom Right, I've checked the effect of reducing the View. I also found my simple XML data windows slowed down frame rate at times when stretched out to a large size. C gauges appear to also run all the time. Often a change results in a momentary drop in FPS, then it increases back to the normal rate. Probably due to moving code and data back into active RAM and L1/L2 caches from pagefile.sys or storage space in RAM that FS likely sets up. Pause makes no difference unless the Sim is minimized. CPU usage then appears to be a function of all the gauges running in the BG. In fact, if the gauges don't take many cycles the CPU load may be quite low with FS flying on autopilot when minimized. There is no View to keep updating. That iFly C gauge takes forever to load. Gosh, it's 48 MB! The next largest .gau file in my gauges is under 10 MB. I think it takes a lot of CPU all the time. Clearly, there should be a way to slow or stop code when it isn't needed. Your and Jon's (conflicting) experiments with look promising, though I'm not sure that it would fit in my XML stuff. Ron

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...