1 Star 1 Fork 0

ArchShineZ/gem5_data_proc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
st_stat.py 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
ArchShineZ 提交于 2021-02-28 11:33 . Track all...
#!/usr/bin/env python3.6
import os
from os.path import join as pjoin
import pandas as pd
from utils import common as c
from paths import st_stat_dir
def regenerate_st_stat(pairs: list, cache: str) -> None:
st_targets = [
'system\.cpu\.(ipc::0)',
]
matrix = {}
for p in pairs:
matrix[p] = c.get_stats(pjoin(st_stat_dir, p, 'stats.txt'),
st_targets, re_targets=True)
df = pd.DataFrame(matrix)
df.to_csv(cache, index=True)
df = pd.read_csv(cache, index_col=0)
print(df)
def make_st_stat_cache() -> None:
pairs = c.pairs(st_stat_dir, False)
stat_files = [pjoin(st_stat_dir, x, 'stats.txt') \
for x in pairs]
stat_timestamps = [os.path.getmtime(x) for x in stat_files]
newest = max(stat_timestamps)
script = os.path.realpath(__file__)
cache_file = pjoin(os.path.dirname(script), 'cache_st_stat.txt')
if not os.path.isfile(cache_file) or \
newest > os.path.getmtime(cache_file) or \
os.path.getmtime(script) > os.path.getmtime(cache_file):
regenerate_st_stat(pairs, cache_file)
if __name__ == '__main__':
make_st_stat_cache()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/ArchShineZ/gem5_data_proc.git
git@gitee.com:ArchShineZ/gem5_data_proc.git
ArchShineZ
gem5_data_proc
gem5_data_proc
graphmaker

搜索帮助

0d507c66 1850385 C8b1a773 1850385