OSRTT / OSLTT

Open Source Latency Test Tool
https://osrtt.com
Other
7 stars 0 forks source link

Extreme CPU usage by the function UpdateLog() #2

Closed placeholdername43 closed 1 year ago

placeholdername43 commented 1 year ago

Describe the bug 3 Billion Cycles used by the whileloop used in this function

To Reproduce Steps to reproduce the behavior:

  1. Launch the program
  2. View cpu cycle usage in process explorer

Expected behavior No excess usage of cpu cycles

Additional context Caused by UpdateLog()

private void UpdateLog()
{
    int listSize = 0;
    while (true)
    {
        while (this.IsHandleCreated)
        {
            if (listSize != debugList.Count)
            {
                for (int i = listSize; i < debugList.Count; i++)
                {
                    this.debugBox.Invoke((MethodInvoker)(() => this.debugBox.Text = debugList[i] + Environment.NewLine + this.debugBox.Text));
                }
                listSize = debugList.Count();
            }
        }
    }
}
andymanic commented 1 year ago

This one is a bit trickier for me to solve. I wanted to have the debug logs essentially backdated so when you open the log it fills it, but I have some ideas I can do to solve it. Will take a look tonight and see if I can improve it.

andymanic commented 1 year ago

Fixed that now. Will be in the next update this week