Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add json option. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add json option. #6

wants to merge 1 commit into from

Conversation

seagreen
Copy link

No description provided.

@seagreen
Copy link
Author

First question: how do you feel about the structure of the output?

Example output for the command chronos 'sleep 0.1' 'sleep 0.2' --timeout 0.5 --json:

{"sleep 0.2":{"mean":{"denominator":2000000000,"numerator":407070367},"squared-weights":2,"samples":2,"q-factor":{"denominator":2000000000000000000,"numerator":2931247881}},"sleep 0.1":{"mean":{"denominator":2000000000,"numerator":207569483},"squared-weights":2,"samples":2,"q-factor":{"denominator":2000000000000000000,"numerator":34338684249}}}

Or, prettified:

{
  "sleep 0.2": {
    "mean": {
      "denominator": 2000000000,
      "numerator": 407070367
    },
    "squared-weights": 2,
    "samples": 2,
    "q-factor": {
      "denominator": 2e+18,
      "numerator": 2931247881
    }
  },
  "sleep 0.1": {
    "mean": {
      "denominator": 2000000000,
      "numerator": 207569483
    },
    "squared-weights": 2,
    "samples": 2,
    "q-factor": {
      "denominator": 2e+18,
      "numerator": 34338684249
    }
  }
}

One thing that might be improved is the encoding of rationals.

@knupfer
Copy link
Owner

knupfer commented Mar 21, 2019

I think that's quite good. One thing to think of is that this wouldn't allow for consumption of intermediate results, so we could instead print out a lazy list of objects and if the user likes to get only one output he has to combine it with print-once.

@seagreen
Copy link
Author

I like that idea. I think it will make the code a little nicer too. I'll update the PR when I get a chance.

@seagreen
Copy link
Author

Got busy and am going to abandon this, hopefully someone else can pick it up.

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

Successfully merging this pull request may close these issues.

2 participants