More thoroughly profile the display loop
parent
65434e2e67
commit
4866bdc460
|
@ -202,6 +202,14 @@ async def increment_history_view(
|
|||
async with open_sample_stream(1.) as istream:
|
||||
async for msg in istream:
|
||||
|
||||
profiler = Profiler(
|
||||
msg=f'History chart cycle for: `{ds.fqsn}`',
|
||||
delayed=True,
|
||||
disabled=not pg_profile_enabled(),
|
||||
ms_threshold=ms_slower_then,
|
||||
# ms_threshold=4,
|
||||
)
|
||||
|
||||
# l3 = ds.viz.shm.array[-3:]
|
||||
# print(
|
||||
# f'fast step for {ds.flume.symbol.fqsn}:\n'
|
||||
|
@ -229,7 +237,10 @@ async def increment_history_view(
|
|||
# ensure path graphics append is shown on treads since
|
||||
# the main rt loop does not call this.
|
||||
hist_viz.update_graphics()
|
||||
profiler('`hist Viz.update_graphics()` call')
|
||||
|
||||
hist_chart.increment_view(datums=append_diff)
|
||||
profiler('hist tread view')
|
||||
|
||||
if (
|
||||
do_px_step
|
||||
|
@ -466,6 +477,7 @@ def graphics_update_cycle(
|
|||
delayed=True,
|
||||
disabled=not pg_profile_enabled(),
|
||||
ms_threshold=ms_slower_then,
|
||||
# ms_threshold=4,
|
||||
)
|
||||
|
||||
# TODO: SPEEDing this all up..
|
||||
|
@ -475,24 +487,21 @@ def graphics_update_cycle(
|
|||
# - use a streaming minmax algo and drop the use of the
|
||||
# state-tracking ``chart_maxmin()`` routine from above?
|
||||
|
||||
fqsn = ds.fqsn
|
||||
chart = ds.chart
|
||||
hist_chart = ds.hist_chart
|
||||
flume = ds.flume
|
||||
sym = flume.symbol
|
||||
fqsn = sym.fqsn
|
||||
main_viz = ds.viz
|
||||
hist_viz = ds.hist_viz
|
||||
index_field = main_viz.index_field
|
||||
|
||||
# unpack multi-referenced components
|
||||
vlm_chart = ds.vlm_chart
|
||||
|
||||
# rt "HFT" chart
|
||||
varz = ds.vars
|
||||
l1 = ds.l1
|
||||
flume = ds.flume
|
||||
ohlcv = flume.rt_shm
|
||||
array = ohlcv.array
|
||||
|
||||
varz = ds.vars
|
||||
hist_viz = ds.hist_viz
|
||||
main_viz = ds.viz
|
||||
index_field = main_viz.index_field
|
||||
|
||||
tick_margin = varz['tick_margin']
|
||||
|
||||
(
|
||||
|
@ -505,6 +514,8 @@ def graphics_update_cycle(
|
|||
should_tread,
|
||||
) = main_viz.incr_info(ds=ds)
|
||||
|
||||
profiler('`.incr_info()`')
|
||||
|
||||
# TODO: we should only run mxmn when we know
|
||||
# an update is due via ``do_px_step`` above.
|
||||
(
|
||||
|
@ -529,6 +540,7 @@ def graphics_update_cycle(
|
|||
or trigger_all
|
||||
):
|
||||
main_viz.update_graphics(array_key=fqsn)
|
||||
profiler('`Viz.update_graphics()` call')
|
||||
|
||||
# don't real-time "shift" the curve to the
|
||||
# left unless we get one of the following:
|
||||
|
@ -627,6 +639,8 @@ def graphics_update_cycle(
|
|||
):
|
||||
l1.bid_label.update_fields({'level': price, 'size': size})
|
||||
|
||||
profiler('L1 labels updates')
|
||||
|
||||
# Y-autoranging: adjust y-axis limits based on state tracking
|
||||
# of previous "last" L1 values which are in view.
|
||||
lmx = varz['last_mx']
|
||||
|
@ -681,6 +695,7 @@ def graphics_update_cycle(
|
|||
# range_margin=0.1,
|
||||
yrange=yr
|
||||
)
|
||||
profiler('main vb y-autorange')
|
||||
|
||||
# SLOW CHART resize case
|
||||
(
|
||||
|
@ -695,6 +710,7 @@ def graphics_update_cycle(
|
|||
ds=ds,
|
||||
is_1m=True,
|
||||
)
|
||||
profiler('hist `Viz.incr_info()`')
|
||||
if (
|
||||
hist_liv
|
||||
and not hist_chart._static_yrange == 'axis'
|
||||
|
@ -703,6 +719,7 @@ def graphics_update_cycle(
|
|||
viz=hist_viz,
|
||||
# yrange=yr, # this is the rt range, not hist.. XD
|
||||
)
|
||||
profiler('hist vb y-autorange')
|
||||
|
||||
# XXX: update this every draw cycle to ensure y-axis auto-ranging
|
||||
# only adjusts when the in-view data co-domain actually expands or
|
||||
|
@ -746,6 +763,8 @@ def graphics_update_cycle(
|
|||
only_last_uppx=True,
|
||||
)
|
||||
|
||||
profiler('overlays updates')
|
||||
|
||||
# volume chart logic..
|
||||
# TODO: can we unify this with the above loop?
|
||||
if vlm_chart:
|
||||
|
@ -808,13 +827,15 @@ def graphics_update_cycle(
|
|||
liv and do_rt_update
|
||||
or do_px_step
|
||||
)
|
||||
and curve_name not in {fqsn,}
|
||||
and curve_name not in {fqsn}
|
||||
):
|
||||
update_fsp_chart(
|
||||
viz,
|
||||
curve_name,
|
||||
array_key=curve_name,
|
||||
)
|
||||
profiler(f'vlm `Viz[{viz.name}].update_graphics()`')
|
||||
|
||||
# is this even doing anything?
|
||||
# (pretty sure it's the real-time
|
||||
# resizing from last quote?)
|
||||
|
@ -825,6 +846,7 @@ def graphics_update_cycle(
|
|||
fvb._set_yrange(
|
||||
viz=viz,
|
||||
)
|
||||
profiler(f'vlm `Viz[{viz.name}].plot.vb._set_yrange()`')
|
||||
|
||||
# even if we're downsampled bigly
|
||||
# draw the last datum in the final
|
||||
|
@ -838,6 +860,9 @@ def graphics_update_cycle(
|
|||
# always update the last datum-element
|
||||
# graphic for all vizs
|
||||
viz.draw_last(array_key=curve_name)
|
||||
profiler(f'vlm `Viz[{viz.name}].draw_last()`')
|
||||
|
||||
profiler('vlm Viz all updates complete')
|
||||
|
||||
profiler.finish()
|
||||
|
||||
|
|
Loading…
Reference in New Issue