Board index FlightGear Support Graphics

Abrupt frame rate drop to 0  Topic is solved

Graphics issues like: bad framerates, weird colors, OpenGL errors etc. Bad graphics ar usually the result of bad graphics cards or drivers.
Forum rules
In order to help you, we need to know a lot of information. Make sure to include answers to at least the following questions in your initial post.

- what OS (Windows Xp/Vista, Mac etc.) are you running?
- what FlightGear version do you use?
- what graphics card do you have?
- does the problem occur with any aircraft, at any airport?
- is there any output printed to the console (black window)?
- copy&paste your commandline (tick the "Show commandline box on the last page of FGRun or the "Others" section on the Mac launcher).
- please upload a screenshot of the problem.

If you experience FlightGear crashes, please report a bug using the issue tracker (can be also used for feature requests).
To run FlightGear on old computers with bad OpenGL support, please take a look at this wiki article. If you are seeing corrupted/broken textures, please see this article.

Note: If you did not get a reponse, even after 7 days, you may want to check out the FlightGear mailing lists to ask your question there.

Abrupt frame rate drop to 0

Postby Hyde » Sat Jul 12, 2014 3:55 pm

There has been lots of discussion of low frame rate in the forum.
But I think the main problem is not the frame rate itself.
As I mention in the topic, abrupt frame rate drops to 0 and causes display rendering momentarily stops and back normal again.
This happens even FG running quite nice high rate of frame such as 40 or 50 and get sudden motion stop.
Can it be prevented?
If it does not happen, I can stand up the low frame late somehow.
Hyde
 
Posts: 724
Joined: Fri Aug 12, 2011 2:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: Abrupt frame rate drop to 0

Postby Philosopher » Sun Jul 13, 2014 5:47 am

which aircraft(s)??? If you're talking about the NavDisplay – yeah, it has to run a positioned update which may take some time, but that will be fixed soon (after 3.2 sometime I think). But otherwise it will be really hard to trace down the issue.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Abrupt frame rate drop to 0

Postby Hooray » Sun Jul 13, 2014 6:20 am

What you describe is called "frame-spacing" - i.e. the amount of time it takes to render a single frame, see ThorstenB's explanation here:

http://wiki.flightgear.org/Howto:Use_the_system_monitor
ThorstenB wrote: imagine a system producing 100 frames in 0.5 seconds, then blocking completely for another 0.5 seconds: The fps display would still show "100fps", which seems great. But the 0.5 second stutter cause the visual performance to be terrible.

When evaluating simulation performance, don't get fooled by the frame rate. What's really important to us is the "worst case frame latency". Even if the system is producing a huge average of 100 frames per second, it can still look absolutely crappy, if only a single frame took more than 20-30ms, since that's immediately visible to the human eye. So, we're building a real-time system here, and 20-30ms is our timing constraint.

That's why it is preferable to display "(worst-case) frame spacing" instead of fps (View => Display Options => Show frame spacing). The frame spacing for the previous example would show "500ms", while a system producing 100 frames with perfectly even spacing would show "10ms".

So, frame spacing is a much better property to judge visual quality than just watching fps.


To see if it's related to Nasal callbacks, you only need to apply a simple patch I once posted here, which wraps each callback into SGTimeStamp calls, so that you can easily "time" each callback - and show "hot spots" that take more than several ms. You'll only get the file name and line number where the callback was registered though.

If it indeed Nasal callbacks that coincide with the stuttering, you should check if it's due to the Nasal code itself or due to the GC. ThorstenB once posted a patch doing this, I think it was ~30 lines.

Obviously, you need to be able to build from source, but at least, this can tell you 1) if the issue is related to Nasal callbacks, 2) if it's GC related or 3) if it's related to extension functions or "rogue" code.

To see if it's due to the positioned update, you only need to add two systime() calls to MapStructure (I think we might be even doing this somewhere?) - that will tell you if it's due to the spatial search.

It would be good to know what the issue is so that we can prioritize optimizing things - even though it seems that anything related to the GC is unlikely to be very popular :oops:
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Abrupt frame rate drop to 0

Postby Johan G » Sat Jul 19, 2014 9:41 pm

Hooray wrote in Sun Jul 13, 2014 6:20 am:To see if it's related to Nasal callbacks, you only need to apply a simple patch I once posted here, which wraps each callback into SGTimeStamp calls, so that you can easily "time" each callback - and show "hot spots" that take more than several ms.

I was searching for it to post the link but I am having trouble finding it...
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Abrupt frame rate drop to 0

Postby punkepanda » Sun Jul 20, 2014 12:58 am

Hooray wrote in Sun Jul 13, 2014 6:20 am:What you describe is called "frame-spacing" - i.e. the amount of time it takes to render a single frame, see ThorstenB's explanation here:


How do you know that Hooray?

I think he describes what he describes (frame rate), usualy that is FPS (Frames Per Second).

He probably look at FPS displays almost zero.

Comparing both "frame spacing" and "frame rate" in FG, it most of the time work in balance with eachother, as expected.

Except in ALS I notice bad frame-spacing with my naked eye. Especially with the "transition" option at max
punkepanda
 
Posts: 234
Joined: Mon Nov 04, 2013 10:11 pm
Callsign: LostFlight
Version: 2.12
OS: Arch Linux

Re: Abrupt frame rate drop to almost 0

Postby Hyde » Sun Jul 20, 2014 3:54 am

It was my fault.
I actually didn't see the number of 0. If frame rate is 0 then display can not display itself.
I thought screen stops that means 0.

Hooray is right.
Frame spacing goes to way long. ThorestenB already knew.

I've been tried to detect which one causes this long frame rate but not succeeded.

Does anyone know how to detect which part causes this issue?
Hyde
 
Posts: 724
Joined: Fri Aug 12, 2011 2:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: Abrupt frame rate drop to almost 0

Postby Johan G » Tue Jul 22, 2014 4:55 pm

Hyde wrote in Sun Jul 20, 2014 3:54 am:Does anyone know how to detect which part causes this issue?

Not much of an answer, but here goes:

Often the bottleneck seems to be how Nasal is used. To find the bottlenecks I guess it is up to "manual profiling". In essence running parts of the suspicious pieces of code in loops and time them, while progressively trying to optimize each of them. :wink: Looking through the code trying to hunt down the most run functions first will probably help a lot.

Thorsten seems to have done that a lot while he was working on advanced weather (then known as local weather). Doing that also revealed some performance bottlenecks and some workarounds.

Hooray have repeatedly expressed how great it would be if there was profiling tools for Nasal. Those could possibly for example see what functions in a script is run most times (in essence identify bottlenecks and low hanging fruit) and time the performance of each of them helping a developer write more efficient code and possibly also help find performance issues in Nasal itself.

In addition to profiling, unit tests could be a great thing to introduce at some point in the future. Done right they usually are written before commencing with writing a function.* In simple terms the unit test will test that a set of inputs to a function will produce valid outputs and that errors are caught as predicted. I guess they could also look out for unexpected performance drops. The unit tests would be linked together to check that all the functions of a larger piece of code work as expected.

* If done early they could in a way serve as both a specification and a test that the finished code meets the specification. Kind of a cognitive helper for the programmer. :wink:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Abrupt frame rate drop to 0  

Postby Hyde » Sat Nov 29, 2014 2:05 pm

Thanks for the Stuart's change on simgere 9da0031039bb534011591ce3bd6fede21030c345, this issue has almost gone.
Now I can have smooth view change and comfortable flying even with the rembrandt enabled. :D
Hyde
 
Posts: 724
Joined: Fri Aug 12, 2011 2:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: Abrupt frame rate drop to 0

Postby Hooray » Sat Nov 29, 2014 2:41 pm

yeah, apparently he fixed a pretty serious bug that Thorsten tracked down a couple of weeks ago.
Two pretty severe rendering-related bugs were recently fixed (effect listeners & multiple random object instance), so it does make sense that performance is improving.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Graphics

Who is online

Users browsing this forum: No registered users and 1 guest