Changeset - f29e26811206
[Not reviewed]
default
0 16 0
Drew Perttula - 6 years ago 2019-06-02 21:19:57
drewp@bigasterisk.com
pmfstats now update at 1hz. some ui improvements to stats lines.
Ignore-this: be2b416f56b6f6604a0af86f5cd69fef
16 files changed with 49 insertions and 45 deletions:
0 comments (0 inline, 0 general)
bin/captureDevice
Show inline comments
 
@@ -25,7 +25,8 @@ from light9.collector.collector_client i
 
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):
bin/collector
Show inline comments
 
@@ -44,7 +44,7 @@ class Updates(cyclone.websocket.WebSocke
 

	
 
stats = scales.collection(
 
    '/webServer',
 
    scales.PmfStat('setAttr'),
 
    scales.PmfStat('setAttr', recalcPeriod=1),
 
    scales.RecentFpsStat('setAttrFps'),
 
)
 

	
bin/effecteval
Show inline comments
 
@@ -113,8 +113,7 @@ class SongEffectsUpdates(cyclone.websock
 
                        'label': self.graph.label(uri)
 
                    })
 
            out[-1]['effects'].sort(key=lambda e: e['uri'])
 
                    
 
                    
 

	
 
        self.sendMessage({'songs': out})
 

	
 

	
 
@@ -226,10 +225,10 @@ class App(object):
 

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

	
bin/effectsequencer
Show inline comments
 
@@ -29,10 +29,10 @@ class App(object):
 

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

	
bin/paintserver
Show inline comments
 
@@ -71,7 +71,7 @@ class App(object):
 

	
 
        self.stats = scales.collection(
 
            '/',
 
            scales.PmfStat('solve'),
 
            scales.PmfStat('solve', recalcPeriod=1),
 
        )
 

	
 
    def launch(self, *args):
light9/ascoltami/player.py
Show inline comments
 
@@ -10,10 +10,12 @@ from greplin import scales
 

	
 
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):
light9/ascoltami/webapp.py
Show inline comments
 
@@ -167,6 +167,8 @@ def makeWebApp(app):
 
        (r"/seekPlayOrPause", seekPlayOrPause),
 
        (r"/output", output),
 
        (r"/go", goButton),
 
        (r'/stats/(.*)', StatsHandler, {'serverName': 'ascoltami'}),
 
        (r'/stats/(.*)', StatsHandler, {
 
            'serverName': 'ascoltami'
 
        }),
 
    ],
 
                                   app=app)
light9/collector/collector_client.py
Show inline comments
 
@@ -12,7 +12,7 @@ log = logging.getLogger('coll_client')
 

	
 
stats = scales.collection(
 
    '/collectorClient/',
 
    scales.PmfStat('send'),
 
    scales.PmfStat('send', recalcPeriod=1),
 
)
 

	
 

	
light9/collector/output.py
Show inline comments
 
@@ -45,7 +45,7 @@ class Output(object):
 

	
 
    _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 @@ class UdmxOld(BackgroundLoopOutput):
 
                                
 
# 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")
light9/effect/sequencer.py
Show inline comments
 
@@ -25,23 +25,23 @@ from greplin import scales
 
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 CodeWatcher(object):
 

	
 
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
light9/web/index.html
Show inline comments
 
@@ -24,9 +24,6 @@
 
             justify-content: space-between;
 
             padding: 2px 3px;
 
         }
 
         div:hover {
 
             background: gray;
 
         }
 
         .left {
 
             display: inline-block;
 
             margin-right: 3px;
light9/web/stats-line.js
Show inline comments
 
@@ -37,6 +37,7 @@ class StatsLine extends LitElement {
 
        return css`
 
        :host {
 
            border: 2px solid #46a79f;
 
            display: inline-block;
 
        }
 
        table { 
 
            border-collapse: collapse;
 
@@ -107,17 +108,16 @@ class StatsLine extends LitElement {
 
            
 
            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) => {
light9/web/style.css
Show inline comments
 
@@ -197,3 +197,7 @@ table.borders td, table.borders th {
 
    border: 1px solid #4a4a4a;
 
    padding: 2px 8px;
 
}
 
hr {
 
    width: 100%;
 
    border-color: #1d3e1d;
 
}
light9/zmqtransport.py
Show inline comments
 
@@ -22,7 +22,7 @@ def parseJsonMessage(msg):
 
def startZmq(port, collector):
 
    stats = scales.collection(
 
        '/zmqServer',
 
        scales.PmfStat('setAttr'),
 
        scales.PmfStat('setAttr', recalcPeriod=1),
 
        scales.RecentFpsStat('setAttrFps'),
 
    )
 

	
requirements.txt
Show inline comments
 
@@ -36,7 +36,7 @@ ipython==5.3.0
 
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
stubs/greplin/scales/__init__.pyi
Show inline comments
 
@@ -116,7 +116,7 @@ class PmfStatDict(UserDict):
 
    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):
0 comments (0 inline, 0 general)