4 个版本
0.1.7 | 2020年6月7日 |
---|---|
0.1.6 | 2020年6月7日 |
0.1.2 | 2020年6月5日 |
0.1.1 | 2020年5月26日 |
在 #persistent-memory 中排名第 3
每月下载量 53 次
21KB
423 行(不包括注释)
PiBench 输出解析器
一个简单的解析器,用于解析来自 pibench 的文本输出。
为什么
当前的 PiBench 还不支持 json/csv 输出;它将输出打印到 stdout
和 stderr
。
我们有时需要处理数百个这样的文本文件,因此需要一种程序化方式来提取有用的信息。
计划
- 一个可以从 Python 调用的共享库。✔️
- 支持 pibench-online 的 Webassembly 版本。✔️
- 为 pibench 后端服务器提供的本地 Rust 版本。✔️
使用方法(Rust)
let data = PiBenchData::from_text(text);
与 Javascript/NodeJS 一起工作
npm install pibench-parser
import { PiBenchData } from "pibench-parser";
const text = "YOUR PIBENCH RESULT";
const result = PiBenchData.from_text(text).to_js_value();
与 Python 一起工作
import ctypes
from ctypes import c_char_p, c_void_p, CDLL
so_file = "/path/to/libpibench_parser.so"
functions = CDLL(so_file)
def text_to_json(text):
json_str = functions.text_to_json(text.encode("utf-8"))
try:
return ctypes.cast(json_str, c_char_p).value.decode("utf-8")
finally:
functions.free_json_str(json_str)
依赖关系
~3–7MB
~130K SLoC