11

There is a nice example of HTML output from criterion at http://bos.github.com/criterion/.

Which command line option is used to generate this output?

An answer to a related question asserts that this output exits, but it does not seem to show up in the command line options when using --help.

Community
  • 1
  • 1
danr
  • 2,405
  • 23
  • 24

3 Answers3

6

Sorry I didn't get around to your comment-question.

The answer Jedai gives is right - just use -o. For example, here is a line from one of my Makefiles for running benchmarks using defaultMain from Criterion:

./Bench -g -u Bench.csv -o Bench.html -s $(SAMPLES)

Breaking that down, it says:

-g    run GC between each sample
-u    output CSV data to the given file
-o    output HTML data to the given file
-s    collect this many samples
Thomas M. DuBuisson
  • 64,245
  • 7
  • 109
  • 166
  • Thanks for the -g option that did a great job for me and I got rid of many inconsistencies when using criterion. – J Fritsch Mar 17 '12 at 19:44
5

Well if you just want html output, then yourBench -o yourReport.html will generate some perfectly reasonable output. If you want to use your own template, look at the templates/report.tpl example in the distribution and use the -t option.

Jedai
  • 1,477
  • 9
  • 13
  • Nice! I just skipped the, for me, unknown `.tpl` extension, but now I have learnt about the interesting library [mustache](http://mustache.github.com/) with Haskell bindings as [hastache](http://hackage.haskell.org/package/hastache-0.3.3). – danr Mar 17 '12 at 06:26
1

It seems to me that you just pass the template as a command line option, and then it populates it. If the template happens to be an html template, then you've generated html.

See the source here: https://github.com/bos/criterion

sclv
  • 38,665
  • 7
  • 99
  • 204
  • I have looked at the source code, but I cannot find it. How do you pass "the template" as a command line option? – danr Mar 16 '12 at 18:29
  • @danr If --help isn't telling you (and it should) then just see the source for [Main.hs](https://github.com/bos/criterion/blob/master/Criterion/Main.hs) and search for `defaultOptions` or `template`. you should see the `-t` option (which is just `t` in the options list). – Thomas M. DuBuisson Mar 17 '12 at 20:10
  • @ThomasM.DuBuisson : Yes, thank you, I just didn't associate "template" with "HTML Output". Maybe this association should be obvious, but it isn't for me. – danr Mar 17 '12 at 22:06