If you use Microsoft’s Visual Studio to develop your applications, chances are you either have the express or professional editions, which are free or $549 respectively. Unfortunately, neither of these editions comes with a code profiler! Instead, if you want to use a built-in code profiler for Visual Studio out of the box, you’ll need to have either the premium or ultimate edition for $5,469 or $11,899 respectively. No joke! Luckily, you don’t need to use Visual Studio’s built-in profiler to effectively and easily profile your code.

A while ago, I stumbled upon a program called Very Sleepy. This is an incredibly lightweight and free profiler. Even the source code is available for free, if you’re interested. Using Very Sleepy is easy, and if you’re writing a program with Visual Studio, it should be able to automatically find all your source files automatically, so you won’t even have to set anything up.

How to use Very Sleepy

The first step is to execute Very Sleepy. A dialog will appear with a list of all active processes. Next, you can execute the program you wrote with Visual Studio. Of course, things will go a lot easier for you if you use the debug version of your program since lines of code won’t be optimized away, etc. Once your program is running, click ‘Refresh’ in the Very Sleepy dialog window. Next, find, and double click your application’s process. At this moment in time, Very Sleepy will start taking hundreds or even thousands of samples during your program execution. I believe this is a different method than the built in method with Visual Studio, which uses code instrumenting. Anyway, the more samples Very Sleepy takes, the more information it has. To view the profiled information, you can either interrupt Very Sleepy when you feel there have been enough samples taken, or you can wait until your program ends, which Very Sleepy will automatically detect. Either way, this free code profiler should give you an extremely good idea of where most of the time in your code is spent.