示例#1
0
def dhrystone(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search("\[test:([\s\S]+?)\]", case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)

        tables = []
        tableContent = {}
        centerTopGroup = re.search(
            "Dhrystone Benchmark([\s\S]+)used in the benchmark:", case)
        tableContent[parser_log.CENTER_TOP] = centerTopGroup.group(0)
        tableGroup = re.search("used in the benchmark:\n([\s\S]+)\n\[status\]",
                               case)
        if tableGroup is not None:
            tableGroupContent = tableGroup.groups()[0].strip()
            table = parser_log.parseTable(tableGroupContent, ":{1,}")
            tableContent[parser_log.I_TABLE] = table
        tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#2
0
def nginx(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search('\[([\ \S]+)\]', case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)
            caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        tables = []
        tableContent = {}
        #           centerTopGroup = re.search("\;\n([\S\s]+)\-\-", case)
        #           tableContent[parser_log.CENTER_TOP] = centerTopGroup.groups()[0]
        tableGroup = re.search("\-\-\n([\s\S]+)\.\/", case)
        if tableGroup is not None:
            tableGroupContent_temp = tableGroup.groups()[0].strip()
            tableGroupContent = re.sub('[\S\ ]+completed[\S\ \n]{0,}', '',
                                       tableGroupContent_temp)
            table = parser_log.parseTable(tableGroupContent, "[\|\ ]{1,}")
            tableContent[parser_log.I_TABLE] = table
        tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#3
0
def scimark(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search('\[test:([\s\S]+)scimark2', case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)
            caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        tables = []
        tableContent = {}
        centerTopGroup = re.search("\*\*\n([\s\S]+)kenel\.?", case)
        tableContent[parser_log.CENTER_TOP] = centerTopGroup.groups()[0]
        tableGroup = re.search("kenel\.*([\s\S]+\))", case)
        if tableGroup is not None:
            tableGroupContent_temp = tableGroup.groups()[0].strip()
            tableGroupContent = re.sub(':([\s]+)Mflops:', ' Mflops:', tableGroupContent_temp)
            table = parser_log.parseTable(tableGroupContent, ":{1,}")
            tableContent[parser_log.I_TABLE] = table
        tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#4
0
def qperf(filePath, outfp):
    file = open(filePath)
    filecontent = file.read()
    file.close()
    cases = re.findall('<<<BEGIN TEST>>>([\s\S]+?)<<<END>>>', filecontent)

    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search('\[([\S\ ]+)\]\n', case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)
            caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        tables = []
        tableContent = {}
        centerTopGroup = re.search("(log\:[\S\ ]+[tcp_lat|tcp_bw]\n)", case)
        tableContent[parser_log.CENTER_TOP] = centerTopGroup.groups()[0]
        tableGroup = re.search("[tcp_lat|tcp_bw]\n([\s\S]+)\[status\]", case)
        if tableGroup is not None:
            tableGroupContent_temp = tableGroup.groups()[0].strip()
            tableGroupContent = re.sub('\:\s+', ':', tableGroupContent_temp)
            table = parser_log.parseTable(tableGroupContent, ":{1,}")
            tableContent[parser_log.I_TABLE] = table
        tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    result = json.dumps(result)
    outfp.write(result)
    return result
示例#5
0
def redis(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search('\[([\S\ ]+)\]\n', case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)
            caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        tables = []
        tableContent = {}
        #            centerTopGroup = re.search("(log\:[\S\ ]+\n)", case)
        #            tableContent[parser_log.CENTER_TOP] = centerTopGroup.groups()[0]
        tableGroup = re.search("(\=\=\=[\s\S]+)\[st", case)
        if tableGroup is not None:
            tableGroupContent_temp1 = tableGroup.groups()[0].strip()
            tableGroupContent_temp2 = re.sub(
                'Finish generate dump data[\s\S]+call redis-benchmark to test redis-0', '',
                tableGroupContent_temp1)
            tableGroupContent_temp3 = re.sub('[PIPELINE|SHORT][\S\ ]+', '', tableGroupContent_temp2)
        tableGroupContent = re.sub('\=\=\=+', '', tableGroupContent_temp3)
        table = parser_log.parseTable(tableGroupContent, "''{1,}")
        tableContent[parser_log.I_TABLE] = table
    tables.append(tableContent)
    caseDict[parser_log.TABLES] = tables
    result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#6
0
def netperf(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search('\[test:([\s\S]+?)\]', case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)
            caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        tables = []
        tableContent = {}
        centerTopGroup = re.search("(MIGRATED[\S\ ]+)\n", case)
        tableContent[parser_log.CENTER_TOP] = centerTopGroup.groups()[0]
        tableGroup = re.search("MIGRATED[\S\ ]+\n?([\s\S]+)\[status\]", case)
        if tableGroup is not None:
            tableGroupContent = tableGroup.groups()[0].strip()
            tableGroupContent_temp1 = re.sub('per sec', 'per/sec',
                                             tableGroupContent)
            table = parser_log.parseTable(tableGroupContent_temp1, "\ {1,}")
            tableContent[parser_log.I_TABLE] = table
        tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#7
0
def compile(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search("\[test:([\s\S]+?)\]", case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)

        tables = []
        tableContent = {}
        tableContent[parser_log.CENTER_TOP] = ''
        tableGroup = re.search("(real	[\s\S]+)\[status\]", case)
        if tableGroup is not None:
            tableGroupContent = tableGroup.groups()[0].strip()
            table = parser_log.parseTable(tableGroupContent, "\\s{1,}")
            tableContent[parser_log.I_TABLE] = table
        tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#8
0
def scimarkjava(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search('\[test:([\s\S]+)\;', case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)
            caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        tables = []
        tableContent = {}
        centerTopGroup = re.search("\;\n([\s\S]+)a\n", case)
        tableContent[parser_log.CENTER_TOP] = centerTopGroup.groups()[0]
        tableGroup = re.search("(Composite[\s\S]+)\[", case)
        if tableGroup is not None:
            tableGroupContent = tableGroup.groups()[0].strip()
            table = parser_log.parseTable(tableGroupContent, ":{1,}")
            tableContent[parser_log.I_TABLE] = table
        tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#9
0
def openblas(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search("\[test:([\s\S]+?)\]", case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)

        tables = []
        tableContent = {}
        tc = re.search("From[\s\S]+?[\n\r]([\s\S]+?)\[status\]", case)
        if tc is not None:
            content = tc.groups()[0]
            subContent = re.sub(":", "", content)
            tableContent[parser_log.CENTER_TOP] = ""
            tableContent[parser_log.I_TABLE] = parser_log.parseTable(
                subContent, "\\s{2,}")
            tables.append(tableContent)
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result
示例#10
0
def nbench(filePath, outfp):
    cases = parser_log.parseData(filePath)
    result = []
    for case in cases:
        caseDict = {}
        caseDict[parser_log.BOTTOM] = parser_log.getBottom(case)
        titleGroup = re.search("\[test:([\s\S]+?)\]", case)
        if titleGroup != None:
            caseDict[parser_log.TOP] = titleGroup.group(0)

        tables = []
        tableContent = {}
        tc = re.search("(TEST[\s\S]+?)===", case)
        if tc is not None:
            table = []
            content = re.sub(":|-", "", tc.groups()[0])
            lines = content.splitlines()
            appendCells = []
            for appendCell in re.split("\\s{2,}", lines[1]):
                if appendCell.strip() != "":
                    appendCells.append(appendCell)
            for index, line in enumerate(lines):
                td = []
                cells = re.split("\\s{2,}", line)
                if index == 0:
                    for cellIndex, topCell in enumerate(cells):
                        if topCell.strip() != "":
                            if cellIndex >= 2:
                                td.append(topCell + " " +
                                          appendCells[cellIndex - 2])
                            else:
                                td.append(topCell)

                elif index != 1:
                    for cell in cells:
                        if cell.strip() != "":
                            td.append(cell.strip())
                if len(td) > 0:
                    table.append(td)

            tableContent[parser_log.CENTER_TOP] = ""
            tableContent[parser_log.TABLE] = table
            tables.append(copy.deepcopy(tableContent))

        original_group = re.search("(={4,}[\s\S]+?\n)([\s\S]+\n)={4,}", case)
        if original_group is not None:
            tableContent[parser_log.CENTER_TOP] = original_group.groups()[0]
            tableContent[parser_log.TABLE] = []
            tableContent[parser_log.I_TABLE] = parser_log.parseTable(
                original_group.groups()[1], ":")
            tables.append(copy.deepcopy(tableContent))
        linux_data_group = re.search(
            "(={4,}[\s\S]+?\n){2}([\s\S]+Baseline[\s\S]+?\n)", case)
        if linux_data_group is not None:
            tableContent[parser_log.CENTER_TOP] = linux_data_group.groups()[0]
            tableContent[parser_log.TABLE] = []
            tableContent[parser_log.I_TABLE] = parser_log.parseTable(
                linux_data_group.groups()[1], ":")
            tables.append(copy.deepcopy(tableContent))
        caseDict[parser_log.TABLES] = tables
        result.append(caseDict)
    outfp.write(json.dumps(result))
    return result