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

Machine readable and/or machine friendly output #340

Closed
ericpruitt opened this issue Jan 17, 2020 · 2 comments
Closed

Machine readable and/or machine friendly output #340

ericpruitt opened this issue Jan 17, 2020 · 2 comments
Labels

Comments

@ericpruitt
Copy link

I'm working on automating system performance tests, and I'm using sysbench for some of the benchmarking. One issue I've run into is that the output isn't machine readable, so I've written code that reads the output generated by sysbench and reformats it to JSON. This works well enough, but I had to modify sysbench to get more accurate metrics; I've replaced all format strings based on %f with %g because when there are things like %12.4f, small values essentially get elided or, in the context of the histogram data, become indistinguishable from other small values:

>>> "%12.4f" % .000000123456
'      0.0000'
>>> "%g" % .000000123456
'1.23456e-07'

I was wondering if you have any plans to make make the test output machine readable, and if not, whether you would accept such a patch or even a patch that would allow the user to toggle output precision.

@akopytov
Copy link
Owner

Have you seen JSON reporter in sysbench 1.0+? I guess it is an answer to the question on a machine-reable format https://github.com/akopytov/sysbench/blob/master/src/lua/internal/sysbench.lua#L91

As to precision, the reporter API in sysbench 1.0 is created precisely to make it customizable in Lua without changing sysbench code. If that doesn't work in some case, or is complicated for whatever reasons, I'm happy to accept patches too.

@rualark
Copy link

rualark commented Jun 11, 2022

Is there a way to run sysbench from command line and get json output to console or file with parameter like --format=json without using additional technologies (e.g. lua)?

I see that there is a recommendation to add this to script:
sysbench.hooks.report_intermediate = sysbench.report_json

Can it be added to shell script before running sysbench like this:

sysbench.hooks.report_intermediate = sysbench.report_json
./sysbench cpu run

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

No branches or pull requests

3 participants