Haskell程序以编程方式获取编译器args?

时间:2016-02-15 02:28:24

标签: debugging haskell stack-trace compiler-options

是否有可能在Haskell中以编程方式获取编译器args?

我正在编写堆栈跟踪格式库,我发现在编译时是否使用“-prof”和“-fprof-auto”非常有用。

1 个答案:

答案 0 :(得分:1)

也许GHC.RTS.Flags.getProfFlags提供了足够的信息?

没有分析:

ProfFlags {doHeapProfile = NoHeapProfiling, 
           heapProfileInterval = 100000000, heapProfileIntervalTicks = 10,
           includeTSOs = False, showCCSOnException = False, 
           maxRetainerSetSize = 0, ccsLength = 0, modSelector = Nothing, 
           descrSelector = Nothing, typeSelector = Nothing, ccSelector = Nothing,
           ccsSelector = Nothing, retainerSelector = Nothing, bioSelector = Nothing}

使用-prof

ProfFlags {doHeapProfile = NoHeapProfiling, heapProfileInterval = 100000000,
           heapProfileIntervalTicks = 100, includeTSOs = False,
           showCCSOnException = False, maxRetainerSetSize = 107374182408,
           ccsLength = 25, modSelector = Nothing, descrSelector = Nothing, 
           typeSelector = Nothing, ccSelector = Nothing, ccsSelector = Nothing,
           retainerSelector = Nothing, bioSelector = Nothing}

我猜这些是动态参数,但它们似乎受到-prof的影响。所以,也许它足以满足你的目的(?)