diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-20 14:28:25 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-20 14:28:25 +0200 |
commit | 97bb5115cbbffb63f8bdc0125ee1056aab344fd3 (patch) | |
tree | 94682cf69702598bbc2a9138bc34ad615698b76d /src | |
parent | 84766a7d49d3c1e233e13191c86d4ada2bbe2ddc (diff) |
More profiling data.
Diffstat (limited to 'src')
-rw-r--r-- | src/common.hpp | 3 | ||||
-rw-r--r-- | src/game/interface.cpp | 16 | ||||
-rw-r--r-- | src/main.cpp | 6 | ||||
-rw-r--r-- | src/world.cpp | 10 |
4 files changed, 33 insertions, 2 deletions
diff --git a/src/common.hpp b/src/common.hpp index 2e89142..b0d1674 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -60,6 +60,9 @@ public: extern freq_counter_t fc_render; extern freq_counter_t fc_game; +extern freq_counter_t fc_traces, fc_trace_tiles, fc_trace_ents; +extern freq_counter_t fc_get_entities, fc_get_entities_ents; + #ifdef CONFIG_SHOW_RSS size_t sys_get_rss(void); #endif diff --git a/src/game/interface.cpp b/src/game/interface.cpp index 5872d17..26ade2a 100644 --- a/src/game/interface.cpp +++ b/src/game/interface.cpp @@ -381,6 +381,22 @@ void state_t::render_to(render::state_t *render) x[1] -= em; ss.str(std::string()); ss << std::fixed << std::setprecision(1); + ss << "T/e/t: "; + ss << fc_traces.read(SEC(1)) << "/"; + ss << fc_trace_ents.read(SEC(1)) << "/"; + ss << fc_trace_tiles.read(SEC(1)); + render->render_text(x, em, ss.str(), render::ALIGN_LEFT_TOP, sf::Color::White); + + x[1] -= em; + ss.str(std::string()); + ss << std::fixed << std::setprecision(1); + ss << "GE/e: "; + ss << fc_get_entities.read(SEC(1)) << "/"; + ss << fc_get_entities_ents.read(SEC(1)); + render->render_text(x, em, ss.str(), render::ALIGN_LEFT_TOP, sf::Color::White); + + x[1] -= em; + ss.str(std::string()); ss << "FPS: " << fc_render.read(SEC(1)) << ", " << fc_game.read(SEC(1)) << " Hz"; render->render_text(x, em, ss.str(), render::ALIGN_LEFT_TOP, sf::Color::White); diff --git a/src/main.cpp b/src/main.cpp index f0b6906..0a5977f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -65,8 +65,10 @@ float freq_counter_t::read(ntime_t ival) return last_reading; } -freq_counter_t fc_render = freq_counter_t(); -freq_counter_t fc_game = freq_counter_t(); +freq_counter_t fc_render; +freq_counter_t fc_game; +freq_counter_t fc_traces, fc_trace_tiles, fc_trace_ents; +freq_counter_t fc_get_entities, fc_get_entities_ents; #ifdef CONFIG_SHOW_RSS size_t sys_get_rss(void) diff --git a/src/world.cpp b/src/world.cpp index 6688e0b..cdb36a4 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -199,6 +199,8 @@ std::list<entity_t*> world_t::get_entities(rectf_t rect, cflags_t cflags) cookie++; + fc_get_entities.tick(); + for (sector_t *sector : get_sectors(rect, SECTOR_FULL)) for (entity_t *ent : sector->ents) { if (ent->cookie == cookie) @@ -206,6 +208,8 @@ std::list<entity_t*> world_t::get_entities(rectf_t rect, cflags_t cflags) ent->cookie = cookie; + fc_get_entities_ents.tick(); + if (ent->cmodel.ignore) continue; @@ -413,6 +417,8 @@ trace_t world_t::ray_v_ents(v2f_t start, v2f_t end, cflags_t cflags, for (entity_t *ent : get_entities(rect, cflags)) { trace_t trace; + fc_trace_ents.tick(); + if (ent == ignore) continue; @@ -489,6 +495,8 @@ trace_t world_t::ray_v_tiles(v2f_t start, v2f_t end, cflags_t cflags) offsets_index[quad]; tile = get_tile(index, SECTOR_FULL); + fc_trace_tiles.tick(); + if (tiles[tile->type] & cflags) { res.hit = true; res.end = x ^ transforms[quad]; @@ -523,6 +531,8 @@ trace_t world_t::ray_v_all(v2f_t start, v2f_t end, cflags_t cflags, { trace_t v_tiles, v_ents; + fc_traces.tick(); + v_tiles = ray_v_tiles(start, end, cflags); v_ents = ray_v_ents(start, end, cflags, ignore); |