mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Implement profiler (#16194)
* Implement profiling API * Add console commands for the profiler * Remove accidental line * Correct csv output * Add copyright notice * Add missing override * Add default virtual destructor * Explicitly pass template argument * Use static * Add plugin API for profiler * Add more profile calls * Workaround for GCC hopefully * Add missing static keyword * Use uint64 for call count * Reduce name length see if CI passes * Improve handling of function names * Work around (broken) static inline variables * Fix missing include * Disable profiler for clang 5 and older * Update copyright date * Profile UpdateAllMiscEntities * Apply review suggestions Co-authored-by: Ted John <ted@brambles.org>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
# include "bindings/game/ScConsole.hpp"
|
||||
# include "bindings/game/ScContext.hpp"
|
||||
# include "bindings/game/ScDisposable.hpp"
|
||||
# include "bindings/game/ScProfiler.hpp"
|
||||
# include "bindings/network/ScNetwork.hpp"
|
||||
# include "bindings/network/ScPlayer.hpp"
|
||||
# include "bindings/network/ScPlayerGroup.hpp"
|
||||
@@ -402,6 +403,7 @@ void ScriptEngine::Initialise()
|
||||
ScParkMessage::Register(ctx);
|
||||
ScPlayer::Register(ctx);
|
||||
ScPlayerGroup::Register(ctx);
|
||||
ScProfiler::Register(ctx);
|
||||
ScRide::Register(ctx);
|
||||
ScRideStation::Register(ctx);
|
||||
ScRideObject::Register(ctx);
|
||||
@@ -429,6 +431,7 @@ void ScriptEngine::Initialise()
|
||||
dukglue_register_global(ctx, std::make_shared<ScMap>(ctx), "map");
|
||||
dukglue_register_global(ctx, std::make_shared<ScNetwork>(ctx), "network");
|
||||
dukglue_register_global(ctx, std::make_shared<ScPark>(), "park");
|
||||
dukglue_register_global(ctx, std::make_shared<ScProfiler>(ctx), "profiler");
|
||||
dukglue_register_global(ctx, std::make_shared<ScScenario>(), "scenario");
|
||||
|
||||
_initialised = true;
|
||||
@@ -648,6 +651,8 @@ void ScriptEngine::StopPlugins()
|
||||
|
||||
void ScriptEngine::Tick()
|
||||
{
|
||||
PROFILED_FUNCTION();
|
||||
|
||||
if (!_initialised)
|
||||
{
|
||||
Initialise();
|
||||
|
||||
Reference in New Issue
Block a user