Jump to content
Sign in to follow this  
Zimmerbz

Locking Frame Rate

Recommended Posts

Simplify how the sim works - one main task and as many background tasks as it can find LPs.

One main task making frames - if it's 100% then it's because it's not limited or it's set to do too much and runs out of time each frame.

There should be overhead in that task so we limit it and make settings that reduce the use to less than 100%.

Has anyone ever climbed out at full throttle - want to climb faster - no more throttle - simple as that.

Edited by SteveW

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

I can see why some guys like Jorge are having difficulty simply because they don't have enough to go on in their assessment.

Jorge says all his cores are at 20% and one at 100% this sounds like a typical P3D/FSX system to me with the main task showing most use and that will be core zero with no AM.

Jorge does not specify what AM he used for his test so I can only assume No AM and therefor that his core zero is populated by P3D main task with too much eye candy or no effective limit leaving no overhead in the system. It is one way of setting the sim, not a "wrong way".

 


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
4 hours ago, Wanthuyr Filho said:

Hi Mike!

Hmmmm, this is not quite what I was thinking about, I was thinking about using absolutely all cores for P3D, because I have already noticed that it does make a very good use of them all, and I suppose that even only one core lacking for P3D will be a bad thing. What I was asking was about just moving the main thread (not the texture threads if you will) from core zero to core five, for example, because I'm assuming that all other processes (including addons, services, Windows basic processes, etc) will eventually be allocated mostly to core zero. Not sure if this makes sense though.

Hi Wanthuyr,

I think you might be better served by looking through this recent thread:

https://www.avsim.com/forums/topic/541073-using-loading-times-to-determine-affinity-mask/

Start on Page 1 and, once you have understood the basic setup and objective, jump to Page 5 where I have followed Steve’s advice and taken the testing to its logical conclusion.

These tests were conducted using an 8-Core CPU, but the principles remain the same with your 6-Cored 8700K.

I am convinced that this is a much more sensible approach for determining the best Affinity Mask for Prepar3D v4.3 on multi-cored CPUs (6 and above).

Also, I would encourage you to try with HT=ON. Better performance-wise and will allow for greater flexibility when it comes to deciding which Cores/Logical Processors you wish to reserve for the various exe Addons running alongside Prepar3D.

Regards,

Mike

Edited by Cruachan
  • Like 1

Share this post


Link to post

Wow!


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

OK let's look at Mikes AM=30 and why its equivalent with HT enabled is AM=340 - both of these perform really well and have done since FSX days (check out the older data and performance graphs on my site).

AM=30=011110 - HT disabled

AM=340=00,01,01,01,01,00 - HT enabled

The simulator performs the same in each case. The resources *invoked* by the sim are the same and their initiators appear corralled in those LPs. However some system resources continue outside this mask and use up spare cycles in the core lost with HT Off.

We would see the LP of the rightmost one used the most, the main task - except when loading a scenario assigned LPs might all run at high % during that period.

We can't improve the performance of the main task unless we increase the performance of the core - maybe with a higher clock.

We can increase the performance of (some - not all) the other tasks with respect to how they use cores.

With HT enabled we can use both LPs of a core for some tasks:

AM=468=00,01,11,01,01,00

See that core 3 (fourth from right to left 5,4,3,2,1) has '11' assigning both LPs of that core - that core will be fully utilised by the background tasks.

We can't do that with the main task it would be sharing the core when we want to give it max throughput.

What we find is that (depending on hardware)  AM=468 loads the same scenario more quickly that AM=340 simply because it uses more cycles of the same core.

We have to be careful doing that we don't want to share a core with an LP occupied by a singular task that requires maximum throughput during that stage.

 

 

 

 

 

 

 

 

.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Folks can try this at home with a copy of Windows calc in programmer mode copy this into the binary field "011110" and the Dec field shows 30.

Then we can assign that AM to the sim (with a six core CPU) and take a look in task manager performance graphs set to Logical Processor mode (that's where 'LP' comes from).

In the graphs the top left is the rightmost LP in our binary string so AM=30=011110 HT disabled will show activity on the second graph!

We can tune the sim and see that activity alter depending on the load we place on the sim. All the other LPs show most use when loading the scenario and then  settle down to Jorge's 20% each with the main one at 100% (or whatever the sim load amounts to)..

Have a go - it's easy to grasp with it in front of you.

Edited by SteveW
  • Upvote 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

At this stage we should al be able to understand how the AM assigns LPs and that assigning '11's on an HT enabled system uses more CPU power that is otherwise lost on a non HT system.

Even if we don't assign '11's to the sim it won't slow down - it might be able to load and assemble the sim data faster when used with background tasks in the right places, but will slow down if we assign '11' to the core with the main task - it will be just like lowering the CPU clock on that LP by 20% or more occupied by the sister LP.

HT enabled and used correctly with an AM gives rise to Mike's performance improvements even though the CPU runs at the same speed and that the sim AM might only assign one LP of a core for each task - because it runs the entire PC faster overall.

 

 

  • Upvote 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

So to recap:

1. Locked. Will require lower fps - locked is for lower fps - because it's much more stable for that but requires high performance. Not so important when time between frames diminishes with faster frame-rates. 
2. VSync=on + Unlimited and Set the monitor refresh to a mouse acceptable rate. 
3. VSync=on + Unlimited and Set NVI to frame limit. 

VSync=On in P3D: 
VSync=On works with Unlimited or fps slider set to zero. 
What it does is take the frequency of your monitor refresh to ascertain the next position and location of the objects and scenery in each new scene (or frame). 
So looking at the output we see the fps "wobbles" around your monitor refresh frequency. This is because each frame takes a different time to build. 
  
Locked fps on the slider. 
The Simulator builds look-ahead frames, each one accurately timed for each pre-determined interval (or frame period). 
To do that requires a frame in hand at all times. Since the system is inherently wobbly anyway those frames are depleted and must be replenished or the system falls back to showing the current frame and performance is lost to it drawing parts of the look-ahead that are lost - giving rise to worse apparent performance with locked on the slider. The system needs to be showing at least double the intended locked fps or performance will suffer as the look-ahead is never completed.. 
 

Edited by SteveW
  • Like 1
  • Upvote 2

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

Although discussed a thousand times I am still not sure if I would gain anything by limiting my externally running addons to cores other than core 0. Although Windows seems to be capable of shuffling threads around quiet well, in the other thread here on avsim, it seems that the best solution is to manually put the addons on those threads/cores that are free with a certain AM setting. Currently I use AM=1365 for my 8700K with HT on and a FPS Limit in P3D of 30. Why I still wonder: I usually start my simming session like this:

- I fire up ActiveSky and check the weather, sometimes this decides where I will go flying. ActiveSky is now running.

- I fire up ProATC/X to generate my flightplan. ProATC/X is now running.

- I fire up REX Skyforce to have the automatic cloud and sky textures replacements active. REX is now running.

- I fire up Prepar3d v4.3. Set the flight up and off we go. As soon as I am in the cockpit, I start ProATC/X to take over the ATC.

Now, considering this "workflow", would I profit if I manually restrict ProATC/X, ActiveSky or REX to specific cores? I do not know... still not know.


Greetings, Chris

Intel i5-13600K, 2x16GB 3200MHz CL14 RAM, MSI RTX 4080 Gaming X, Windows 11 Home, MSFS

Share this post


Link to post

Yes! Because those apps are already corralled they stay within their pre-assigned cores leaving your P3D cores free.

There are rules to observe: Give at least two LPs per exe - don't put them to work where LPs assigned to the sim want undisturbed use.

  • Like 1

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

...apps that have an AM setting of their own - use that - do not use another tool to set them - period. Apps that don't have AM support start them with a .BAT and make the shortcut to the .BAT the desktop double-click icon. That way they run up within their assigned core spec. Using a tool that moves apps after they started has different results. If a tool is used make sure that tool starts the exe within the desired AM and keeps it there in that fashion.

  • Like 2

Steve Waite: Engineer at codelegend.com

Share this post


Link to post

What I would like to do is look into Jorge's enquiry a bit more. I said 'another mis-understanding', so what do I mean?

I said that Windows treats all cores equally, and Jorge asked why then would not all cores look the same?

Let's take all the programs running and put them in a pile - like a pile of sand.

Let's have six buckets and distribute all the sand across all the buckets equally - the level of sand in each bucket is the same since all buckets are treated equally.

Now in Windows 'treating all cores equally' is not the same - the above is not an analogy of how software works across cores.

 

Instead a better analogy might be to take different sized bricks representing those tasks generated by applications.

We can put one big brick in the first bucket that's the P3D renderer.

We can take smaller bricks and distribute them across other buckets each time looking for an empty bucket first.

Can everyone now see that each bucket will have a different amount even though we treat each one the same?

 

I hope that helps Jorge.

 

 

Edited by SteveW

Steve Waite: Engineer at codelegend.com

Share this post


Link to post
1 hour ago, SteveW said:

...apps that have an AM setting of their own - use that - do not use another tool to set them.

Hi Steve,

Hope all this isn’t proving to be too distracting from your work in the real world? Perhaps, instead, you’re able to view such educational contributions to threads like these as welcome diversions from the complexities of every day coding. Either way we thank you for your time and seemingly infinite patience. As a matter of fact, and with respect to problem solving, such diverse activities can have a very positive affect on brain function so maybe, after all, these threads can serve to be mutually beneficial!

Returning to the selected quote above, I wonder if you could spend a moment to clarify this for us? How can we determine whether or not an App has had an Affinity Mask predefined and needs no further user interventions?

Is it as simple as looking at the App’s configuration or ini file (as with IFPro) or, instead, should we start the App in question and observe which Core/Cores is/are being used? The former could present a problem as may not be visible to the user if hard-coded into the App’s executable. The latter also could prove unhelpful as, again, Core assignments could be hard-coded. If we try to change the Affinity Mask assignment we could run into conflicts and, in any case, the hard coded AM assignment will likely nullify any attempts to override the Mask.

As always, many thanks!

Regards,

Mike

 

Edited by Cruachan
  • Like 1

Share this post


Link to post
3 hours ago, SteveW said:

Yes! Because those apps are already corralled they stay within their pre-assigned cores leaving your P3D cores free.

Ok, good to know. Then I have to try again to create a BAT file that is actually working. My last attempts resultet in a BAT file that is starting up the desired software, but the affinity was never set, no matter how I created the BAT file. Any good "how to" regarding this somewhere?


Greetings, Chris

Intel i5-13600K, 2x16GB 3200MHz CL14 RAM, MSI RTX 4080 Gaming X, Windows 11 Home, MSFS

Share this post


Link to post
15 minutes ago, AnkH said:

Ok, good to know. Then I have to try again to create a BAT file that is actually working. My last attempts resultet in a BAT file that is starting up the desired software, but the affinity was never set, no matter how I created the BAT file. Any good "how to" regarding this somewhere?

Hi Chris,

Here you go....

http://www.codelegend.com/forums/viewtopic.php?f=2&t=632

Thing to remember is that the Affinity Mask must be in hexadecimal. If you enter the chosen value in Decimal it won’t work.

Regards,

Mike

  • Like 1

Share this post


Link to post
Guest
This topic is now closed to further replies.
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...