Click here to Skip to main content
15,895,011 members
Articles / Desktop Programming / Win32

A Simple Profiler using the Visual Studio C/C++ Compiler and DIA SDK

Rate me:
Please Sign up or sign in to vote.
4.97/5 (40 votes)
15 Dec 2009CPOL6 min read 138.5K   3.3K   92  
Easy to use profiler for time and impact analysis of C/C++ code which uses the Visual Studio C/C++ compiler (/Gh and /GH flags) and the DIA SDK to gather profiling data.
//-------------------------------------------------------------------------------------------------------------

#pragma once
//-------------------------------------------------------------------------------------------------------------

// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER				// Allow use of features specific to Windows XP or later.
#define WINVER 0x0501		// Change this to the appropriate value to target other versions of Windows.
#endif

#ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   
#define _WIN32_WINNT 0x0501	// Change this to the appropriate value to target other versions of Windows.
#endif						

#ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif

#ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0600	// Change this to the appropriate value to target other versions of IE.
#endif

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include <atlbase.h>
#include <comutil.h>
//-------------------------------------------------------------------------------------------------------------

#include "exports.h"

#include <fstream>
#include <stack>
#include <string>
#include <map>
#include <set>
#include <time.h>
#include <TCHAR.h>
#include <dia2.h>
#include <Psapi.h>
//-------------------------------------------------------------------------------------------------------------

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Geometric Ltd
India India
C/C++ practitioner with more than 5 years of experience in 3D Visualization.

Comments and Discussions