OpenTTD Source 20241224-master-gf74b0cf984
|
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. | |
~NewGRFProfiler () | |
Complete profiling session and write data to file. | |
void | BeginResolve (const ResolverObject &resolver) |
Capture the start of a sprite group resolution. | |
void | EndResolve (const SpriteGroup *result) |
Capture the completion of a sprite group resolution. | |
void | RecursiveResolve () |
Capture a recursive sprite group resolution. | |
void | Start () |
uint32_t | Finish () |
void | Abort () |
std::string | GetOutputFilename () const |
Get name of the file that will be written. | |
Static Public Member Functions | |
static void | StartTimer (uint64_t ticks) |
Start the timeout timer that will finish all profiling sessions. | |
static void | AbortTimer () |
Abort the timeout timer, so the timer callback is never called. | |
static uint32_t | FinishAll () |
Data Fields | |
const GRFFile * | grffile |
Which GRF is being profiled. | |
bool | active |
Is this profiler collecting data. | |
uint64_t | start_tick |
Tick number this profiler was started on. | |
Call | cur_call |
Data for current call in progress. | |
std::vector< Call > | calls |
All calls collected so far. | |
Callback profiler for NewGRF development.
Definition at line 23 of file newgrf_profiling.h.
NewGRFProfiler::NewGRFProfiler | ( | const GRFFile * | grffile | ) |
Create profiler object and begin profiling session.
grffile | The GRF file to collect profiling data on |
end_date | Game date to end profiling on |
Definition at line 30 of file newgrf_profiling.cpp.
NewGRFProfiler::~NewGRFProfiler | ( | ) |
Complete profiling session and write data to file.
Definition at line 37 of file newgrf_profiling.cpp.
void NewGRFProfiler::Abort | ( | ) |
Definition at line 125 of file newgrf_profiling.cpp.
|
static |
Abort the timeout timer, so the timer callback is never called.
Definition at line 179 of file newgrf_profiling.cpp.
References _profiling_finish_timeout.
void NewGRFProfiler::BeginResolve | ( | const ResolverObject & | resolver | ) |
Capture the start of a sprite group resolution.
resolver | Data about sprite group being resolved |
Definition at line 45 of file newgrf_profiling.cpp.
References ResolverObject::callback, NewGRFProfiler::Call::cb, TimerGameTick::counter, cur_call, NewGRFProfiler::Call::feat, ResolverObject::GetDebugID(), ResolverObject::GetFeature(), NewGRFProfiler::Call::item, NewGRFProfiler::Call::root_sprite, ResolverObject::root_spritegroup, NewGRFProfiler::Call::subs, NewGRFProfiler::Call::tick, and NewGRFProfiler::Call::time.
void NewGRFProfiler::EndResolve | ( | const SpriteGroup * | result | ) |
Capture the completion of a sprite group resolution.
Definition at line 60 of file newgrf_profiling.cpp.
References calls, cur_call, GetSpriteLocalID(), NewGRFProfiler::Call::result, and NewGRFProfiler::Call::time.
uint32_t NewGRFProfiler::Finish | ( | ) |
Definition at line 93 of file newgrf_profiling.cpp.
|
static |
Definition at line 140 of file newgrf_profiling.cpp.
std::string NewGRFProfiler::GetOutputFilename | ( | ) | const |
Get name of the file that will be written.
Definition at line 135 of file newgrf_profiling.cpp.
References BSWAP32(), FiosGetScreenshotDir(), and grffile.
void NewGRFProfiler::RecursiveResolve | ( | ) |
Capture a recursive sprite group resolution.
Definition at line 81 of file newgrf_profiling.cpp.
References cur_call, and NewGRFProfiler::Call::subs.
void NewGRFProfiler::Start | ( | ) |
Definition at line 86 of file newgrf_profiling.cpp.
|
static |
Start the timeout timer that will finish all profiling sessions.
Definition at line 171 of file newgrf_profiling.cpp.
References _profiling_finish_timeout, TimerGameTick::NONE, and TimeoutTimer< TTimerType >::Reset().
bool NewGRFProfiler::active |
Is this profiler collecting data.
Definition at line 53 of file newgrf_profiling.h.
std::vector<Call> NewGRFProfiler::calls |
All calls collected so far.
Definition at line 56 of file newgrf_profiling.h.
Referenced by EndResolve().
Call NewGRFProfiler::cur_call |
Data for current call in progress.
Definition at line 55 of file newgrf_profiling.h.
Referenced by BeginResolve(), EndResolve(), and RecursiveResolve().
const GRFFile* NewGRFProfiler::grffile |
Which GRF is being profiled.
Definition at line 52 of file newgrf_profiling.h.
Referenced by GetOutputFilename(), and SpriteGroup::Resolve().
uint64_t NewGRFProfiler::start_tick |
Tick number this profiler was started on.
Definition at line 54 of file newgrf_profiling.h.