示例#1
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)
示例#2
0
def getPerfCpuClockData(server):

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

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

    return jsonify(data)