1 Star 0 Fork 0

李浩德/gstreamer-benchmarks

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
tabulate_results.py 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
try:
from tabulate import tabulate
except Exception:
print('You need to install python-tabulate: sudo pip install tabulate')
sys.exit()
try:
fname = sys.argv[1]
if not os.path.isfile(fname):
print('File %s not found' % fname)
sys.exit()
except Exception:
print('Provide tsv file as argument')
sys.exit()
try:
MAX_LEN = int(sys.argv[2])
except Exception:
MAX_LEN = 30
def limit_size(string, max_len = MAX_LEN):
if len(string) > max_len:
return string[:max_len] + '..'
return string
with open(fname, 'r') as f:
d = f.read()
tabulate_list = []
for index, line in enumerate(d.split('\n')):
if index > 0:
fields = [limit_size(f.strip()) for f in line.split('\t')]
tabulate_list.append(fields)
else:
print('\n' + line + '\n')
t = tabulate(tabulate_list, headers="firstrow", tablefmt="simple", stralign="center", numalign="center")
print(t)
print("\nTable is %s lines wide" % len(t.split('\n')[0]))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/socratesa/gstreamer-benchmarks.git
git@gitee.com:socratesa/gstreamer-benchmarks.git
socratesa
gstreamer-benchmarks
gstreamer-benchmarks
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385