Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Add python library for loading/parsing output #3

Open
powerjg opened this issue Nov 6, 2020 · 2 comments
Open

Add python library for loading/parsing output #3

powerjg opened this issue Nov 6, 2020 · 2 comments

Comments

@powerjg
Copy link
Contributor

powerjg commented Nov 6, 2020

I've investigated a number of code generation libraries, and none of them seem to be able to deal with our schema. However, I think that writing a simple python library that we manually keep in sync with the schema will not be too much of an overhead.

In fact, I can imagine implementing new features in the python library based on non-standard specializations and then backporting these specializations into the schema.

@powerjg
Copy link
Contributor Author

powerjg commented Dec 11, 2020

An initial library has been added in python/. There's still work to do, though:

  • Add comments

  • Add a stats-schema/python/tests directory with unittests

  • Add a note in the readme on how to run mypy

  • Add unittests that load stats-schema/tests/*.json and make sure they work/fail as they should

  • Add documentation on the different init functions and the load functions

  • Add distribution type

  • Add str and/or repr functions for everything

  • Add dump functions

  • Clean up style (e.g., line length)?

@powerjg
Copy link
Contributor Author

powerjg commented Dec 11, 2020

I tested the following, and it works:

from simstats import *
import json
with open('../tests/examples/v-full.json') as f:
  d = json.load(f)
stats = SimStat.load(d)
print(stats.my_system.cpus[0].tlb.data_hits.value)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant