diff --git a/piker/data/marketstore.py b/piker/data/marketstore.py index 3edc1718..09bfd680 100644 --- a/piker/data/marketstore.py +++ b/piker/data/marketstore.py @@ -56,6 +56,7 @@ if TYPE_CHECKING: from .feed import maybe_open_feed from ..log import get_logger, get_console_log +from .._profile import Profiler log = get_logger(__name__) @@ -645,7 +646,7 @@ async def tsdb_history_update( # * the original data feed arch blurb: # - https://github.com/pikers/piker/issues/98 # - profiler = pg.debug.Profiler( + profiler = Profiler( disabled=False, # not pg_profile_enabled(), delayed=False, ) diff --git a/piker/fsp/_engine.py b/piker/fsp/_engine.py index 5ba3d376..084ff510 100644 --- a/piker/fsp/_engine.py +++ b/piker/fsp/_engine.py @@ -44,6 +44,7 @@ from ._api import ( _load_builtins, _Token, ) +from .._profile import Profiler log = get_logger(__name__) @@ -91,7 +92,7 @@ async def fsp_compute( ) -> None: - profiler = pg.debug.Profiler( + profiler = Profiler( delayed=False, disabled=True ) @@ -262,7 +263,7 @@ async def cascade( destination shm array buffer. ''' - profiler = pg.debug.Profiler( + profiler = Profiler( delayed=False, disabled=False ) diff --git a/piker/ui/_curve.py b/piker/ui/_curve.py index ac5d12ca..548eaac5 100644 --- a/piker/ui/_curve.py +++ b/piker/ui/_curve.py @@ -44,6 +44,7 @@ from ._style import hcolor # ds_m4, # ) from ..log import get_logger +from .._profile import Profiler log = get_logger(__name__) @@ -331,7 +332,7 @@ class Curve(pg.GraphicsObject): ) -> None: - profiler = pg.debug.Profiler( + profiler = Profiler( msg=f'Curve.paint(): `{self._name}`', disabled=not pg_profile_enabled(), ms_threshold=ms_slower_then, @@ -466,7 +467,7 @@ class StepCurve(Curve): def sub_paint( self, p: QPainter, - profiler: pg.debug.Profiler, + profiler: Profiler, ) -> None: # p.drawLines(*tuple(filter(bool, self._last_step_lines))) diff --git a/piker/ui/_display.py b/piker/ui/_display.py index b20b99c0..0a98b4a8 100644 --- a/piker/ui/_display.py +++ b/piker/ui/_display.py @@ -66,6 +66,7 @@ from .._profile import ( ms_slower_then, ) from ..log import get_logger +from .._profile import Profiler log = get_logger(__name__) @@ -441,7 +442,7 @@ def graphics_update_cycle( # TODO: just pass this as a direct ref to avoid so many attr accesses? hist_chart = ds.godwidget.hist_linked.chart - profiler = pg.debug.Profiler( + profiler = Profiler( msg=f'Graphics loop cycle for: `{chart.name}`', delayed=True, disabled=not pg_profile_enabled(), diff --git a/piker/ui/_flows.py b/piker/ui/_flows.py index 48bd89d0..175afe4f 100644 --- a/piker/ui/_flows.py +++ b/piker/ui/_flows.py @@ -59,6 +59,7 @@ from ._curve import ( FlattenedOHLC, ) from ..log import get_logger +from .._profile import Profiler log = get_logger(__name__) @@ -130,7 +131,7 @@ def render_baritems( int, int, np.ndarray, int, int, np.ndarray, ], - profiler: pg.debug.Profiler, + profiler: Profiler, **kwargs, ) -> None: @@ -517,7 +518,7 @@ class Flow(msgspec.Struct): # , frozen=True): render: bool = True, array_key: Optional[str] = None, - profiler: Optional[pg.debug.Profiler] = None, + profiler: Optional[Profiler] = None, do_append: bool = True, **kwargs, @@ -528,7 +529,7 @@ class Flow(msgspec.Struct): # , frozen=True): render to graphics. ''' - profiler = pg.debug.Profiler( + profiler = Profiler( msg=f'Flow.update_graphics() for {self.name}', disabled=not pg_profile_enabled(), ms_threshold=4, @@ -948,7 +949,7 @@ class Renderer(msgspec.Struct): new_read, array_key: str, - profiler: pg.debug.Profiler, + profiler: Profiler, uppx: float = 1, # redraw and ds flags diff --git a/piker/ui/_interaction.py b/piker/ui/_interaction.py index b9ac32ea..d6899b60 100644 --- a/piker/ui/_interaction.py +++ b/piker/ui/_interaction.py @@ -33,6 +33,7 @@ import numpy as np import trio from ..log import get_logger +from .._profile import Profiler from .._profile import pg_profile_enabled, ms_slower_then # from ._style import _min_points_to_show from ._editors import SelectRect @@ -779,7 +780,7 @@ class ChartView(ViewBox): ''' name = self.name # print(f'YRANGE ON {name}') - profiler = pg.debug.Profiler( + profiler = Profiler( msg=f'`ChartView._set_yrange()`: `{name}`', disabled=not pg_profile_enabled(), ms_threshold=ms_slower_then, @@ -916,7 +917,7 @@ class ChartView(ViewBox): autoscale_overlays: bool = True, ): - profiler = pg.debug.Profiler( + profiler = Profiler( msg=f'ChartView.maybe_downsample_graphics() for {self.name}', disabled=not pg_profile_enabled(),