16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 03:09:18 +02:00
Files
maszyna/scene/eu7/eu7_load_stats.h
maj00r beacc00932 Add headless parallel eu7v2 scenario bake with streaming and PLCE placements
Enable --eu7v2-bake from the main binary: parallel module pool, bounded-RAM
spool flush, streaming terrain triangles, flat include/model parsing, and
eu7v2 emit/load with optional verify. Large placement .scm files emit lean
PLCE records and bake referenced .inc modules separately for reuse.

- CLI: --eu7v2-bake, --eu7v2-verify, --eu7v2-mem-limit-gb, --eu7v2-threads,
  --eu7v2-max-parse; wire max_threads through to the bake parser
- eu7v2 v2 records: PLCE placements, runtime emitter/loader, batch verify
- Parallel bake pool with session cache; drop heavy-serial parse gate in spool
  mode; parse concurrency matches thread count
- Streaming terrain: batched parallel parse+bake, scan/bake pipeline, shape
  spool with persistent buffered I/O and flush-before-read
- Parallel flat-file streaming for models/includes; pack/model spool for
  low-memory incremental flush
- Optional 50 GB private-bytes guard during headless bake

Braniewo_szeroki: 160 modules, verify PASS, ~34s bake (nmt100 ~17s vs ~190s
serial baseline).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 21:15:42 +02:00

88 lines
2.2 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <chrono>
#include <cstdint>
namespace scene::eu7 {
struct Eu7LoadStats {
double read_ms { 0.0 };
double scm_fallback_ms { 0.0 };
double place_fast_ms { 0.0 };
double place_full_ms { 0.0 };
double terr_ms { 0.0 };
double mesh_ms { 0.0 };
double line_ms { 0.0 };
double trak_ms { 0.0 };
double trac_ms { 0.0 };
double power_ms { 0.0 };
double model_ms { 0.0 };
double memcell_ms { 0.0 };
double launcher_ms { 0.0 };
double dynamic_ms { 0.0 };
double sound_ms { 0.0 };
double event_ms { 0.0 };
double trainset_ms { 0.0 };
double first_init_ms { 0.0 };
std::uint64_t module_visits { 0 };
std::uint64_t module_applied { 0 };
std::uint64_t module_deduped { 0 };
std::uint64_t module_read { 0 };
std::uint64_t module_cache_hit { 0 };
std::uint64_t model_fast_path { 0 };
std::uint64_t module_full_path { 0 };
std::uint64_t scm_fallback { 0 };
std::uint64_t models { 0 };
std::uint64_t tracks { 0 };
std::uint64_t traction { 0 };
std::uint64_t power_sources { 0 };
std::uint64_t memcells { 0 };
std::uint64_t launchers { 0 };
std::uint64_t dynamics { 0 };
std::uint64_t sounds { 0 };
std::uint64_t events { 0 };
std::uint64_t trainsets { 0 };
std::uint64_t module_v2_loaded { 0 };
std::uint64_t module_v2_baked { 0 };
std::uint64_t pack_skipped_includes { 0 };
std::uint64_t pack_sections_loaded { 0 };
std::uint64_t pack_models { 0 };
std::uint64_t pack_skipped_models { 0 };
[[nodiscard]] double total_ms() const;
};
class ScopedTimer {
public:
explicit ScopedTimer( double &Target );
~ScopedTimer();
ScopedTimer( ScopedTimer const & ) = delete;
ScopedTimer &operator=( ScopedTimer const & ) = delete;
private:
double &m_target;
std::chrono::steady_clock::time_point m_start;
};
[[nodiscard]] Eu7LoadStats &
load_stats();
void
reset_load_stats();
void
log_load_stats();
} // namespace scene::eu7