GCS  0.2.3
Data Structures | Namespaces | Macros | Functions
gu_profile.hpp File Reference

Lightweight profiling utility. More...

#include "gu_time.h"
#include "gu_datetime.hpp"
#include "gu_lock.hpp"
#include <map>
#include <ostream>

Go to the source code of this file.

Data Structures

class  gu::prof::Key
 
class  gu::prof::Point
 
class  gu::prof::Profile
 

Namespaces

 gu
 

Macros

#define profile_enter(__p)
 
#define profile_leave(__p)
 

Functions

std::ostream & gu::prof::operator<< (std::ostream &, const Key &)
 
std::ostream & gu::prof::operator<< (std::ostream &, const Profile &)
 

Detailed Description

Lightweight profiling utility.

Profiling utility suitable for getting runtime code profile information with minimal overhead. Macros profile_enter() and profile_leave() can be inserted around the code and will be expanded to profiling code if GU_PROFILE is defined.

Example usage:

Profile prof("prof");
void func()
{
if (is_true())
{
profile_enter(prof); // This is line 227
// Do something
// ...
profile_leave(prof);
}
else
{
profile_enter(prof); // This is line 250
// Do something else
// ...
profile_leave(prof);
}
}
// Somewhere else in your code
log_info << prof;