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)
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)
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)
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())
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)
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)
def get_perf_cpu_clock(request): server = request['server'] process_socket_request(request, 'perf.cpuclock.req', PerfProfiler(server).get_perf_cpu_clock)
def get_perf_flame(request): server = request['server'] process_socket_request(request, 'perf.flame.req', PerfProfiler(server).get_cmd_perf_flame)
def test_stability(self): profiler = PerfProfiler('www.rmlink.cn') self.repeated_test(profiler.get_cmd_perf_flame)
def test_stability(self): profiler = PerfProfiler('www.rmlink.cn') self.repeated_test(profiler.get_perf_cpu_clock)
def setUp(self): self.profiler = PerfProfiler('')
def setUp(self): self.profiler = PerfProfiler('www.rmlink.cn')
def setUp(self): self.functor = PerfProfiler('').get_perf_cpu_clock