Mercurial > code > home > repos > homeauto
comparison service/arduinoNode/devices.py @ 1424:458355ee1b99
arduinonode: per-device-type timing stats
Ignore-this: de560ed6044cef5dacbf5d9b6334df99
darcs-hash:c0164f22d20b5673d1f42ffa4462ef4ed87b608d
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Wed, 07 Aug 2019 20:55:00 -0700 |
parents | f349fe25789c |
children | 4880a9868673 |
comparison
equal
deleted
inserted
replaced
1423:ba56263fe3b2 | 1424:458355ee1b99 |
---|---|
2 | 2 |
3 import itertools, logging, struct, os, sys | 3 import itertools, logging, struct, os, sys |
4 from rdflib import Namespace, RDF, URIRef, Literal | 4 from rdflib import Namespace, RDF, URIRef, Literal |
5 import time | 5 import time |
6 | 6 |
7 sys.path.append('../../lib') | 7 from greplin import scales |
8 | |
8 from devices_shared import RgbPixelsAnimation | 9 from devices_shared import RgbPixelsAnimation |
9 | 10 |
10 ROOM = Namespace('http://projects.bigasterisk.com/room/') | 11 ROOM = Namespace('http://projects.bigasterisk.com/room/') |
11 XSD = Namespace('http://www.w3.org/2001/XMLSchema#') | 12 XSD = Namespace('http://www.w3.org/2001/XMLSchema#') |
12 log = logging.getLogger() | 13 log = logging.getLogger() |
39 log.info('found %s, a %s', row.dev, cls.deviceType) | 40 log.info('found %s, a %s', row.dev, cls.deviceType) |
40 yield cls(graph, row.dev, int(row.pinNumber)) | 41 yield cls(graph, row.dev, int(row.pinNumber)) |
41 | 42 |
42 # subclasses may add args to this | 43 # subclasses may add args to this |
43 def __init__(self, graph, uri, pinNumber): | 44 def __init__(self, graph, uri, pinNumber): |
45 scales.init(self, self.__class__.__name__) | |
46 self._stats = scales.collection(self.__class__.__name__, | |
47 scales.PmfStat('poll'), | |
48 scales.PmfStat('output'), | |
49 ) | |
44 self.graph, self.uri = graph, uri | 50 self.graph, self.uri = graph, uri |
45 self.pinNumber = pinNumber | 51 self.pinNumber = pinNumber |
46 self.hostStateInit() | 52 self.hostStateInit() |
47 | 53 |
48 def hostStateInit(self): | 54 def hostStateInit(self): |