xgulism1 / UE_Spice_Demo

A demo project for the Spice plugin for Unreal Engine.
3 stars 0 forks source link

FPS Drop after each pause #3

Open Angelo50 opened 1 year ago

Angelo50 commented 1 year ago

Hi Martin

May be you could help me on that My process to use your plug-in is just the following:

I Start the analysys with a circuit Then, I pause it to get the values Parse the values to my Component Actors Unpause All this in a loop

It works but, each time I pause and unpause, it generate a big drop of FPS I have tested if it comes from my parsing, but, no, it is really coming from the "SetAnalysisShouldPause", even with a very small circuit (1 Voltage source and 1 resistor)

Do you have an idea ?

Thanks for your help

Angelo.

xgulism1 commented 1 year ago

Hi,

I have some ideas which could cause it.

When SetAnalysisShouldPause is called, the bg_halt is called from the plugin and the pause is handled by ngspice. In ngspice source code, the pause is handled by a 100-cycle loop, that tries to stop the computation and sleep the calling (main) thread between attempts. Failing to pause the first time can cause hiccups because of this. I'll try to test it and see if that causes the problem or it is something else.

However, for pausing at regular intervals, I would recommend using StepCount to run only a limited number of steps instead. The bg_halt is not called at all in this case and the pause should be handled more gracefully (avoiding the previously mention flow).

Thanks,

Martin

Angelo50 commented 1 year ago

Thanks a lot,

Using the stepcount works like a charm

Angelo.