Bifrost SDK
Bifrost SDK documentation
Amino::RuntimeServices::ProfilerGuard Class Reference

Helper class to ensure all profiler events have matching begin/end calls. More...

#include <RuntimeServices.h>

Public Member Functions

 ~ProfilerGuard ()
 Destructor. More...
 
 ProfilerGuard (RuntimeServices const &rs, const char *eventName)
 Constructor. More...
 
 ProfilerGuard (RuntimeServices const &rs)
 Constructor. More...
 

Detailed Description

Helper class to ensure all profiler events have matching begin/end calls.

The ProfilerGuard begins the even upon construction and ends the event upon destruction. It can be used like this:

{
RuntimeServices::ProfilerGuard profGuard{runtimeServices, "my compute"};
// ...
}
// The guard is now out-of-scope, which will have called the destructor
// and therefore end the profiling event.
Helper class to ensure all profiler events have matching begin/end calls.
Which is equivalent to:
{
int eventId = runtimeServices.profilerEventBegin("my compute");
// ...
runtimeServices.profilerEventEnd(eventId);
}

Definition at line 330 of file RuntimeServices.h.

Constructor & Destructor Documentation

◆ ProfilerGuard() [1/2]

Amino::RuntimeServices::ProfilerGuard::ProfilerGuard ( RuntimeServices const &  rs,
const char *  eventName 
)
inline

Constructor.

Starts the profiling event.

Definition at line 336 of file RuntimeServices.h.

◆ ProfilerGuard() [2/2]

Amino::RuntimeServices::ProfilerGuard::ProfilerGuard ( RuntimeServices const &  rs)
inlineexplicit

Constructor.

Starts the profiling event.

Definition at line 338 of file RuntimeServices.h.

◆ ~ProfilerGuard()

Amino::RuntimeServices::ProfilerGuard::~ProfilerGuard ( )
inline

Destructor.

Ends the profiling event.

Definition at line 345 of file RuntimeServices.h.

References Amino::RuntimeServices::profilerEventEnd().