示例#1
0
文件: views.py 项目: macxu/lepv
def getPerfCpuClockData(server):

    profiler = PerfProfiler(server)
    data = profiler.getPerfCpuClock()

    if 'request_id' in request.args:
        data['response_id'] = request.args['request_id']

    return jsonify(data)
示例#2
0
def getPerfFlameData(server):

    profiler = PerfProfiler(server)
    data = profiler.get_cmd_perf_flame()

    if 'request_id' in request.args:
        data['response_id'] = request.args['request_id']

    return jsonify(data)
示例#3
0
def get_perf_cpu_clock(request):
    print('received perf.cpuclock.req: ' + request['server'])

    server = request['server']
    profiler = PerfProfiler(server)
    data = profiler.getPerfCpuClock()

    if "request_id" in request:
        data['response_id'] = request['request_id']

    emit('perf.cpuclock.res', data)
示例#4
0
def get_perf_flame(request):
    server = request['server']
    interval = request['interval']
    socketio = perf_blueprint.get_io()
    global perf_flame_timer
    if perf_flame_timer is None:
        perf_flame_timer = Timer(interval, background_timer_stuff, [
            socketio, interval, "perf.flame.res",
            PerfProfiler(server).get_cmd_perf_flame
        ])
        perf_flame_timer.start()
    emit("perf.flame.res", PerfProfiler(server).get_cmd_perf_flame())
示例#5
0
class GetCmdPerfCpuclockTestCase(LepvTestCase):

    def setUp(self):
        self.profiler = PerfProfiler('')

    def validate(self, expected, actual, expectedMatchType):

        print("Actual:")
        pprint(actual)

        compare_result = DictUtil.compare(actual, expected)

        if expectedMatchType == 'equals':
            self.assertEqual(compare_result, 0, "Expected and Actual does not match")
        elif expectedMatchType == 'contains':
            self.assertIn(compare_result, [0, 1], "Actual does not contain the expected")
        else:
            print("")


    @file_data("unittests.json")
    def test(self, kernel, os, cpu, note, lepdResult, expected, expectedMatchType):
        self.describe(kernel, os, cpu, note, expectedMatchType, expected)

        actual = self.profiler.get_perf_cpu_clock(lepdResult)
        self.validate(expected, actual, expectedMatchType)
示例#6
0
class GetCmdPerfFlameComponentTestCase(unittest.TestCase):
    def setUp(self):
        self.profiler = PerfProfiler('www.rmlink.cn')

    def test_flame_burner(self):

        flame_data = self.profiler.get_cmd_perf_flame()

        pprint(flame_data)
示例#7
0
def get_perf_cpu_clock(request):
    server = request['server']
    process_socket_request(request, 'perf.cpuclock.req', PerfProfiler(server).get_perf_cpu_clock)
示例#8
0
def get_perf_flame(request):
    server = request['server']
    process_socket_request(request, 'perf.flame.req', PerfProfiler(server).get_cmd_perf_flame)
示例#9
0
 def test_stability(self):
     profiler = PerfProfiler('www.rmlink.cn')
     self.repeated_test(profiler.get_cmd_perf_flame)
示例#10
0
 def test_stability(self):
     profiler = PerfProfiler('www.rmlink.cn')
     self.repeated_test(profiler.get_perf_cpu_clock)
示例#11
0
 def setUp(self):
     self.profiler = PerfProfiler('')
示例#12
0
 def setUp(self):
     self.profiler = PerfProfiler('www.rmlink.cn')
示例#13
0
 def setUp(self):
     self.functor = PerfProfiler('').get_perf_cpu_clock