I want to implement a function tracer, which would trace how much time a function is taking to execute. I have following class for the same:-
class FuncTrace
C99 has __func__, but for C++ this will be compiler specific. On the plus side, some of the compiler-specific versions provide additional type information, which is particularly nice when you're tracing inside a templatized function/class.
__FUNCTION__, __FUNCDNAME__, __FUNCSIG____func__, __FUNCTION__, __PRETTY_FUNCTION__Boost library has defined macro BOOST_CURRENT_FUNCTION for most C++ compilers in header boost/current_function.hpp. If the compiler is too old to support this, the result will be "(unknown)".