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

Remove "preamble" from csv output? #794

Closed
nickaleks opened this issue Apr 13, 2019 · 7 comments
Closed

Remove "preamble" from csv output? #794

nickaleks opened this issue Apr 13, 2019 · 7 comments

Comments

@nickaleks
Copy link

Currently, when we want to benchmark output in a csv file, this "preamble" is inserted in the beginning.

2019-04-13 17:34:34
Running /home/path/to/exe
Run on (8 X 4000 MHz CPU s)
CPU Caches:
  L1 Data 32K (x4)
  L1 Instruction 32K (x4)
  L2 Unified 256K (x4)
  L3 Unified 8192K (x1)

This obviously trips up any csv parser and has to be removed each time the benchmark is run. This is annoying and would be great if it was possible to disable that output when using a structured output format.

@LebedevRI
Copy link
Collaborator

Please note that CSV reporter is deprecated, and will be removed sometime in the future
Simple, correct solution: https://github.com/google/benchmark#output-files + JSON

@nickaleks
Copy link
Author

It is very sad to hear that. CSV is a more native format for any statistical analysis tool. I know it's easy to get csv from JSON, but its just one more extra step.

@LebedevRI
Copy link
Collaborator

True. Sadly CSV isn't quite flexible enough, in the end.
This isn't the first time that was discussed.

Did the JSON solution work?

@dmah42
Copy link
Member

dmah42 commented Apr 15, 2019

We make a distinction between the output and error streams. The context is sent to the error stream while the run data is sent to the output stream. Are you writing to file by redirect in the shell or using the library to output to a file?

@LebedevRI
Copy link
Collaborator

We make a distinction between the output and error streams. The context is sent to the error stream while the run data is sent to the output stream. Are you writing to file by redirect in the shell or using the library to output to a file?

Very interesting. I did look into that before original reply but it looked to me all those streams in the end were dumped into the same output. Looks like that isn't so for console reporter, but is so for file reporter.
That is, if you do

./bench --benchmark_format=csv --benchmark_out_format=csv --benchmark_out=real > out

you will get only the CSV in out, only "preambule" in console, and both the preambule and CSV in real..

@dmah42
Copy link
Member

dmah42 commented Apr 15, 2019

ah. that might be a bug. perhaps we should ensure output goes to the file and stdout and error goes to stderr? :)

@nickaleks
Copy link
Author

We make a distinction between the output and error streams. The context is sent to the error stream while the run data is sent to the output stream. Are you writing to file by redirect in the shell or using the library to output to a file?

I write directly to a file using --benchmark_out.

True. Sadly CSV isn't quite flexible enough, in the end.
This isn't the first time that was discussed.

Did the JSON solution work?

I've just manually removed the extra lines, since it was a one time job. Next time would definitely use JSON though. Thank you for the help.

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

No branches or pull requests

3 participants