|
WSF
|
Scope guard, whose constructor starts the profiling system, and whose destructor stops the profiling system. More...
#include <ProfilingSystem.hpp>
Public Member Functions | |
| ProfilingSystem (const ProfilingSystemArguments &aArgs) | |
| Use command-line arguments, as they would be parsed by code that uses profiling, to start the profiling system. | |
| ~ProfilingSystem () | |
| Finalize the global profiling hooks if they were initialized, and then unload the shared library containing the hooks. | |
| ProfilingSystem ()=delete | |
| ProfilingSystem (const ProfilingSystem &)=delete | |
| ProfilingSystem & | operator= (const ProfilingSystem &)=delete |
| ProfilingSystem (ProfilingSystem &&)=delete | |
| ProfilingSystem & | operator= (ProfilingSystem &&)=delete |
Scope guard, whose constructor starts the profiling system, and whose destructor stops the profiling system.
This class is meant to be used with ProfilingRegion, which marks a scope of C++ code for profiling.
Always name the variable representing the ProfilingSystem instance. Don't just invoke the constructor without giving the variable a name. If you forget to name the variable, then the region will close right away, since the unnamed temporary object's destructor will be invoked at the end of the statement.
main scope! Always make sure the object is out of scope before main returns.ProfilingSystem active at a time. Please also see the thread parallelism discussion in the documentation of ProfilingRegion. | profiling::ProfilingSystem::ProfilingSystem | ( | const ProfilingSystemArguments & | aArgs | ) |
Use command-line arguments, as they would be parsed by code that uses profiling, to start the profiling system.
| aArgs | Command-line arguments, as they would be parsed by code that uses profiling. |
false, or aArgs.mProfilingOutputDest.has_value() is true."Start the profiling system" means to call the function in the library that initializes it, thus preparing it for profiling. Once the profiling system is started, you may use profiling regions (see ProfilingRegion.hpp) and sections to profile regions of C++ code, as long as the ProfilingSystem object is in scope.
If aArgs.mProfilingOutputDest is not set (does not have a value), then profiling will not occur. You may still use profiling regions and sections, but they will have no effect.
If aArgs.mProfilingOutputDest is set (has a value), profiling will occur. In that case, if aArgs.mProfilingLibraryPath is not set (does not have a value), then profiling will use the AFPerf library of profiling hooks. This is the primary (default) library that AFSIM builds and installs. It's what you want if you don't know otherwise. If aArgs.mProfilingLibraryPath is set (has a value), then profiling will use the alternate library of profiling hooks. An alternate shared library of profiling hooks may be any shared library that implements the interface described in ProfilingHooks.hpp, and need not be built or installed by AFSIM.
References profiling::ProfilingSystemArguments::mProfilingLibraryPath, and profiling::ProfilingSystemArguments::mProfilingOutputDest.
Referenced by operator=(), operator=(), ProfilingSystem(), and ProfilingSystem().
| profiling::ProfilingSystem::~ProfilingSystem | ( | ) |
Finalize the global profiling hooks if they were initialized, and then unload the shared library containing the hooks.
Once this destructor has been invoked, you may no longer use profiling regions or sections.
atexit handler. Doing so can cause segmentation violations or other errors, as any state in the shared library might become invalid by the time exit is called or main returns. It's important that the destructor be called before main returns.
|
delete |
|
delete |
References ProfilingSystem().
|
delete |
References ProfilingSystem().
|
delete |
References ProfilingSystem().
|
delete |
References ProfilingSystem().