OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::perf Namespace Reference

Classes

struct  GatedTimer
 
struct  ScopedTimer
 

Functions

void reset_fv () noexcept
 Zeroes the FV phase accumulators. Called from Router::initFv.
 
void dump_fv () noexcept
 One machine-scrapeable line for the FV phase split.
 
std::chrono::steady_clock::time_point now () noexcept
 Manual timing pair, for phases that do not fit a lexical scope.
 
double since (std::chrono::steady_clock::time_point t0) noexcept
 
bool enabled () noexcept
 True when OPENSWMM_PERF is set. Cached — getenv is not free.
 
void reset_load () noexcept
 Zeroes the load-phase accumulators. Called from open().
 
void dump_load () noexcept
 One machine-scrapeable line per phase on stderr.
 
void count (long &c, long n=1) noexcept
 

Variables

double sec_2d_window = 0.0
 
double sec_2d_advance = 0.0
 
double sec_1d_step = 0.0
 
double sec_open_prescan2d = 0.0
 
double sec_open_read = 0.0
 
double sec_read_dispatch = 0.0
 
double sec_open_resolve = 0.0
 
double sec_open_validate = 0.0
 
double sec_res_extfiles = 0.0
 
double sec_res_tables = 0.0
 
double sec_res_transects = 0.0
 
double sec_res_xsect = 0.0
 
double sec_res_shrink = 0.0
 
double sec_init_state = 0.0
 
double sec_init_hydraulics = 0.0
 
double sec_init_hydrology = 0.0
 
double sec_init_quality = 0.0
 
double sec_init_geometry = 0.0
 
double sec_start_iface = 0.0
 
double sec_start_plugins = 0.0
 
double sec_fv_census = 0.0
 
double sec_fv_flux = 0.0
 
double sec_fv_nodesolve = 0.0
 
double sec_fv_positivity = 0.0
 
double sec_fv_cellupdate = 0.0
 
double sec_fv_nodeupdate = 0.0
 
double sec_fv_refreshdep = 0.0
 
double sec_fv_savestate = 0.0
 
double sec_fv_restore = 0.0
 
double sec_fv_structref = 0.0
 
double sec_fv_bndcallback = 0.0
 
double sec_fv_rebuild = 0.0
 
double sec_fv_reconstruct = 0.0
 
double sec_fv_ltsfire = 0.0
 
double sec_fv_settle = 0.0
 
double sec_fv_tier = 0.0
 
long n_fv_substep = 0
 
long n_fv_census = 0
 
long n_fv_census_face = 0
 
long n_fv_invert = 0
 
long n_fv_savestate = 0
 
long n_fv_restore = 0
 
long n_fv_structref = 0
 
long n_fv_alg_visit = 0
 
long n_fv_alg_passthru = 0
 
long n_fv_alg_solve = 0
 
long n_fv_alg_resid = 0
 
long n_fv_alg_flux = 0
 
thread_local double nested_wall = 0.0
 ScopedTimer that reads the clock only when OPENSWMM_PERF is set.
 

Function Documentation

◆ count()

void openswmm::perf::count ( long & c,
long n = 1 )
inlinenoexcept

Adds n to a counter only when profiling is on, so the counters cost the same predicted branch as the timers and never appear in a release profile.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_fv()

void openswmm::perf::dump_fv ( )
inlinenoexcept

One machine-scrapeable line for the FV phase split.

Same [PERF-FV] key=value contract as dump_load(); emitted from close() when OPENSWMM_PERF is set and the FV solver actually ran. Each phase is SELF time: a phase that calls another timed phase is charged only for its own work (see nested_wall), so the phases partition the time rather than overlapping it. total is their sum, NOT the router step — the difference between the two is unattributed time and is itself the useful signal when a phase is missing. It cannot be negative; if it ever is, a timer is nested inside a scope that does not go through GatedTimer.

◆ dump_load()

void openswmm::perf::dump_load ( )
inlinenoexcept

One machine-scrapeable line per phase on stderr.

Emitted from close() so all three benchmark cuts (open only, open+initialize, full) report. Format is [PERF-LOAD] key=value pairs in seconds; tests/benchmarks/scripts/ parses it.

◆ enabled()

bool openswmm::perf::enabled ( )
inlinenoexcept

True when OPENSWMM_PERF is set. Cached — getenv is not free.

Here is the caller graph for this function:

◆ now()

std::chrono::steady_clock::time_point openswmm::perf::now ( )
inlinenoexcept

Manual timing pair, for phases that do not fit a lexical scope.

Here is the caller graph for this function:

◆ reset_fv()

void openswmm::perf::reset_fv ( )
inlinenoexcept

Zeroes the FV phase accumulators. Called from Router::initFv.

◆ reset_load()

void openswmm::perf::reset_load ( )
inlinenoexcept

Zeroes the load-phase accumulators. Called from open().

◆ since()

double openswmm::perf::since ( std::chrono::steady_clock::time_point t0)
inlinenoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ n_fv_alg_flux

long openswmm::perf::n_fv_alg_flux = 0
inline

◆ n_fv_alg_passthru

long openswmm::perf::n_fv_alg_passthru = 0
inline

◆ n_fv_alg_resid

long openswmm::perf::n_fv_alg_resid = 0
inline

◆ n_fv_alg_solve

long openswmm::perf::n_fv_alg_solve = 0
inline

◆ n_fv_alg_visit

long openswmm::perf::n_fv_alg_visit = 0
inline

◆ n_fv_census

long openswmm::perf::n_fv_census = 0
inline

◆ n_fv_census_face

long openswmm::perf::n_fv_census_face = 0
inline

◆ n_fv_invert

long openswmm::perf::n_fv_invert = 0
inline

◆ n_fv_restore

long openswmm::perf::n_fv_restore = 0
inline

◆ n_fv_savestate

long openswmm::perf::n_fv_savestate = 0
inline

◆ n_fv_structref

long openswmm::perf::n_fv_structref = 0
inline

◆ n_fv_substep

long openswmm::perf::n_fv_substep = 0
inline

◆ nested_wall

thread_local double openswmm::perf::nested_wall = 0.0
inline

ScopedTimer that reads the clock only when OPENSWMM_PERF is set.

ScopedTimer is used at per-routing-step and per-load-phase call sites, where two unconditional clock reads are free. The FV phase timers are not in that regime: a 30 h / 5 s run is ~21,600 routing steps, each of which can carry hundreds of substeps, each carrying a dozen phases. At ~20 ns a read that is seconds of pure instrument on a run that has nothing to do with profiling. enabled() is a cached static bool, so the gated form costs a predicted branch instead. Wall time booked by GatedTimers that opened and closed inside the one currently running on this thread. Read and reset by each timer so that what lands in the accumulator is SELF time.

Without this the phase split double-counts wherever one timed phase calls another, which it does in three places today: restoreState and settleAccumulators both call refreshDepths, and runMacroCycle's boundary callback sits inside the settle window. The visible symptom was total exceeding the routing step it is a breakdown of — the LTS rows of the phase table reported between -7.9 % and -18.1 % "unattributed" time, which is not a quantity that can be negative. A breakdown whose parts can exceed the whole cannot rank optimization targets, which is the only reason these timers exist.

Thread-local because the accumulators are serial-path today but the flux sweep is slated to go parallel; a shared counter would then attribute one thread's children to another thread's parent. Nothing here is atomic and nothing needs to be: a timer only ever touches its own thread's tally.

◆ sec_1d_step

double openswmm::perf::sec_1d_step = 0.0
inline

◆ sec_2d_advance

double openswmm::perf::sec_2d_advance = 0.0
inline

◆ sec_2d_window

double openswmm::perf::sec_2d_window = 0.0
inline

◆ sec_fv_bndcallback

double openswmm::perf::sec_fv_bndcallback = 0.0
inline

◆ sec_fv_cellupdate

double openswmm::perf::sec_fv_cellupdate = 0.0
inline

◆ sec_fv_census

double openswmm::perf::sec_fv_census = 0.0
inline

◆ sec_fv_flux

double openswmm::perf::sec_fv_flux = 0.0
inline

◆ sec_fv_ltsfire

double openswmm::perf::sec_fv_ltsfire = 0.0
inline

◆ sec_fv_nodesolve

double openswmm::perf::sec_fv_nodesolve = 0.0
inline

◆ sec_fv_nodeupdate

double openswmm::perf::sec_fv_nodeupdate = 0.0
inline

◆ sec_fv_positivity

double openswmm::perf::sec_fv_positivity = 0.0
inline

◆ sec_fv_rebuild

double openswmm::perf::sec_fv_rebuild = 0.0
inline

◆ sec_fv_reconstruct

double openswmm::perf::sec_fv_reconstruct = 0.0
inline

◆ sec_fv_refreshdep

double openswmm::perf::sec_fv_refreshdep = 0.0
inline

◆ sec_fv_restore

double openswmm::perf::sec_fv_restore = 0.0
inline

◆ sec_fv_savestate

double openswmm::perf::sec_fv_savestate = 0.0
inline

◆ sec_fv_settle

double openswmm::perf::sec_fv_settle = 0.0
inline

◆ sec_fv_structref

double openswmm::perf::sec_fv_structref = 0.0
inline

◆ sec_fv_tier

double openswmm::perf::sec_fv_tier = 0.0
inline

◆ sec_init_geometry

double openswmm::perf::sec_init_geometry = 0.0
inline

◆ sec_init_hydraulics

double openswmm::perf::sec_init_hydraulics = 0.0
inline

◆ sec_init_hydrology

double openswmm::perf::sec_init_hydrology = 0.0
inline

◆ sec_init_quality

double openswmm::perf::sec_init_quality = 0.0
inline

◆ sec_init_state

double openswmm::perf::sec_init_state = 0.0
inline

◆ sec_open_prescan2d

double openswmm::perf::sec_open_prescan2d = 0.0
inline

◆ sec_open_read

double openswmm::perf::sec_open_read = 0.0
inline

◆ sec_open_resolve

double openswmm::perf::sec_open_resolve = 0.0
inline

◆ sec_open_validate

double openswmm::perf::sec_open_validate = 0.0
inline

◆ sec_read_dispatch

double openswmm::perf::sec_read_dispatch = 0.0
inline

◆ sec_res_extfiles

double openswmm::perf::sec_res_extfiles = 0.0
inline

◆ sec_res_shrink

double openswmm::perf::sec_res_shrink = 0.0
inline

◆ sec_res_tables

double openswmm::perf::sec_res_tables = 0.0
inline

◆ sec_res_transects

double openswmm::perf::sec_res_transects = 0.0
inline

◆ sec_res_xsect

double openswmm::perf::sec_res_xsect = 0.0
inline

◆ sec_start_iface

double openswmm::perf::sec_start_iface = 0.0
inline

◆ sec_start_plugins

double openswmm::perf::sec_start_plugins = 0.0
inline