4 releases

0.1.7 Jun 7, 2020
0.1.6 Jun 7, 2020
0.1.2 Jun 5, 2020
0.1.1 May 26, 2020

#3 in #persistent-memory

Download history 9/week @ 2024-04-01 53/week @ 2024-07-08

53 downloads per month

MIT license

21KB
423 lines

PiBench Output Parser

npm version MIT licensed

A simple parser to parse the text output from pibench.

Why

Current PiBench does not support json/csv output yet; it prints the output to stdout and stderr.

We sometimes need to process hundreds of such text files, thus need a programmatic way to extract the useful information.

Plan

  1. A shared library that can be called from Python. ✔️
  2. A Webassembly version to support pibench-online. ✔️
  3. Native rust version for pibench backend server. ✔️

Usage (Rust)

let data = PiBenchData::from_text(text);

Work with 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();

Work with 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)

Dependencies

~3–7MB
~130K SLoC