Shiny Profiler Reference:

Complete description of all the Shiny macros. Macro is a preprocessor directive that provides a mechanism for token replacement in your source code. Shiny uses macros to simplify interface and remain powerful. If the preprocessor SHINY_PROFILER is FALSE macro is ignored unless specified otherwise.

 

PROFILE_FUNC ()

Profiles the caller function. This will create and begin a profile with the caller function name until end of block. Call this in the beginning of your function.

 

PROFILE_CODE ( code )

Profiles and executes the specified code. This will create and begin a profile, execute code, and end profile. PROFILE_CODE is typically used when you want to profile a function call without touching the function source code or profiling every call.

 

PROFILE_BLOCK ( name )

Profile the caller block. This will create and begin a profile with the specified name until end of block. Name is an identifier (not a string) and uses C++ naming rules. Call this in the beginning of your block.

 

PROFILE_BEGIN ( name )

This will create and begin a profile with the specified name until PROFILE_END is called. Name is an identifier (not a string) and uses C++ naming rules. Call PROFILE_END to end profile.

 

PROFILE_END ()

Ends current profile. Call this after PROFILE_BEGIN or PROFILE_SHARED_BEGIN. If no current profile is runningis ignored.

 

PROFILE_SHARED_EXTERN ( name )

Declares shared profile with the specified name. Name is an identifier (not a string) and uses C++ naming rules. Add this outside of any function or class block and use the same profile in multiple areas. Call PROFILE_SHARED_BLOCK or PROFILE_SHARED_BEGIN with name to use profile. Profile must be created in one source file by PROFILE_SHARED_DEFINE.

 

PROFILE_SHARED_STATIC ( name )

Declares shared profile with the specified name. Name is an identifier (not a string) and uses C++ naming rules. Add this inside a class block and use the same profile in multiple areas. Call PROFILE_SHARED_BLOCK or PROFILE_SHARED_BEGIN with name to use profile. Profile must be created in one source file by PROFILE_SHARED_DEFINE with prefix format class::name where class is an identifier name for a class.

 

PROFILE_SHARED_DEFINE ( name )

Creates a shared profile with the specified name. Name is an identifier (not a string) and uses C++ naming rules. Add this outside of any function or class block and use the same profile in multiple areas inside the same source file. Use PROFILE_SHARED_EXTERN or PROFILE_SHARED_STATIC to expand profile for use in multiple source files. Call PROFILE_SHARED_BLOCK or PROFILE_SHARED_BEGIN with name to use profile. NOTE: if profile is declared in a class or namespace use prefix format class::name where class is an identifier name.

 

PROFILE_SHARED_BLOCK ( name )

Profiles the caller block. This will accumulate to a shared profile with the specified name until end of block. Call this in the beginning of your block. Name must be a shared profile created with PROFILE_SHARED_DEFINE inside the same scope.

 

PROFILE_SHARED_BEGIN ( name )

Profiles the caller block. This will accumulate to a shared profile with the specified name until PROFILE_END is called. Call PROFILE_END to end profile. Name must be a shared profile created with PROFILE_SHARED_DEFINE inside the same scope.

 

PROFILE_SHARED_DATA ( name )

Returns shared profile data as Shiny::ProfileData for specified name. Name must be a shared profile created with PROFILE_SHARED_DEFINE inside the same scope. Call PROFILE_SHARED_DATA after PROFILER_UPDATE. If SHINY_PROFILER is FALSE returns an empty Shiny::ProfileData.

 

PROFILE_ROOT_DATA ()

Returns shared profile data as Shiny::ProfileData for the root profile. Root is the background profile, profiles the area uncovered by any other user-defined profile and begins after the first user-defined profile began. Call PROFILE_ROOT_DATA after PROFILER_UPDATE. If SHINY_PROFILER is FALSE returns an empty Shiny::ProfileData.

 

PROFILER_UPDATE ( damping = 0.9 )

Processes all accumulated profiles and prepares for output. This computes average values with specified damping constant (see Exponential Moving Average). If no damping is specified default is 90%. PROFILER_UPDATE must be called before outputting data. In a game project this is typically called after every frame.

 

PROFILER_OUTPUT ( filename/ostream = std::cout )

Outputs and formats all processed profiles to text file with specified filename or to std::ostream with specified ostream. If no filename or ostream is specified default is console std::cout. Call this after PROFILER_UPDATE.PROFILER_OUTPUT returns true if output is successful or false if failed (or SHINY_PROFILER is FALSE).

 

PROFILER_OUTPUT_TREE_STRING ()

Formats all processed profiles and return only call tree output as std::string for custom display. Call this after PROFILER_UPDATE. In a game project this is typically called after every frame. If SHINY_PROFILER is FALSE returns returns an empty std::string.

 

PROFILER_OUTPUT_FLAT_STRING ()

Formats all processed profiles and returns only flat profile output as std::string for custom display. Call this after PROFILER_UPDATE. In a game project this is typically called after every frame. If SHINY_PROFILER is FALSE returns an empty std::string.

 

PROFILER_DESTROY ()

Destroys any created profiles. This function is OPTIONAL and if not called at end of program will only cause a negligible memory leak (which is automatically freed by the OS). THIS DOES NOT MEAN YOU CONTINUALLY LEAK MEMORY! Call PROFILER_DESTROY if you are getting annoying messages from a memory profiler, if the message doesn't go away the problem is somewhere else in your code.