1

My sample app looks as follows.

class Program
    {
        static List<XmlNode> memList = new List<XmlNode>();
        static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start");
            Console.ReadKey();
            CauseHighCPU();
        }



        static public void CauseHighCPU()
        {
            string str = string.Empty;
            for (int i = 0; i < 100000; i++)
            {
                str += " Hello World";
            }
        }
}

I expect string concatenation to cause high cpu. When I profile the application using PerfView, this is very loud and clear.

enter image description here

I am trying to do similar analysis using Visual Studio 2017 Diagnostics Hub. Below is what its CPU usage tab shows.

enter image description here

Its Call-tree view not showing any call to Concat, although, there are some External Code here enter image description here

This makes me think that it may related to something missing in my configration. As you can see here, Enable Just My Code is unchecked.

enter image description here

Also not sure if its related but here is symbols settings.

enter image description here

Any thouhts what could be wrong that is causing VS not showing root cause of high-cpu usage.

jim crown
  • 473
  • 3
  • 11

1 Answers1

2

You should not look in the options of Debugging but in the options of Performance Tools and then disable "Just my code":

Options: disable "Just my code" in Performance tools

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • this was it my friend. Thanks a lot. However, this is now bringing up too much "junk" from ntdll.dll, wow64.dll. PerfView view is just too cleaner. Is there anyway to get same type of stack here in VS? – jim crown Sep 14 '17 at 20:24
  • @jimcrown: sorry, I don't know of a way cleaning that up in Visual Studio – Thomas Weller Sep 14 '17 at 20:27
  • no worries, I will post a separate question here because this is a separate topic anyways – jim crown Sep 14 '17 at 20:29