diff options
Diffstat (limited to 'src/test/Profiling.cpp')
-rw-r--r-- | src/test/Profiling.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/test/Profiling.cpp b/src/test/Profiling.cpp index 35f52dc..7dbf110 100644 --- a/src/test/Profiling.cpp +++ b/src/test/Profiling.cpp @@ -39,7 +39,7 @@ class TestScript : public Script { subscribe<CollisionEvent>( [this](const CollisionEvent & ev) -> bool { return this->oncollision(ev); }); } - void update() { + void fixed_update() { // Retrieve component from the same GameObject this script is on } }; @@ -82,9 +82,9 @@ public: }); // initialize systems here: //calls init - script_sys.update(); + script_sys.fixed_update(); //creates window - render_sys.update(); + render_sys.frame_update(); } // Helper function to time an update call and store its duration @@ -102,12 +102,14 @@ public: // Run and profile all systems, return the total time in milliseconds std::chrono::microseconds run_all_systems() { std::chrono::microseconds total_microseconds = 0us; - total_microseconds += time_function("PhysicsSystem", [&]() { physics_sys.update(); }); total_microseconds - += time_function("CollisionSystem", [&]() { collision_sys.update(); }); + += time_function("PhysicsSystem", [&]() { physics_sys.fixed_update(); }); total_microseconds - += time_function("ParticleSystem", [&]() { particle_sys.update(); }); - total_microseconds += time_function("RenderSystem", [&]() { render_sys.update(); }); + += time_function("CollisionSystem", [&]() { collision_sys.fixed_update(); }); + total_microseconds + += time_function("ParticleSystem", [&]() { particle_sys.fixed_update(); }); + total_microseconds + += time_function("RenderSystem", [&]() { render_sys.frame_update(); }); return total_microseconds; } @@ -219,7 +221,7 @@ TEST_F(DISABLED_ProfilingTest, Profiling_3) { .order_in_layer = 1, .size = {.y = 500}, }); - auto & test = gameobject.add_component<ParticleEmitter>(ParticleEmitter::Data{ + auto & test = gameobject.add_component<ParticleEmitter>(test_sprite, ParticleEmitter::Data{ .max_particles = 10, .emission_rate = 100, .end_lifespan = 100000, @@ -229,10 +231,9 @@ TEST_F(DISABLED_ProfilingTest, Profiling_3) { .offset = vec2{0, 0}, .reset_on_exit = false, }, - .sprite = test_sprite, }); } - render_sys.update(); + render_sys.frame_update(); this->game_object_count++; this->total_time = 0us; |