WinDbg debugging the high CPU consumption of the problem test + combat "the seventh chapter"

Source: Internet
Author: User
Tags mscorlib

first, high CPU test

  1. Sample Code

        Static voidMain (string[] args)            {console.clear (); Console.WriteLine ("to the command line, switch to the WinDbg directory, and execute ADPLUS-HANG-PN highcpu.exe-o c:\\dumps"); Console.WriteLine ("If you want to stop, press CTRL + C to end the program"); Console.WriteLine ("====================================================");  while(true) {console.setcursorposition (0,3);            Console.Write (DateTime.Now.Ticks.ToString ());        } console.readkey (); }

  2, after running the console program, crawl 3 times dump, preferably a few minutes each interval.

  3. Execute the following instructions for each dump separately.

First Dump:0: the>. Load Clr20\sos.dll0: the>!Runaway User Mode time Thread time0:334       0Days0:xx:00.468   3:d C80Days0:xx:00.000   2: 14d00Days0:xx:00.000   1: -       0Days0:xx:00.000a second dump:0: the>. Load Clr20\sos.dll0: the>!Runaway User Mode time Thread time0:334       0Days0:xx:08.221   3:d C80Days0:xx:00.000   2: 14d00Days0:xx:00.000   1: -       0Days0:xx:00.000a third dump:0: the>. Load Clr20\sos.dll0: the>!Runaway User Mode time Thread time0:334       0Days0:xx:11.559   3:d C80Days0:xx:00.000   2: 14d00Days0:xx:00.000   1: -       0Days0:xx:00.000

As you can see from the above output, the CPU time of thread 0 is increasing and the CPU high occupancy is probably caused by a problem with the code that thread 0 is executing.

You can use the!clrstack command to view the current call stack and the local variables and values on it.

When executing the!clrstack, the following prompt is reported:

0:>!   0x80004005in do.

This is not what I want, load Mscorwks failed. Later, after debugging, it turns out that it was the first step. Load is wrong, because my piece of code is vs2010. So you should load. NET Frameword 4.0.

So, the first should be executed. Load C:/windows/microsoft.net/framework/v4.0.30319/sos.dll

Then execute the!clrstack

A third dump

0: the>!clrstackError:symbol file could not being found. defaulted to export symbols forClr.dll-PDB Symbol forClr.dll not Loadedos Thread Id:0x334(0) Child SP IP call Site001cf2b8 779e70f4 [inlinedcallframe:001cf2b8] 001cf2b4 6a14672eWarning:unable to verify Checksum forMscorlib.ni.dllDomainNeutralILStubClass.IL_STUB_PInvoke (INTPTR, COORD) 001cf2b8 6a1b6cfd [inlinedcallframe: 001CF2B8] Microsoft.Win32.Win32Native.SetConsoleCursorPosition (INTPTR, COORD) 001cf2ec 6a1b6cfd  System.Console.SetCursorPosition (Int32, Int32)001cf324 005500bbWarning:unable to verify Checksum forConsoleApplication3.exeConsoleApplication3.Program.Main (system.string[]) [C:\Users\ChenZhuo\documents\ Visual Studio 2010\projects\consoleapplication3\consoleapplication3\program.cs @ ]001cf4dc 70a33e22 [GCFRAME:001CF4DC]

A second dump

0: the>!clrstackError:symbol file could not being found. defaulted to export symbols forClr.dll-PDB Symbol forClr.dll not Loadedos Thread Id:0x334(0) Child SP IP call Site001cf2b8 779e70f4 [inlinedcallframe:001cf2b8] 001cf2b4 6a14672eWarning:unable to verify Checksum forMscorlib.ni.dllDomainNeutralILStubClass.IL_STUB_PInvoke (INTPTR, COORD) 001cf2b8 6a1b6cfd [inlinedcallframe: 001CF2B8] Microsoft.Win32.Win32Native.SetConsoleCursorPosition (INTPTR, COORD) 001cf2ec 6a1b6cfd  System.Console.SetCursorPosition (Int32, Int32)001cf324 005500bbWarning:unable to verify Checksum forConsoleApplication3.exeConsoleApplication3.Program.Main (system.string[]) [C:\Users\ChenZhuo\documents\ Visual Studio 2010\projects\consoleapplication3\consoleapplication3\program.cs @ ]001cf4dc 70a33e22 [GCFRAME:001CF4DC]

First Dump:

0: the>!clrstackError:symbol file could not being found. defaulted to export symbols forClr.dll-PDB Symbol forClr.dll not Loadedos Thread Id:0x334(0) Child SP IP call Site001cf2b8 779e70f4 [inlinedcallframe:001cf2b8] 001cf2b4 6a14672eWarning:unable to verify Checksum forMscorlib.ni.dllDomainNeutralILStubClass.IL_STUB_PInvoke (INTPTR, COORD) 001cf2b8 6a1b6cfd [inlinedcallframe: 001CF2B8] Microsoft.Win32.Win32Native.SetConsoleCursorPosition (INTPTR, COORD) 001cf2ec 6a1b6cfd  System.Console.SetCursorPosition (Int32, Int32)001cf324 005500bbWarning:unable to verify Checksum forConsoleApplication3.exeConsoleApplication3.Program.Main (system.string[]) [C:\Users\ChenZhuo\documents\ Visual Studio 2010\projects\consoleapplication3\consoleapplication3\program.cs @ ]001cf4dc 70a33e22 [GCFRAME:001CF4DC]

Do not know why, my third dump did not appear highcpu hint, perhaps my Computer configuration is a bit high bar. However, the code of the problem can be seen, just in the main method. Just look at the main method to find out where the problem is OK.

Learn from: http://www.cnblogs.com/juqiang/archive/2008/01/11/1035689.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.