linuxgurugamer

[1.5.*, 1.6.1, 1.7] MemGraph Updated with Stutter Reduction

Recommended Posts

Mod key for Windows is Alt.

On Linux it's right Shift. 

Just replying to save someone the effort of figuring out why Alt doesn't work if they're using Linux :)

Share this post


Link to post
Share on other sites

Saved my career - after coming back from a few months out I found I was getting a stutter of a few milliseconds every 5 seconds or so. Was getting to the point of being unplayable.

 

But this mod fixed all the stuttering!

 

Thanks!!

Share this post


Link to post
Share on other sites

Is this working on 1.6?

Cause 1.6 seem to cause me more stutters as previous versions!

Share this post


Link to post
Share on other sites

@linuxgurugamer Is there a practical upper limit to how much to configure in padheap.cfg? I have 32GB of RAM and set the padheap.cfg at 8192. With KSP running Task Manager shows I'm only using 64% of my memory with only KSP and chrome open. Over one pass through the graph I saw a short interval of 63s and a long of 157s which is adequate, but I am curious if there is a point where throwing more RAM at the padheap doesn't help.

Share this post


Link to post
Share on other sites

For what it's worth, I turned to this add-on after 1.6.1 drove me to distraction with GC every second. Literally unplayable. This add-on works like a charm in 1.6.1, but jeez guys, if an add-on can do this, why can't the base game manage memory better by default?

Share this post


Link to post
Share on other sites

@linuxgurugamerA compliment to this great mod for coders is to use the Profiler that is in the Kerbalism and Trajectories GitHub sources. See the Profiler.cs file ;) 

Share this post


Link to post
Share on other sites
1 hour ago, PiezPiedPy said:

@linuxgurugamerA compliment to this great mod for coders is to use the Profiler that is in the Kerbalism and Trajectories GitHub sources. See the Profiler.cs file ;) 

Any instructions?

Share this post


Link to post
Share on other sites
On ‎2‎/‎19‎/‎2019 at 5:34 PM, linuxgurugamer said:

Any instructions?

Excerpt from CONTRIBUTING.md in the GitHub repo's
 
In your code, wrap the code you want to profile in pairs of MyameSpace.Profiler.Start("MyLabel") and MyameSpace.Profiler.Stop("MyLabel").

In-game, start it by pressing Ctrl-P. It shows each code entry belonging to one label as one line. The columns show:

  • NAME: The Label for the code being profiled.
  • LAST: Code runtime for a call in the last executed frame.
  • AVG: Code runtime averaged over all the calls since start or reset.
  • CALLS: Number of calls in the last executed frame.
  • AVG: Number of calls divided by the number of frames since start or reset.

You can reset these counters with the Reset button. You can enable/disable the display of any calls not called in the last frame with the Show zero calls button.

Share this post


Link to post
Share on other sites
19 minutes ago, PiezPiedPy said:
Excerpt from CONTRIBUTING.md in the GitHub repo's
 
In your code, wrap the code you want to profile in pairs of MyameSpace.Profiler.Start("MyLabel") and MyameSpace.Profiler.Stop("MyLabel").

In-game, start it by pressing Ctrl-P. It shows each code entry belonging to one label as one line. The columns show:

  • NAME: The Label for the code being profiled.
  • LAST: Code runtime for a call in the last executed frame.
  • AVG: Code runtime averaged over all the calls since start or reset.
  • CALLS: Number of calls in the last executed frame.
  • AVG: Number of calls divided by the number of frames since start or reset.

You can reset these counters with the Reset button. You can enable/disable the display of any calls not called in the last frame with the Show zero calls button.

So this needs to be added to each method/class you want to profile?  Nice, but what I really want is something that will automatically profile DLLs (ie:  be able to profile existing code)

Share this post


Link to post
Share on other sites
On ‎2‎/‎20‎/‎2019 at 6:03 PM, linuxgurugamer said:

So this needs to be added to each method/class you want to profile?  Nice, but what I really want is something that will automatically profile DLLs (ie:  be able to profile existing code)

Basically yes.
A Profiler for an entire dll would be good but I don't know off the top of my head how it would be implemented.

Edited by PiezPiedPy

Share this post


Link to post
Share on other sites
Posted (edited)

So, every time the ''garbage'' is collected its when my game stutters?

So this mod keep tracks of how often the collections happen and makes them less frequent with the cost of more constant memory used?

I am not sure if i understand it but it seems to make my game a lot smoother so thank you so much sir for this!

Edited by Boyster

Share this post


Link to post
Share on other sites

My understanding is you can increase the intervals between garbage collections by increasing the final value in MemGraph\Plugins\PluginData\MemGraph\padheap.cfg. 

Compare memory used by KSP in task manager vs installed system RAM.   Once you find a value you're happy with, go into MemGraph\Plugins\PluginData\MemGraph\settings.cfg and change "visible = false" and "applyPadding = true".  

Share this post


Link to post
Share on other sites

If increasing total increase the heap size, what do the 8-2032 values do?

Share this post


Link to post
Share on other sites
Posted (edited)

RESOLVED:  Numlock was on.  I'm a dumbass.

I'm having some trouble understanding if this is working or not.  I'm having issues with a specific mod causing severe hitching if I use any parts from that mod on any craft in flight.  I've already contacted the mod developer but I have a suspicion it'll be a GOK and I'll be stuck with it unless I can do more troubleshooting.  I suspect it's a GC issue so I installed this mod to try and sort it out.  I've made several attempts to launch my test vessel and had MG open on each.  I'm probably going to over-explain due to my ignorance of how this should work so please forgive me.   I'm running 1.6.1.

1.  I've modifed my padheap.cfg like this (trying to get 4GB allocation, I have 16GB of RAM):

Spoiler

8        : 1
16        : 1
24        : 1
32        : 1
40        : 1
48        : 1
64        : 1
80        : 1
96        : 1
112        : 1
144        : 1
176        : 1
208        : 1
240        : 1
296        : 1
352        : 1
432        : 1
664        : 0
800        : 0
1008    : 0
1344    : 0
2032    : 0
total    : 4096

2.  After loading into my save but before loading my craft this is my MG (for each of these I let the game "settle" for a minute or two except the after liftoff images):

ub3ydq8.jpg

3.  In VAB after loading my craft:

19whueG.jpg

4.  On the launchpad:

srNJui2.jpg

5.  10 seconds after lift off

lOd2yfQ.jpg

6.  And yikes, 30 seconds after lift off

6eg8uNw.jpg

7.  I tried Alt+Numpad-End and it doesn't seem to do anything.  Game is locking up every 2 seconds still:

y8hKGgV.jpg

I tried Alt+Numpad-End several more times in frustration and nothing changed.  What am I doing wrong?

P.S.  If I remove the parts from the problem mod and launch the exact same ship GC is only occuring every 30-60 seconds:

 

 

Edited by DoubleUU
Resolved

Share this post


Link to post
Share on other sites
Posted (edited)

Hi, this mod (latest version) doesn't work in Editor. It works in flight. I'm using KSP 1.6.1. Is it known issue or?

Edited by CanOmer

Share this post


Link to post
Share on other sites
10 minutes ago, CanOmer said:

Hi, this mod (latest version) doesn't work in Editor. It works in flight. I'm using KSP 1.6.1. Is it known issue or?

What makes you think it isn't working in the Editor?

Share this post


Link to post
Share on other sites
Posted (edited)

Graph creates red lines frequently (5-8sec) while in editor. In flight red lines appear after 90-120 sec.

I feel bad stutter in editor as same as not using Memgraph at all.

Edited by CanOmer

Share this post


Link to post
Share on other sites
Posted (edited)

@linuxgurugamer I've got a couple of questions pertaining to proper configuration of the padheap.cfg file that I've not been able to resolve through searching. I've got 32GB of RAM and my KSP install takes about 12GB fully loaded so I am considering upping the total in the padheap to 8192MB which should leave about 12GB overhead for running other processes on my computer. The first question is whether or not this is an appropriate amount of memory to be allocating in this way, or if I'd be overdoing it with that much and should aim for something more like 4GB in the padheap with the other 8GB as system overhead. Second, I've not seen any discussion about increasing the number / size of the blocks along with the total allocation of memory, so should that also be happening in this case, and if so, what would be a recommended increase to go with 4-8 GB of extra memory allocation?

Thanks

Edited by SpacedInvader

Share this post


Link to post
Share on other sites
1 hour ago, CanOmer said:

Graph creates red lines frequently (5-8sec) while in editor. In flight red lines appear after 90-120 sec.

I feel bad stutter in editor as same as not using Memgraph at all.

 That may be, but the fact that you are seeing the graph indicates it is still working. Your stutter in the editor might be related to mods you have installed. Provide a log file and let's see what's going on.

Share this post


Link to post
Share on other sites
Posted (edited)

Is there any possible fix? Because this bug drives me mad. I can't design craft without getting disrupted in every 5-8 seconds. ;.;

uGZ1Fj7.jpg

Edited by CanOmer

Share this post


Link to post
Share on other sites
On 3/25/2019 at 6:06 PM, CanOmer said:

I hope I created the log correctly: http://www.mediafire.com/file/hcoi7hsm6cg7ynk/Logs.zip

No, sorry, I just saw this.  I need the files KSP.log and output_log.txt files

I'm actually looking into something related, I'll include this in my research

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.