A simple parser to parse the text output from pibench
npm install pibench-parserA simple parser to parse the text output from pibench.
stdout and stderr.We sometimes need to process hundreds of such text files, thus need a programmatic way to extract the useful information.
rust
let data = PiBenchData::from_text(text);
`Work with Javascript/NodeJS
`bash
npm install pibench-parser
``js
import { PiBenchData } from "pibench-parser";
const text = "YOUR PIBENCH RESULT";
const result = PiBenchData.from_text(text).to_js_value();
`Work with Python
`python
import ctypes
from ctypes import c_char_p, c_void_p, CDLLso_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)
``