2012-03-16 36 views

回答

5

那麼如果你只是想HTML輸出,然後yourBench -o yourReport.html會產生一些非常合理的輸出。如果您想使用自己的模板,請查看發行版中的templates/report.tpl示例,並使用-t選項。

+0

不錯!我剛剛跳過了對我來說未知的'.tpl'擴展名,但現在我已經學習了有趣的庫[mustache](http://mustache.github.com/),並將Haskell綁定爲[hastache](http:/ /hackage.haskell.org/package/hastache-0.3.3)。 – danr 2012-03-17 06:26:03

1

在我看來,你只是通過模板作爲命令行選項,然後它填充它。如果模板碰巧是一個html模板,那麼您已經生成了html。

在這裏看到的來源:https://github.com/bos/criterion

+0

我看過的源代碼,但我找不到。你如何通過「模板」作爲命令行選項? – danr 2012-03-16 18:29:13

+0

@danr如果--help沒有告訴你(它應該),那麼只需查看[Main.hs]的源代碼(https://github.com/bos/criterion/blob/master/Criterion/Main.hs )並搜索'defaultOptions'或'template'。你應該看到'-t'選項(在選項列表中只是't')。 – 2012-03-17 20:10:07

+0

@ ThomasM.DuBuisson:是的,謝謝,我只是沒有將「模板」與「HTML輸出」關聯起來。也許這種關聯應該是顯而易見的,但它不適合我。 – danr 2012-03-17 22:06:19

5

對不起,我沒有看到你的評論問題。

Jedai給出的答案是正確的 - 只是使用-o。例如,下面是一個使用defaultMain從標準從我的Makefile的運行基準的一個行:

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

打破了下來,說:

-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 
+0

感謝-g選項,爲我做了很棒的工作,並且在使用標準時擺脫了許多不一致之處。 – 2012-03-17 19:44:57