0

I am working on a C# console application. It mostly just hosts a soap service, and listens for messages coming in to process. However, even when no soap messages are received, all 6 cores on my laptop are being heavily used. From a code walk through I can't see what is causing it.

Is there are any debug tools in Visual Studio that can help pinpoint where CPU is being eaten up.

Boardy
  • 35,417
  • 104
  • 256
  • 447
  • 1
    You don't really need any tools for this. Just use Debug > Break All, whatever statement it stops on is one that burns core. – Hans Passant Jun 16 '15 at 22:30
  • Assuming you have some kind of listening loop running, let it sleep a little between checking the socket. – TommyGunn32 Jun 17 '15 at 00:40

1 Answers1

2

You can use the Profiler that is built into Visual Studio.

For Visual Studio 2013, select the menu ANALYZE / Performance and Diagnostics

Use the Performance Wizard.

It will show you hot spots in your code (where the most CPU cycles are being burned).

Note that you may need to launch Visual Studio as Administrator for proper profiling.

NOTE:

You can download stand-alone profiling tools for VS 2010 from Microsoft. See https://stackoverflow.com/a/11197203/141172

Community
  • 1
  • 1
Eric J.
  • 147,927
  • 63
  • 340
  • 553