diff options
author | orwell96 <orwell@bleipb.de> | 2019-12-05 10:14:07 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2019-12-05 10:15:36 +0100 |
commit | eeef07d05a7e53de469f19a23fe1e69f569fc924 (patch) | |
tree | 6330ae717f337ec1a039004349d9c4c045ab632c /advtrains/lzb.lua | |
parent | 9c1d3565058799f21b6985c100ccf1abe045d3da (diff) | |
download | advtrains-eeef07d05a7e53de469f19a23fe1e69f569fc924.tar.gz advtrains-eeef07d05a7e53de469f19a23fe1e69f569fc924.tar.bz2 advtrains-eeef07d05a7e53de469f19a23fe1e69f569fc924.zip |
Add profiling instructions for advprofiler
Diffstat (limited to 'advtrains/lzb.lua')
-rw-r--r-- | advtrains/lzb.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/advtrains/lzb.lua b/advtrains/lzb.lua index 6cbf4ab..660efa8 100644 --- a/advtrains/lzb.lua +++ b/advtrains/lzb.lua @@ -47,6 +47,7 @@ end local function look_ahead(id, train) + advtrains.profiler:enter("lzb_look_ahead") local acc = advtrains.get_acceleration(train, 1) local vel = train.velocity @@ -80,6 +81,8 @@ local function look_ahead(id, train) lzb.trav = trav + advtrains.profiler:leave("lzb_look_ahead") + end --[[ @@ -91,6 +94,8 @@ s = v0 * ------- + - * | ------- | = ----------- ]] local function apply_control(id, train) + advtrains.profiler:enter("lzb_apply_control") + local lzb = train.lzb local i = 1 @@ -129,6 +134,7 @@ local function apply_control(id, train) -- Gotcha! Braking... train.ctrl.lzb = 1 --train.debug = train.debug .. "BRAKE!!!" + advtrains.profiler:leave("lzb_apply_control") return end @@ -136,17 +142,20 @@ local function apply_control(id, train) if i <= train.index and v0>1 then -- roll control train.ctrl.lzb = 2 + advtrains.profiler:leave("lzb_apply_control") return end i = advtrains.path_get_index_by_offset(train, i, -params.ZONE_HOLD) if i <= train.index and v0>1 then -- hold speed train.ctrl.lzb = 3 + advtrains.profiler:leave("lzb_apply_control") return end end end train.ctrl.lzb = nil + advtrains.profiler:leave("lzb_apply_control") end local function invalidate(train) |