comptest.log file source:
CSV summary: Algorithm,Test_type,Using_engine_compression,Using_engine_decompression,Deflate_buffering_enabled,Inflate_buffering_enabled,Compression_Level,Chunk_Size,Polling_Interval,Wait_Resp_Type,Stream_type,Window_size,Core_affinity,Elapsed_usec,Cores,Threads,Count,Data_per_test,Mbps,CPU_%,User_%,Kernel_%,Ratio,Context_switches,Cycles csv,Corpus Compression,1,Yes,Yes,Yes,Yes,1,4096,100000,2,0,5,Yes,125184,1,1,1,3248128,207.57,95,95,0,0.391,69,312959386 Verification: PASS Verification: PASS QAT zlib test application
#!/usr/bin/python # -*- coding: utf-8 -*- import re import numpy as np import pandas as pd allkey = [ "Algorithm", "Stream_type", "Compression_Level", "Cores", "Threads", "Window_size", "Chunk_Size", "Mbps", "CPU_%" ] list = [] with open('comptest.log') as jrf: log_str = jrf.read() line1 = re.compile("CSV summary:\n(.*?)Cycles") line2 = re.compile("csv,(.*?)\n") data = re.findall(line1, log_str) data2 = re.findall(line2, log_str) key_ls = [data[i:i + 1] for i in range(0, len(data), 1)] data_ls = [data2[i:i + 1] for i in range(0, len(data2), 1)] for i in data_ls: a = i[0].split(",") if a[10] == '0': b = "raw" if a[10] == '1': b = "zlib" if a[10] == '2': b = "gzib" if a[14] == '96' and a[15] == '96' and a[11] != '5': c = "level" + a[6] f = '16Kwin' if a[11] == '6' else '32Kwin' g = str(int(a[7]) / 1024) + "K" list.append([a[0], b, c, a[14], a[15], f, g, a[18], a[19]]) data = np.array(list) np.array(data) save = pd.DataFrame(data, columns=allkey) save.to_csv('log.csv', index=False, header=True)
数据筛选及转成CSV文件,保存后并在Excel文档编辑操作
最新推荐文章于 2023-12-03 13:10:32 发布