Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Private Attributes | Friends | List of all members
blowbox::PerformanceProfiler::ProfilerBlock Class Reference

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

blowbox::PerformanceProfiler::ProfilerBlock::ProfilerBlock ( const String block_name,
const ProfilerBlockType block_type = ProfilerBlockType_MISC 
)

Starts a new ProfilerBlock.

Parameters
[in]block_nameThe name of the block that you're profiling. This name will be used in the Perf Profiler UI to identify this block.
[in]block_typeThe 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.

Member Function Documentation

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.

Member Data Documentation

String blowbox::PerformanceProfiler::ProfilerBlock::block_name_
private

The name of this ProfilerBlock.

ProfilerBlockType blowbox::PerformanceProfiler::ProfilerBlock::block_type_
private

The type of this ProfilerBlock.

double blowbox::PerformanceProfiler::ProfilerBlock::end_time_
private

The time at which this ProfilerBlock finished.

bool blowbox::PerformanceProfiler::ProfilerBlock::finished_
private

Whether the block has been finished already.

double blowbox::PerformanceProfiler::ProfilerBlock::start_time_
private

The time at which this ProfilerBlock spawned.


The documentation for this class was generated from the following files: