Click here to Skip to main content
15,898,010 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.7K   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
//-------------------------------------------------------------------------------------------------------------

class Function;
//-------------------------------------------------------------------------------------------------------------

//! Class defining the function call stack of the target application.

//! Class defining the function call stack of the target application.
class CallStack
{
public:

	//! Constructor.
	CallStack();

	//! Function to push the function object at the start of it's execution.
	//! @param ent the pointer to the function object.
	void		push( Function *ent);
	
	//! Function to pop the function object at the end of it's execution.
	void		pop();
	
	//! Function to retrieve the first function on the call stack.
	//! @returns a Function pointer at the top of the call stack.
	Function*	top();

	//! Function to test if the call stack is empty.
	//! @returns a true if the call stack is not empty else false.
	bool		hasChild();

protected:
	std::stack<Function*>	mEntryStack;
};
//-------------------------------------------------------------------------------------------------------------

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