0

I understand from here that to use ThreadScope I need to compile with an eventlog and rtsoptions, eg "-rtsopts -eventlog -threaded"

I am using Stack, so my compilation call looks like:

$ stack ghc -- -O2 -funfolding-use-threshold=16 -optc-O3 -rtsopts -eventlog -threaded mycoolprogram.hs

Whereas normally, I do:

$ stack ghc -- -O2 -funfolding-use-threshold=16 -optc-O3 -threaded mycoolprogram.hs

This compiles fine. However, my program takes 2 and only 2 positional arguments:

./mycoolprogram arg1 arg2

I'm trying to add the RTS options +RTS -N2 -l, like so:

./mycoolprogram arg1 arg2 -- +RTS -N2 -l 

Or

./mycoolprogram +RTS -N2 -l -- arg1 arg2

How can I simultaneously run my program with arguments going into System.Environment.getArgs (like eg here) and also include these profiling flags?

4

1 回答 1

2

正如@sjakobi 所说,您可以使用+RTS ... -RTS other argumentsorother arguments +RTS ...表单,但也可以选择将它们传递到环境变量中GHCRTS

GHCRTS='-N2 -l' ./mycoolprogram arg1 arg2

GHC 用户指南中提供了丢失的更多信息。

于 2017-01-29T02:34:06.067 回答