Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <performance_profiler.h>
Public Member Functions | |
ProfilerBlock (const String &block_name, const ProfilerBlockType &block_type=ProfilerBlockType_MISC) | |
~ProfilerBlock () | |
void | Restart () |
void | Finish () |
Private Attributes | |
String | block_name_ |
ProfilerBlockType | block_type_ |
double | start_time_ |
double | end_time_ |
bool | finished_ |
Friends | |
class | PerformanceProfiler |
class | CompareProfilerBlockSingleFrame |
Allows you to profile a block of code.
This class is the beating heart of the profiler. It allows you to profile any block of code with literally only one line of code. The ProfilerBlock is all based around RAII and the scope in which it lives. It is automatically initialized when you allocate the memory for it, and it it automatically reported to the Profiler at the end of its lifetime. You only need to pass in a name and a category in which the ProfilerBlock should exist. The Profiler will take care of the rest.
blowbox::PerformanceProfiler::ProfilerBlock::ProfilerBlock | ( | const String & | block_name, |
const ProfilerBlockType & | block_type = ProfilerBlockType_MISC |
||
) |
Starts a new ProfilerBlock.
[in] | block_name | The name of the block that you're profiling. This name will be used in the Perf Profiler UI to identify this block. |
[in] | block_type | The type of block that you're profiling. This is optional, but if you'd like to group your ProfilerBlocks in the Perf Profiler UI you can use this. |
blowbox::PerformanceProfiler::ProfilerBlock::~ProfilerBlock | ( | ) |
Destructs the ProfilerBlock. It automatically calls ProfilerBlock::Finish() for you.
void blowbox::PerformanceProfiler::ProfilerBlock::Finish | ( | ) |
Finishes the ProfilerBlock. This means that the block will expire and report itself to the main Profiler instance.
void blowbox::PerformanceProfiler::ProfilerBlock::Restart | ( | ) |
This invalidates the ProfilerBlock.
|
private |
The name of this ProfilerBlock.
|
private |
The type of this ProfilerBlock.
|
private |
The time at which this ProfilerBlock finished.
|
private |
Whether the block has been finished already.
|
private |
The time at which this ProfilerBlock spawned.