from modules.utils.socketIOBlueprint import SocketIOBlueprint from modules.profilers.perf.PerfProfiler import PerfProfiler from modules.utils.soketProcessor import process_socket_request, background_timer_stuff from threading import Timer from flask_socketio import emit perf_blueprint = SocketIOBlueprint('') perf_cpuclock_timer = None @perf_blueprint.on('perf.cpuclock.req') def get_perf_cpu_clock(request): server = request['server'] interval = request['interval'] socketio = perf_blueprint.get_io() global perf_cpuclock_timer if perf_cpuclock_timer is None: perf_cpuclock_timer = Timer(interval, background_timer_stuff, [ socketio, interval, "perf.cpuclock.res", PerfProfiler(server).get_perf_cpu_clock ]) perf_cpuclock_timer.start() emit("perf.cpuclock.res", PerfProfiler(server).get_perf_cpu_clock()) # process_socket_request(request, 'perf.cpuclock.req', PerfProfiler(server).get_perf_cpu_clock) perf_flame_timer = None @perf_blueprint.on('perf.flame.req')
from flask_socketio import emit from modules.lepd.LepDClient import LepDClient from modules.utils.socketIOBlueprint import SocketIOBlueprint util_blueprint = SocketIOBlueprint('') @util_blueprint.on('lepd.ping') def ping_lepd_server(request): server = request['server'] print('received ping: ' + server) client = LepDClient(server=server) ping_result = client.ping() if ping_result: emit('lepd.ping.succeeded', {}) else: emit('lepd.ping.failed', {})
from modules.utils.socketIOBlueprint import SocketIOBlueprint from modules.profilers.memory.MemoryProfiler import MemoryProfiler from modules.utils.soketProcessor import process_socket_request, background_timer_stuff from threading import Timer from flask_socketio import emit memory_blueprint = SocketIOBlueprint('') memory_status_timer = None @memory_blueprint.on('memory.status.req') def get_memory_status(request): server = request['server'] interval = request['interval'] socketio = memory_blueprint.get_io() global memory_status_timer if memory_status_timer is None: memory_status_timer = Timer(interval, background_timer_stuff, [ socketio, interval, "memory.status.res", MemoryProfiler(server).getStatus]) memory_status_timer.start() emit("memory.status.res", MemoryProfiler(server).getStatus()) # process_socket_request(request, 'memory.status.req', MemoryProfiler(server).getStatus) memory_procrank_timer = None @memory_blueprint.on('memory.procrank.req') def get_proc_rank(request): server = request['server'] interval = request['interval'] socketio = memory_blueprint.get_io() global memory_procrank_timer if memory_procrank_timer is None: memory_procrank_timer = Timer(interval, background_timer_stuff, [
from modules.utils.socketIOBlueprint import SocketIOBlueprint from modules.profilers.cpu.CPUProfiler import CPUProfiler from modules.utils.soketProcessor import process_socket_request, background_timer_stuff from flask_socketio import emit from threading import Timer cpu_blueprint = SocketIOBlueprint('') cpu_stat_timer = None @cpu_blueprint.on('cpu.stat.req') def get_cpu_stat(request): server = request['server'] interval = request['interval'] socketio = cpu_blueprint.get_io() global cpu_stat_timer if cpu_stat_timer is None: cpu_stat_timer = Timer( interval, background_timer_stuff, [socketio, interval, "cpu.stat.res", CPUProfiler(server).get_irq]) cpu_stat_timer.start() emit("cpu.stat.res", CPUProfiler(server).get_irq()) cpu_softirq_timer = None @cpu_blueprint.on('cpu.softirq.req') def get_cpu_softirq(request):