in rts/RtsFlags.c [1609:1704]
static void normaliseRtsOpts (void)
{
if (RtsFlags.MiscFlags.tickInterval < 0) {
RtsFlags.MiscFlags.tickInterval = DEFAULT_TICK_INTERVAL;
}
// If the master timer is disabled, turn off the other timers.
if (RtsFlags.MiscFlags.tickInterval == 0) {
RtsFlags.ConcFlags.ctxtSwitchTime = 0;
RtsFlags.GcFlags.idleGCDelayTime = 0;
RtsFlags.ProfFlags.heapProfileInterval = 0;
}
// Determine what tick interval we should use for the RTS timer
// by taking the shortest of the various intervals that we need to
// monitor.
if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) {
RtsFlags.MiscFlags.tickInterval =
stg_min(RtsFlags.ConcFlags.ctxtSwitchTime,
RtsFlags.MiscFlags.tickInterval);
}
if (RtsFlags.GcFlags.idleGCDelayTime > 0) {
RtsFlags.MiscFlags.tickInterval =
stg_min(RtsFlags.GcFlags.idleGCDelayTime,
RtsFlags.MiscFlags.tickInterval);
}
if (RtsFlags.ProfFlags.heapProfileInterval > 0) {
RtsFlags.MiscFlags.tickInterval =
stg_min(RtsFlags.ProfFlags.heapProfileInterval,
RtsFlags.MiscFlags.tickInterval);
}
if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) {
RtsFlags.ConcFlags.ctxtSwitchTicks =
RtsFlags.ConcFlags.ctxtSwitchTime /
RtsFlags.MiscFlags.tickInterval;
} else {
RtsFlags.ConcFlags.ctxtSwitchTicks = 0;
}
if (RtsFlags.ProfFlags.heapProfileInterval > 0) {
RtsFlags.ProfFlags.heapProfileIntervalTicks =
RtsFlags.ProfFlags.heapProfileInterval /
RtsFlags.MiscFlags.tickInterval;
} else {
RtsFlags.ProfFlags.heapProfileIntervalTicks = 0;
}
if (RtsFlags.GcFlags.stkChunkBufferSize >
RtsFlags.GcFlags.stkChunkSize / 2) {
errorBelch("stack chunk buffer size (-kb) must be less than 50%%\n"
"of the stack chunk size (-kc)");
errorUsage();
}
if (RtsFlags.GcFlags.maxHeapSize != 0 &&
RtsFlags.GcFlags.heapSizeSuggestion >
RtsFlags.GcFlags.maxHeapSize) {
RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
}
if (RtsFlags.GcFlags.maxHeapSize != 0 &&
RtsFlags.GcFlags.minAllocAreaSize >
RtsFlags.GcFlags.maxHeapSize) {
errorBelch("maximum heap size (-M) is smaller than minimum alloc area size (-A)");
RtsFlags.GcFlags.minAllocAreaSize = RtsFlags.GcFlags.maxHeapSize;
}
// If we have -A16m or larger, use -n4m.
if (RtsFlags.GcFlags.minAllocAreaSize >= (16*1024*1024) / BLOCK_SIZE) {
RtsFlags.GcFlags.nurseryChunkSize = (4*1024*1024) / BLOCK_SIZE;
}
if (RtsFlags.ParFlags.parGcLoadBalancingGen == ~0u) {
StgWord alloc_area_bytes
= RtsFlags.GcFlags.minAllocAreaSize * BLOCK_SIZE;
// If allocation area is larger that CPU cache
// we can finish scanning quicker doing work-stealing
// scan. Trac #9221
// 32M looks big enough not to fit into L2 cache
// of popular modern CPUs.
if (alloc_area_bytes >= 32 * 1024 * 1024) {
RtsFlags.ParFlags.parGcLoadBalancingGen = 0;
} else {
RtsFlags.ParFlags.parGcLoadBalancingGen = 1;
}
}
// We can't generate dumps without signal handlers
if (RtsFlags.MiscFlags.generate_dump_file) {
RtsFlags.MiscFlags.install_seh_handlers = true;
}
}