Move profiler imports to internal version

pg_exts_fork
Tyler Goodlet 2022-10-31 09:26:36 -04:00
parent 1d4fc6f327
commit d46945cb09
6 changed files with 18 additions and 12 deletions

View File

@ -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,
)

View File

@ -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
)

View File

@ -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)))

View File

@ -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(),

View File

@ -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

View File

@ -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(),