コード例 #1
0
def get_ms_data(request):
    server = request['server']
    tag = request['tag']
    socketio = cpu_blueprint.get_io()

    if (tag == 0):
        print("tag" + str(tag))
        interval = request['interval']
        global cpu_mysql_timer,cpu_mysql_count
        # tableinfo = {'tablename': 'history', 'list1': 'clock', 'list2': 'value', 'list3': '25462'}//wh
        tableinfo = {'tablename': 'history', 'list1': 'clock', 'list2': 'value', 'list3': '23296'}
        # if cpu_mysql_timer is None:
        #       print("cpu.avgload.res-2-", str(CPUProfiler(server).get_average_load()))
        # cpu_mysql_count = request["flag"]
        # set_value("cpumysql",str(cpu_mysql_count))
        # cpu_mysql_timer = Timer(interval, background_timer_stuff_cpumysql, [socketio, interval, "cpu.mysql.res", CPUProfiler(server).get_mysql_data, tableinfo])
        # cpu_mysql_timer.start()
        get_mysql_data = CPUProfiler(server).get_mysql_data(tableinfo)
        socketio.emit("cpu.mysql.res", get_mysql_data)
        socketio.sleep(0)
        tableinfo = {'tablename': 'history', 'list1': 'clock', 'list2': 'value', 'list3': '23296', 'list5': '1'}
        cpu_mysql_count = request["flag"]
        set_value("cpumysql",str(cpu_mysql_count))
        cpu_mysql_timer = Timer(interval, background_timer_stuff_cpumysql, [socketio, interval, "cpu.mysql.res", CPUProfiler(server).get_mysql_data, tableinfo])
        cpu_mysql_timer.start()

    elif (tag == 1):
        print("tag" + str(tag))
        clock = request['min']
        print('time-1-'+ clock)
        tableinfo = {'tablename': 'history', 'list1': 'clock', 'list2': 'value', 'list3': '23296', 'list4': clock}
        get_mysql_data = CPUProfiler(server).get_mysql_data(tableinfo)
        socketio.emit("cpu.mysql.res", get_mysql_data)
        socketio.sleep(0)
コード例 #2
0
def get_cpu_idle(request):
    server = request['server']
    tag = request['tag']
    socketio = cpu_blueprint.get_io()

    # cpu_statidle_timer = Timer(interval, background_timer_stuff_cpustatidle, [socketio, interval, "cpu.statidle.res", CPUProfiler(server).idle])
    # cpu_statidle_timer.start()
    # emit("cpu.statidle.res", CPUProfiler(server).get_irq())
    if (tag == 0):
        print("tag" + str(tag))
        interval = request['interval']
        global cpu_statidle_timer, cpu_statidle_count
        tableinfo = {}
        socketio.emit("cpu.statidle.res", CPUProfiler(server).get_cpu_idle(tableinfo))
        tableinfo = { 'list5': '1'}

        cpu_statidle_count = request["flag"]
        set_value("cpustatidle", str(cpu_statidle_count))
        print("cpu_statidle_count"+ str(cpu_statidle_count))
        cpu_statidle_timer = Timer(interval, background_timer_stuff_cpustatidle, [socketio, interval, "cpu.statidle.res", CPUProfiler(server).get_cpu_idle, tableinfo])
        cpu_statidle_timer.start()

    elif (tag == 1):
        print("tag" + str(tag))
        clock = request['min']
        print('time-1-'+ clock)
        tableinfo = {'list4': clock}
        socketio.emit("cpu.statidle.res", CPUProfiler(server).get_cpu_idle(tableinfo))
コード例 #3
0
def get_cpu_softirq(request):
    server = request['server']
    tag = request['tag']
    datatype = request['type']
    print("datatype"+datatype)
    socketio = cpu_blueprint.get_io()
    if (tag == 0):
        print("tag" + str(tag))
        interval = request['interval']
        global cpu_softirq_timer,cpu_softirq_count
        tableinfo = {'datatype':datatype}
        socketio.emit("cpu.softirq.res",CPUProfiler(server).get_softirq(tableinfo))
        tableinfo = {'list5':1,'datatype':datatype}
        cpu_softirq_count = request["flag"]
        set_value("cpusoftirq",str(cpu_softirq_count))
        # if cpu_softirq_timer is None:
        cpu_softirq_timer = Timer(interval, background_timer_stuff_cpusoftirq, [socketio, interval, "cpu.softirq.res", CPUProfiler(server).get_softirq,tableinfo])
        cpu_softirq_timer.start()
        # emit("cpu.softirq.res", CPUProfiler(server).get_softirq())
    elif (tag == 1):
        print("tag"+str(tag))
        clock = request['min']
        print('time-1-'+ clock)
        tableinfo = {'list4':clock,'datatype':datatype}
        socketio.emit("cpu.softirq.res",CPUProfiler(server).get_softirq(tableinfo))
コード例 #4
0
def get_avg_load(request):
    server = request['server']
    tag = request['tag']
    socketio = cpu_blueprint.get_io()
    if (tag == 0):
        print("tag" + str(tag))
        interval = request['interval']
        global cpu_avg_timer,cpu_avg_count
        tableinfo = {}
        socketio.emit("cpu.avgload.res", CPUProfiler(server).get_avg_load(tableinfo))
        tableinfo = {'list5': 1}
        cpu_avg_count = request["flag"]
        set_value("cpuavg",str(cpu_avg_count))
        # if cpu_avg_timer is None:
        #       print("cpu.avgload.res-2-", str(CPUProfiler(server).get_average_load()))
        cpu_avg_timer = Timer(interval, background_timer_stuff_cpuavg, [socketio, interval, "cpu.avgload.res", CPUProfiler(server).get_avg_load,tableinfo])
        cpu_avg_timer.start()
        #    print("cpu.avgload.res-1-", str(CPUProfiler(server).get_average_load()))
        #     emit("cpu.avgload.res", CPUProfiler(server).get_average_load())
    elif (tag == 1):
        print("tag" + str(tag))
        clock = request['min']
        print('time-1-' + clock)
        tableinfo = {'list4': clock}
        socketio.emit("cpu.avgload.res",CPUProfiler(server).get_avg_load(tableinfo))
コード例 #5
0
def get_top(request):
    server = request['server']
    interval = request['interval']
    socketio = cpu_blueprint.get_io()
    global cpu_top_timer,cpu_top_count
    cpu_top_count = request["flag"]
    set_value("cputop",str(cpu_top_count))
    # if cpu_top_timer is None:
    # cpu_top_timer = Timer(interval, background_timer_stuff_cputop, [socketio, interval, "cpu.top.res", CPUProfiler(server).getTopOut])
    cpu_top_timer = Timer(interval, background_timer_stuff_cputop, [socketio, interval, "cpu.top.res", CPUProfiler(server).get_cpu_top])
    cpu_top_timer.start()
コード例 #6
0
def get_io_top(request):
    server = request['server']
    interval = request['interval']
    socketio = io_blueprint.get_io()
    global io_top_timer,io_top_count
    io_top_count = request["flag"]
    set_value("iotop",str(io_top_count))
    # if io_top_timer is None:
    io_top_timer = Timer(interval, background_timer_stuff_iotop, [
                         socketio, interval, "io.top.res", IOProfiler(server).get_io_top])
    io_top_timer.start()
コード例 #7
0
def get_ms_data2(request):
    server = request['server']
    interval = request['interval']
    socketio = cpu_blueprint.get_io()
    global cpu_mysql_timer2,cpu_mysql_count2
    tableinfo = {'tablename': 'history', 'list1': 'clock', 'list2': 'value', 'list3': '25940'}
    cpu_mysql_count2 = request["flag"]
    set_value("cpumysql2", str(cpu_mysql_count2))
    # if cpu_mysql_timer2 is None:
#       print("cpu.avgload.res-2-", str(CPUProfiler(server).get_average_load()))
    cpu_mysql_timer2 = Timer(interval, background_timer_stuff_cpumysql2, [socketio, interval, "cpu.mysql2.res", CPUProfiler(server).get_mysql_data, tableinfo])
    cpu_mysql_timer2.start()
コード例 #8
0
def get_perf_flame(request):
    server = request['server']
    interval = request['interval']
    socketio = perf_blueprint.get_io()
    global perf_flame_timer, perf_flame_count
    perf_flame_count = request["flag"]
    set_value("perfflame", str(perf_flame_count))
    # if perf_flame_timer is None:
    perf_flame_timer = Timer(interval, background_timer_stuff_perfflame, [
        socketio, interval, "perf.flame.res",
        PerfProfiler(server).get_cmd_perf_flame
    ])
    perf_flame_timer.start()
コード例 #9
0
def get_io_status(request):
    server = request['server']
    interval = request['interval']
    socketio = io_blueprint.get_io()

    global io_status_timer,io_status_count
    io_status_count = request["flag"]
    set_value("iostatus",str(io_status_count))
    # if io_status_timer is None:
    io_status_timer = Timer(interval, background_timer_stuff_iostatus, [
                            socketio, interval, "io.status.res", IOProfiler(server).get_status])
    io_status_timer.start()
    # emit("io.status.res", IOProfiler(server).get_status())
    print("get_io_status-1-"+str(io_status_count))
コード例 #10
0
def get_perf_cpu_clock(request):
    server = request['server']
    interval = request['interval']
    socketio = perf_blueprint.get_io()
    global perf_cpuclock_timer, perf_cpuclock_count
    # if perf_cpuclock_timer is None:
    perf_cpuclock_count = request["flag"]
    set_value("perfcpuclock", str(perf_cpuclock_count))
    perf_cpuclock_timer = Timer(interval, background_timer_stuff_perfcpuclock,
                                [
                                    socketio, interval, "perf.cpuclock.res",
                                    PerfProfiler(server).get_perf_cpu_clock
                                ])
    perf_cpuclock_timer.start()
コード例 #11
0
def get_call_graph(request):
    server = request['server']
    interval = request['interval']
    socketio = callgraph_blueprint.get_io()
    global callgraph_timer,callgraph_count,dir1,dir2
    # if perf_cpuclock_timer is None:

    callgraph_count = request["flag"]
    if (callgraph_count == "True"):
        dir1 = request['dir1']
        dir2 = request['dir2']
    set_value("callgraph", str(callgraph_count))
    callgraph_timer = Timer(interval, background_timer_stuff_callgraph, [
        socketio, interval, "callgraph.res", CallgraphProfiler(server).get_callgraph,dir1,dir2])
    callgraph_timer.start()
コード例 #12
0
def get_gprof_callgraph(request):
    server = request['server']
    interval = request['interval']
    socketio = gprof_blueprint.get_io()
    global gprof_timer, gprof_count, dir
    # if perf_cpuclock_timer is None:

    gprof_count = request["flag"]
    if (gprof_count == "True"):
        dir = request['dir1']
    set_value("gprof", str(gprof_count))
    gprof_timer = Timer(interval, background_timer_stuff_gprof_callgraph, [
        socketio, interval, "gprof.res",
        GprofProfiler(server).get_gprof_callgraph, dir
    ])
    gprof_timer.start()
コード例 #13
0
def get_proc_rank(request):
    server = request['server']
    interval = request['interval']
    socketio = memory_blueprint.get_io()
    global memory_procrankpss_timer, memory_procrankpss_count
    # if memory_procrankpss_timer is None:
    memory_procrankpss_count = request["flag"]
    set_value("memoryprocrankpss", str(memory_procrankpss_count))
    # memory_procrankpss_timer = Timer(interval, background_timer_stuff_memoryprocrankpss, [
    #     socketio, interval, "memory.procrankpss.res", MemoryProfiler(server).getProcrank])
    memory_procrankpss_timer = Timer(
        interval, background_timer_stuff_memoryprocrankpss, [
            socketio, interval, "memory.procrankpss.res",
            MemoryProfiler(server).get_procrank
        ])
    memory_procrankpss_timer.start()
コード例 #14
0
def get_cpu_stat(request):
    server = request['server']
    tag = request['tag']
    socketio = cpu_blueprint.get_io()

    # global cpu_statoverall_timer,cpu_statoverall_count
    # cpu_statoverall_count = request["flag"]
    # set_value("cpustatoverall",str(cpu_statoverall_count))
    # if cpu_statoverall_timer is None:
    # cpu_statoverall_timer = Timer(interval, background_timer_stuff_cpustatoverall, [socketio, interval, "cpu.statoverall.res", CPUProfiler(server).get_cpu_stat])
    # cpu_statoverall_timer.start()
    # emit("cpu.statoverall.res", {'data':[{'softirq': 0.0502, 'idle': 99.1556, 'time': 1542252266, 'iowait': 0.1589, 'irq': 0.0, 'steal': 0.0, 'user': 0.1421, 'nice': 0.0, 'system': 0.5142}]})

    if (tag == 0):
        print("tag" + str(tag))
        interval = request['interval']
        # global cpu_mysql_timer,cpu_mysql_count
        global cpu_statoverall_timer, cpu_statoverall_count
        tableinfo = {}
        # get_mysql_data = CPUProfiler(server).get_mysql_data(tableinfo)
        socketio.emit("cpu.statoverall.res", CPUProfiler(server).get_cpu_stat(tableinfo))
        # socketio.emit("cpu.statoverall.res", "222")
        socketio.sleep(0)
        tableinfo = { 'list5': '1'}
        # cpu_mysql_count = request["flag"]
        # set_value("cpumysql",str(cpu_mysql_count))
        cpu_statoverall_count = request["flag"]
        set_value("cpustatoverall", str(cpu_statoverall_count))
        cpu_statoverall_timer = Timer(interval, background_timer_stuff_cpustatoverall, [socketio, interval, "cpu.statoverall.res", CPUProfiler(server).get_cpu_stat, tableinfo])
        cpu_statoverall_timer.start()
        # cpu_mysql_timer = Timer(interval, background_timer_stuff_cpumysql, [socketio, interval, "cpu.mysql.res", CPUProfiler(server).get_mysql_data, tableinfo])
        # cpu_mysql_timer.start()

    elif (tag == 1):
        print("tag" + str(tag))
        clock = request['min']
        print('time-1-'+ clock)
        tableinfo = {'list4': clock}
        socketio.emit("cpu.statoverall.res", CPUProfiler(server).get_cpu_stat(tableinfo))
        socketio.sleep(0)