Mercurial > code > home > repos > light9
changeset 1937:f29e26811206
pmfstats now update at 1hz. some ui improvements to stats lines.
Ignore-this: be2b416f56b6f6604a0af86f5cd69fef
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 02 Jun 2019 21:19:57 +0000 |
parents | aeb1e5a3079c |
children | 60c5acfe4f5a |
files | bin/captureDevice bin/collector bin/effecteval bin/effectsequencer bin/paintserver light9/ascoltami/player.py light9/ascoltami/webapp.py light9/collector/collector_client.py light9/collector/output.py light9/effect/sequencer.py light9/web/index.html light9/web/stats-line.js light9/web/style.css light9/zmqtransport.py requirements.txt stubs/greplin/scales/__init__.pyi |
diffstat | 16 files changed, 49 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/captureDevice Sun Jun 02 11:39:20 2019 +0000 +++ b/bin/captureDevice Sun Jun 02 21:19:57 2019 +0000 @@ -25,7 +25,8 @@ from rdfdb.patch import Patch from light9.zmqtransport import parseJsonMessage -stats = scales.collection('/webServer', scales.PmfStat('setAttr')) +stats = scales.collection('/webServer', scales.PmfStat('setAttr', + recalcPeriod=1)) class Camera(object):
--- a/bin/collector Sun Jun 02 11:39:20 2019 +0000 +++ b/bin/collector Sun Jun 02 21:19:57 2019 +0000 @@ -44,7 +44,7 @@ stats = scales.collection( '/webServer', - scales.PmfStat('setAttr'), + scales.PmfStat('setAttr', recalcPeriod=1), scales.RecentFpsStat('setAttrFps'), )
--- a/bin/effecteval Sun Jun 02 11:39:20 2019 +0000 +++ b/bin/effecteval Sun Jun 02 21:19:57 2019 +0000 @@ -113,8 +113,7 @@ 'label': self.graph.label(uri) }) out[-1]['effects'].sort(key=lambda e: e['uri']) - - + self.sendMessage({'songs': out}) @@ -226,10 +225,10 @@ self.stats = scales.collection( '/', - scales.PmfStat('sendLevels'), - scales.PmfStat('getMusic'), - scales.PmfStat('evals'), - scales.PmfStat('sendOutput'), + scales.PmfStat('sendLevels', recalcPeriod=1), + scales.PmfStat('getMusic', recalcPeriod=1), + scales.PmfStat('evals', recalcPeriod=1), + scales.PmfStat('sendOutput', recalcPeriod=1), scales.IntStat('errors'), )
--- a/bin/effectsequencer Sun Jun 02 11:39:20 2019 +0000 +++ b/bin/effectsequencer Sun Jun 02 21:19:57 2019 +0000 @@ -29,10 +29,10 @@ self.stats = scales.collection( '/', - scales.PmfStat('sendLevels'), - scales.PmfStat('getMusic'), - scales.PmfStat('evals'), - scales.PmfStat('sendOutput'), + scales.PmfStat('sendLevels', recalcPeriod=1), + scales.PmfStat('getMusic', recalcPeriod=1), + scales.PmfStat('evals', recalcPeriod=1), + scales.PmfStat('sendOutput', recalcPeriod=1), scales.IntStat('errors'), )
--- a/bin/paintserver Sun Jun 02 11:39:20 2019 +0000 +++ b/bin/paintserver Sun Jun 02 21:19:57 2019 +0000 @@ -71,7 +71,7 @@ self.stats = scales.collection( '/', - scales.PmfStat('solve'), + scales.PmfStat('solve', recalcPeriod=1), ) def launch(self, *args):
--- a/light9/ascoltami/player.py Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/ascoltami/player.py Sun Jun 02 21:19:57 2019 +0000 @@ -10,10 +10,12 @@ log = logging.getLogger() -stats = scales.collection('/player', - scales.RecentFpsStat('currentTimeFps'), +stats = scales.collection( + '/player', + scales.RecentFpsStat('currentTimeFps'), ) + class Player(object): def __init__(self, autoStopOffset=4, onEOS=None):
--- a/light9/ascoltami/webapp.py Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/ascoltami/webapp.py Sun Jun 02 21:19:57 2019 +0000 @@ -167,6 +167,8 @@ (r"/seekPlayOrPause", seekPlayOrPause), (r"/output", output), (r"/go", goButton), - (r'/stats/(.*)', StatsHandler, {'serverName': 'ascoltami'}), + (r'/stats/(.*)', StatsHandler, { + 'serverName': 'ascoltami' + }), ], app=app)
--- a/light9/collector/collector_client.py Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/collector/collector_client.py Sun Jun 02 21:19:57 2019 +0000 @@ -12,7 +12,7 @@ stats = scales.collection( '/collectorClient/', - scales.PmfStat('send'), + scales.PmfStat('send', recalcPeriod=1), )
--- a/light9/collector/output.py Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/collector/output.py Sun Jun 02 21:19:57 2019 +0000 @@ -45,7 +45,7 @@ _writeSucceed = scales.IntStat('write/succeed') _writeFail = scales.IntStat('write/fail') - _writeCall = scales.PmfStat('write/call') + _writeCall = scales.PmfStat('write/call', recalcPeriod=1) _writeFps = scales.RecentFpsStat('write/fps') def _write(self, buf: bytes) -> None: @@ -169,8 +169,8 @@ # out of date class EnttecDmx(BackgroundLoopOutput): - stats = scales.collection('/output/enttecDmx', scales.PmfStat('write'), - scales.PmfStat('update')) + stats = scales.collection('/output/enttecDmx', scales.PmfStat('write', recalcPeriod=1), + scales.PmfStat('update', recalcPeriod=1)) def __init__(self, uri, devicePath='/dev/dmx0', numChannels=80): sys.path.append("dmx_usb_module")
--- a/light9/effect/sequencer.py Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/effect/sequencer.py Sun Jun 02 21:19:57 2019 +0000 @@ -25,23 +25,23 @@ import imp log = logging.getLogger('sequencer') -stats = scales.collection('/sequencer/',) + updateStats = scales.collection( '/update/', - scales.PmfStat('s0_getMusic'), - scales.PmfStat('s1_eval'), - scales.PmfStat('s2_sendToWeb'), - scales.PmfStat('s3_send'), - scales.PmfStat('sendPhase'), - scales.PmfStat('updateLoopLatency'), + scales.PmfStat('s0_getMusic', recalcPeriod=1), + scales.PmfStat('s1_eval', recalcPeriod=1), + scales.PmfStat('s2_sendToWeb', recalcPeriod=1), + scales.PmfStat('s3_send', recalcPeriod=1), + scales.PmfStat('sendPhase', recalcPeriod=1), + scales.PmfStat('updateLoopLatency', recalcPeriod=1), scales.DoubleStat('updateLoopLatencyGoal'), scales.RecentFpsStat('updateFps'), scales.DoubleStat('goalFps'), ) compileStats = scales.collection( '/compile/', - scales.PmfStat('graph'), - scales.PmfStat('song'), + scales.PmfStat('graph', recalcPeriod=1), + scales.PmfStat('song', recalcPeriod=1), ) @@ -156,11 +156,10 @@ class Sequencer(object): - def __init__( - self, - graph: SyncedGraph, - sendToCollector: Callable[[DeviceSettings], defer.Deferred], - fps=40): + def __init__(self, + graph: SyncedGraph, + sendToCollector: Callable[[DeviceSettings], defer.Deferred], + fps=40): self.graph = graph self.fps = fps updateStats.goalFps = self.fps
--- a/light9/web/index.html Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/web/index.html Sun Jun 02 21:19:57 2019 +0000 @@ -24,9 +24,6 @@ justify-content: space-between; padding: 2px 3px; } - div:hover { - background: gray; - } .left { display: inline-block; margin-right: 3px;
--- a/light9/web/stats-line.js Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/web/stats-line.js Sun Jun 02 21:19:57 2019 +0000 @@ -37,6 +37,7 @@ return css` :host { border: 2px solid #46a79f; + display: inline-block; } table { border-collapse: collapse; @@ -107,17 +108,16 @@ const bar = (y) => { let color; - if (y < hi * .85) { + if (y < d.average) { color="#6a6aff"; } else { color="#d09e4c"; } return html`<div class="bar" style="height: ${y * scl}px; background: ${color};"></div>`; }; - return tdWrap(table({ - average: rounding(d.average, 3), - recents: html`<div class="recents">${d.recents.map(bar)}</div>` - }, path)); + return html`<td> + <div class="recents">${d.recents.map(bar)}</div> + <div>avg=${rounding(d.average ,3)}</div>`; }; const pmf = (d, path) => {
--- a/light9/web/style.css Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/web/style.css Sun Jun 02 21:19:57 2019 +0000 @@ -197,3 +197,7 @@ border: 1px solid #4a4a4a; padding: 2px 8px; } +hr { + width: 100%; + border-color: #1d3e1d; +}
--- a/light9/zmqtransport.py Sun Jun 02 11:39:20 2019 +0000 +++ b/light9/zmqtransport.py Sun Jun 02 21:19:57 2019 +0000 @@ -22,7 +22,7 @@ def startZmq(port, collector): stats = scales.collection( '/zmqServer', - scales.PmfStat('setAttr'), + scales.PmfStat('setAttr', recalcPeriod=1), scales.RecentFpsStat('setAttrFps'), )
--- a/requirements.txt Sun Jun 02 11:39:20 2019 +0000 +++ b/requirements.txt Sun Jun 02 21:19:57 2019 +0000 @@ -36,7 +36,7 @@ mypy==0.701 typing_extensions -git+http://github.com/drewp/scales.git@3f2609c#egg=scales +git+http://github.com/drewp/scales.git@4b011434f7469a442c3fc1d7e81685c0bfa56eeb#egg=scales git+http://github.com/11craft/louie.git@f18bb71010c114eca9c6b88c96453340e3b39454#egg=louie git+http://github.com/webpy/webpy@ace0f8954c28311004b33c7a513c6e40a3c02470#egg=web https://github.com/drewp/cyclone/archive/python3.zip#egg=cyclone
--- a/stubs/greplin/scales/__init__.pyi Sun Jun 02 11:39:20 2019 +0000 +++ b/stubs/greplin/scales/__init__.pyi Sun Jun 02 21:19:57 2019 +0000 @@ -116,7 +116,7 @@ def time(self): ... class PmfStat(Stat): - def __init__(self, name: Any, _: Optional[Any] = ...) -> None: ... + def __init__(self, name: Any, _: Optional[Any] = ..., recalcPeriod: Optional[float]=20) -> None: ... def __set__(self, instance: Any, value: Any) -> None: ... class NamedPmfDict(UserDict):