Moved files to subdirectory

This commit is contained in:
2022-09-06 12:50:09 +01:00
parent 2731713ede
commit 122fdca5db
83 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
from twisted.internet.task import LoopingCall
import main
def event(name, eventType):
if "local" not in main.counters.keys():
main.counters["local"] = {}
if "global" not in main.counters.keys():
main.counters["global"] = {}
if name not in main.counters["local"].keys():
main.counters["local"][name] = {}
if eventType not in main.counters["local"][name].keys():
main.counters["local"][name][eventType] = 0
if eventType not in main.counters["global"]:
main.counters["global"][eventType] = 0
main.counters["local"][name][eventType] += 1
main.counters["global"][eventType] += 1
main.runningSample += 1
def getEvents(name=None):
if name is None:
if "global" in main.counters.keys():
return main.counters["global"]
else:
return None
else:
if name in main.counters["local"].keys():
return main.counters["local"][name]
else:
return None
def takeSample():
main.lastMinuteSample = main.runningSample
main.runningSample = 0
def setupCounterLoop():
lc = LoopingCall(takeSample)
lc.start(60)