Example #1
0
def getMemoryProcrank(server):

    profiler = MemoryProfiler(server)
    data = profiler.getProcrank()

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

    return jsonify(data)
Example #2
0
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, [
            socketio, interval, "memory.procrank.res", MemoryProfiler(server).getProcrank])
        memory_procrank_timer.start()
    emit("memory.procrank.res", MemoryProfiler(server).getProcrank())
Example #3
0
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())
Example #4
0
def get_proc_rank(request):
    print('received memory.procrank.req: ' + request['server'])

    server = request['server']
    profiler = MemoryProfiler(server)
    data = profiler.getProcrank()

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

    emit('memory.procrank.res', data)
Example #5
0
def get_memory_status(request):
    print('received memory.status.req: ' + request['server'])

    server = request['server']
    profiler = MemoryProfiler(server)
    data = {}
    data = profiler.getStatus()

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

    emit('memory.status.res', data)
Example #6
0
class GetProcMeminfoTestCase(LepvTestCase):
    def setUp(self):
        self.profiler = MemoryProfiler('')

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

        print("Actual:")
        pprint(actual)

        compare_result = DictUtil.compare(actual, expected)

        if expected_match_type == 'equals':
            self.assertEqual(compare_result, 0,
                             "Expected and Actual does not match")
        elif expected_match_type == '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,
             expected_match_type):
        self.describe(kernel, os, cpu, note, expected_match_type, expected)

        # getStatus -> GetProcMeminfo
        actual = self.profiler.getStatus(lepdResult)
        self.validate(expected, actual, expected_match_type)
Example #7
0
 def test_stability(self):
     profiler = MemoryProfiler('www.rmlink.cn')
     self.repeated_test(profiler.getStatus)
Example #8
0
 def setUp(self):
     self.functor = MemoryProfiler('').getCapacity
Example #9
0
 def setUp(self):
     self.profiler = MemoryProfiler('')
Example #10
0
def get_memory_status(request):
    server = request['server']
    process_socket_request(request, 'memory.status.req',
                           MemoryProfiler(server).getStatus)
Example #11
0
def get_proc_rank(request):
    server = request['server']
    process_socket_request(request, 'memory.procrank.req',
                           MemoryProfiler(server).getProcrank)
Example #12
0
 def setUp(self):
     self.functor = MemoryProfiler('').getProcrank