【发布时间】:2016-02-15 02:28:23
【问题描述】:
是否可以在 Haskell 中以编程方式获取编译器参数?
我正在编写一个堆栈跟踪格式化库,我会发现在编译时知道是否使用了“-prof”和“-fprof-auto”非常有用。
【问题讨论】:
-
据我所知,没有。 RTS 选项有一个接口,但编译器选项没有。
标签: debugging haskell stack-trace compiler-options
是否可以在 Haskell 中以编程方式获取编译器参数?
我正在编写一个堆栈跟踪格式化库,我会发现在编译时知道是否使用了“-prof”和“-fprof-auto”非常有用。
【问题讨论】:
标签: debugging haskell stack-trace compiler-options
也许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 的影响。所以,也许这对你的目的就足够了(?)
【讨论】: