本帖最后由 Gin_Q 于 2020-5-20 17:17 编辑
| | | import os | | | | from printf_ import printf_ | | | | file_path = r'C:\Users\user\Desktop\TWII' | | os.chdir(file_path) | | | | | | f_csv = open('tes.csv','r') | | | | | | item = f_csv.readline().split(',') | | | | if item[-1] == '\n': | | item_n = len(item) - 1 | | else: | | | | item[-1] = item[-1][0:-1] | | item_n = len(item) | | | | | | | | data_item=dict(max=-10**20,max_time=None,min=10**20,min_time=None,avg=0,sum=0,count=0) | | | | | | item_list = [] | | for i in range(item_n): | | item_list.append(data_item.copy()) | | | | | | | | line_count=0 | | | | skip_col = 0 | | | | | | for each_line in f_csv: | | line_count += 1 | | | | temp = each_line.split(',') | | temp_len = len(temp) | | for i in range(temp_len): | | | | if i <= skip_col or i == item_n: continue | | | | try: | | t_data = float(temp[i]) | | except ValueError: | | t_data = 0 | | | | item_list[i]['sum'] += t_data | | if t_data > item_list[i]['max']: | | item_list[i]['max'] = t_data | | item_list[i]['max_time'] = temp[0] | | if t_data < item_list[i]['min']: | | item_list[i]['min'] = t_data | | item_list[i]['min_time'] = temp[0] | | | | for i in range(item_n): | | if i <= skip_col or i == item_n: continue | | | | if i > temp_len - 1: | | item_list[i]['avg'] = item_list[i]['sum'] / (line_count - 1) | | item_list[i]['count'] = line_count - 1 | | else: | | item_list[i]['avg'] = item_list[i]['sum'] / line_count | | item_list[i]['count'] = line_count | | f_csv.close() | | | | pf=printf_() | | | | sheet_len=[4,3,8,3,8,3,3,5] | | charlen = 0 | | | | for i in item: | | if len(i) > charlen: charlen = len(i) | | sheet_len[0] = charlen | | temp_count = 0 | | for i in item_list: | | if temp_count <= skip_col: | | temp_count+=1 | | continue | | for j,v in enumerate(list(i.values())): | | charlen = len(str(v)) | | poi = j+1 | | if sheet_len[poi] < charlen: sheet_len[poi] = charlen | | | | | | p_item=[i for i in data_item.keys()] | | p_item.insert(0,'item') | | | | | | pf.printf_head(*sheet_len) | | | | | | | | pf.printf_cnter(*list(row[i] for row in zip(p_item,sheet_len) for i in range(2))) | | pf.printf_head(*sheet_len) | | | | for i in range(item_n): | | if i <= skip_col or i == item_n: continue | | | | temp_list=list(item_list[i].values()) | | | | temp_list.insert(0,item[i]) | | pf.printf_cnter(*list(row[i] for row in zip(temp_list,sheet_len) for i in range(2))) | | pf.printf_head(*sheet_len)COPY |
| +------------------------------------+------------+--------------+-----------+--------------+--------------------+--------------------+-------+ | | | item | max | max_time | min | min_time | avg | sum | count | | | +------------------------------------+------------+--------------+-----------+--------------+--------------------+--------------------+-------+ | | | VDDCR_GFX Current (A) [0] (A) | 244.95688 | 20:32:05.864 | 2.00784 | 19:29:01.189 | 123.75535857904592 | 4502714.966540007 | 36384 | | | | GPU Temperature (C) [0] (C) | 84.67364 | 22:06:03.904 | 36.74507 | 19:29:01.189 | 80.63858083608046 | 2933954.1251399517 | 36384 | | | | Junction Temperature (C) [0] (C) | 99.82796 | 22:06:07.134 | 36.78448 | 19:29:01.189 | 93.10586805381416 | 3387563.9032699745 | 36384 | | | | Mem Temperature (C) [0] (C) | 98.0 | 22:06:16.874 | 34.0 | 19:29:02.245 | 93.02386349137001 | 3384580.2492700065 | 36384 | | | | VR_GFX (C) [0] (C) | 85.0 | 22:06:15.774 | 27.0 | 19:29:01.189 | 81.54814546119151 | 2967047.724459992 | 36384 | | | | VR_SOC (C) [0] (C) | 79.0 | 22:05:59.594 | 29.0 | 19:29:01.189 | 76.69735095179215 | 2790556.4170300053 | 36384 | | | | VR_MEM (C) [0] (C) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | VR_VDDCI (C) [0] (C) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | Liquid0 (C) [0] (C) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | Liquid1 (C) [0] (C) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | PLX (C) [0] (C) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | Min (C) [0] (C) | 79.15897 | 22:06:02.803 | 35.35468 | 19:29:01.189 | 75.73771405205596 | 2755640.988070004 | 36384 | | | | GFXCLK Freq [0] () | 2067.62036 | 05:42:38.450 | 804.09778 | 00:42:47.646 | 1917.2023946278628 | 69755491.92614016 | 36384 | | | | PWM [0] () | 60.54811 | 22:06:21.194 | 0.0 | 19:29:01.189 | 48.997079181508425 | 1782709.7289400026 | 36384 | | | | FAN Speed [RPM] [0] () | 2452.70947 | 22:06:26.614 | 0.0 | 19:29:01.189 | 2148.191614044644 | 78159803.68540034 | 36384 | | | | Limit PPT0 (W) [0] (W) | 195.0 | 19:29:01.189 | 195.0 | 19:29:01.189 | 195.0 | 7094880.0 | 36384 | | | | Value PPT0 (W) [0] (W) | 195.00354 | 02:33:50.597 | 10.208 | 19:29:01.189 | 175.08616300241795 | 6370334.954679974 | 36384 | | | | GFX Activity (%) [0] (%) | 99.9752 | 00:42:08.825 | 0.07353 | 00:51:53.411 | 85.77492298345469 | 3120834.7978300154 | 36384 | | | | PCIe Link Speed (GT/s) [0] (GT/s) | 8.0 | 19:29:01.189 | 2.5 | 19:29:02.245 | 7.952685246262093 | 289350.5 | 36384 | | | | PCIe Link Width [0] () | 16.0 | 19:29:01.189 | 16.0 | 19:29:01.189 | 16.0 | 582144.0 | 36384 | | | | PCIe Correctable Error [0] () | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | PCIe Uncorrectable Error [0] () | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | PCIe Residency Gen 1 (%) [0] (%) | 51.89874 | 19:29:09.790 | 2.52275 | 19:33:32.379 | 3.1485344538808073 | 114556.27756999929 | 36384 | | | | PCIe Residency Gen 2 (%) [0] (%) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | PCIe Residency Gen 3 (%) [0] (%) | 97.47725 | 19:33:32.379 | 48.10127 | 19:29:09.790 | 96.85146558542264 | 3523843.7238600175 | 36384 | | | | PCIe Residency Gen 4 (%) [0] (%) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | PCIe Residency L0 (%) [0] (%) | 100.0 | 19:29:01.189 | 99.9974 | 20:40:54.996 | 99.99928975374357 | 3638374.158400206 | 36384 | | | | PCIe Residency L0s (%) [0] (%) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | PCIe Residency L1 (%) [0] (%) | 0.0 | 19:29:01.189 | 0.0 | 19:29:01.189 | 0.0 | 0.0 | 36384 | | | | Fan PWM reading [%] [0] (%) | 60.0 | 19:32:11.820 | 0.0 | 19:29:01.189 | 48.993568601583114 | 1782582.0 | 36384 | | | | mclk[0] (MHz) | 32327430.0 | 01:14:48.400 | 101.0 | 19:29:01.189 | 1728.383577494984 | 62883779.7 | 36383 | | | | sclk[0] (MHz) | 2084.0 | 22:58:23.259 | 796.0 | 19:56:22.313 | 1914.0741829975539 | 69639761.0 | 36383 | | | +------------------------------------+------------+--------------+-----------+--------------+--------------------+--------------------+-------+ | | | | 请按任意键继续. . .COPY |
|