OpenTTD Source  12.0-beta2
NewGRFProfiler Struct Reference

Callback profiler for NewGRF development. More...

#include <newgrf_profiling.h>

Data Structures

struct  Call
 Measurement of a single sprite group resolution. More...
 

Public Member Functions

 NewGRFProfiler (const GRFFile *grffile)
 Create profiler object and begin profiling session. More...
 
 ~NewGRFProfiler ()
 Complete profiling session and write data to file.
 
void BeginResolve (const ResolverObject &resolver)
 Capture the start of a sprite group resolution. More...
 
void EndResolve (const SpriteGroup *result)
 Capture the completion of a sprite group resolution.
 
void RecursiveResolve ()
 Capture a recursive sprite group resolution.
 
void Start ()
 
uint32 Finish ()
 
void Abort ()
 
std::string GetOutputFilename () const
 Get name of the file that will be written. More...
 

Static Public Member Functions

static uint32 FinishAll ()
 

Data Fields

const GRFFilegrffile
 Which GRF is being profiled.
 
bool active
 Is this profiler collecting data.
 
uint16 start_tick
 Tick number this profiler was started on.
 
Call cur_call
 Data for current call in progress.
 
std::vector< Callcalls
 All calls collected so far.
 

Detailed Description

Callback profiler for NewGRF development.

Definition at line 26 of file newgrf_profiling.h.

Constructor & Destructor Documentation

◆ NewGRFProfiler()

NewGRFProfiler::NewGRFProfiler ( const GRFFile grffile)

Create profiler object and begin profiling session.

Parameters
grffileThe GRF file to collect profiling data on
end_dateGame date to end profiling on

Definition at line 30 of file newgrf_profiling.cpp.

References grffile.

Member Function Documentation

◆ BeginResolve()

void NewGRFProfiler::BeginResolve ( const ResolverObject resolver)

Capture the start of a sprite group resolution.

Parameters
resolverData about sprite group being resolved

Definition at line 45 of file newgrf_profiling.cpp.

References cur_call, NewGRFProfiler::Call::root_sprite, ResolverObject::root_spritegroup, NewGRFProfiler::Call::subs, and NewGRFProfiler::Call::time.

◆ GetOutputFilename()

std::string NewGRFProfiler::GetOutputFilename ( ) const

Get name of the file that will be written.

Returns
File name of profiling output file.

Definition at line 131 of file newgrf_profiling.cpp.

References Time< T >::Format(), and lastof.


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