Mercurial > code > home > repos > light9
changeset 1931:acdad1f7b75f
some metrics from asco
Ignore-this: 1df3b55be5136d09e3d7a65c203b4761
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 02 Jun 2019 11:34:36 +0000 |
parents | d40a653f2bfd |
children | 4dd977d11dca |
files | light9/ascoltami/player.py light9/ascoltami/webapp.py |
diffstat | 2 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/ascoltami/player.py Sun Jun 02 06:44:24 2019 +0000 +++ b/light9/ascoltami/player.py Sun Jun 02 11:34:36 2019 +0000 @@ -6,9 +6,13 @@ import time, logging, traceback from gi.repository import Gst from twisted.internet import task +from greplin import scales log = logging.getLogger() +stats = scales.collection('/player', + scales.RecentFpsStat('currentTimeFps'), +) class Player(object): @@ -136,6 +140,7 @@ log.error("couldn't preload %s, %r", songPath, e) raise + @stats.currentTimeFps.rate() def currentTime(self): success, cur = self.playbin.query_position(Gst.Format.TIME) if not success:
--- a/light9/ascoltami/webapp.py Sun Jun 02 06:44:24 2019 +0000 +++ b/light9/ascoltami/webapp.py Sun Jun 02 11:34:36 2019 +0000 @@ -3,6 +3,7 @@ from cyclone import template from rdflib import URIRef import cyclone.web +from greplin.scales.cyclonehandler import StatsHandler from cycloneerr import PrettyErrorHandler from light9.namespaces import L9 @@ -166,5 +167,6 @@ (r"/seekPlayOrPause", seekPlayOrPause), (r"/output", output), (r"/go", goButton), + (r'/stats/(.*)', StatsHandler, {'serverName': 'ascoltami'}), ], app=app)