Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/coreclr/inc/clrconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class CLRConfig

// Remove any whitespace at beginning and end of value. (Only applicable for
// *string* configuration values.)
TrimWhiteSpaceFromStringValue = 0x2
TrimWhiteSpaceFromStringValue = 0x2,

// The configuration should be parsed using a 10 radix as opposed to the
// default of 16.
ParseIntegerAsBase10 = 0x4,
};

// Struct used to store information about where/how to find a Config DWORD.
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_Thread_DeadThreadCountThresholdForGCTrigger, W
RETAIL_CONFIG_DWORD_INFO(INTERNAL_Thread_DeadThreadGCTriggerPeriodMilliseconds, W("Thread_DeadThreadGCTriggerPeriodMilliseconds"), 1000 * 60 * 30, "In the heuristics to clean up dead threads, this much time must have elapsed since the previous max-generation GC before triggering another GC will be considered")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Thread_UseAllCpuGroups, W("Thread_UseAllCpuGroups"), 0, "Specifies whether to query and use CPU group information for determining the processor count.")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Thread_AssignCpuGroups, W("Thread_AssignCpuGroups"), 1, "Specifies whether to automatically distribute threads created by the CLR across CPU Groups. Effective only when Thread_UseAllCpuGroups and GCCpuGroup are enabled.")
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProcessorCount, W("PROCESSOR_COUNT"), 0, "Specifies the number of processors available for the process, which is returned by Environment.ProcessorCount")
RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_ProcessorCount, W("PROCESSOR_COUNT"), 0, "Specifies the number of processors available for the process, which is returned by Environment.ProcessorCount", CLRConfig::LookupOptions::ParseIntegerAsBase10)

///
/// Threadpool
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/utilcode/clrconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,16 @@ namespace

FAULT_NOT_FATAL(); // We don't report OOM errors here, we return a default value.

int radix = CheckLookupOption(options, LookupOptions::ParseIntegerAsBase10)
? 10
: 16; // Parse as hex by default.

NewArrayHolder<WCHAR> val = EnvGetString(name, options);
if (val != NULL)
{
errno = 0;
LPWSTR endPtr;
DWORD configMaybe = wcstoul(val, &endPtr, 16); // treat it has hex
DWORD configMaybe = wcstoul(val, &endPtr, radix);
BOOL fSuccess = ((errno != ERANGE) && (endPtr != val));
if (fSuccess)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private static unsafe int ParseProcessorCount(string settingValue)
fixed (char *ptr = settingValue)
{
char *endptr;
int value = (int)wcstoul(ptr, &endptr, 16);
int value = (int)wcstoul(ptr, &endptr, 10);

if (0 < value && value <= MAX_PROCESSOR_COUNT)
return value;
Expand Down Expand Up @@ -69,7 +69,7 @@ public void ProcessorCount_Windows_MatchesGetSystemInfo()
[InlineData(8000, 2000, null)]
[InlineData(8000, 0, "1")]
[InlineData(2000, 0, null)]
[InlineData(2000, 0, " 0x11 ")]
[InlineData(2000, 0, " 17 ")]
[InlineData(0, 0, "3")]
public static unsafe void ProcessorCount_Windows_RespectsJobCpuRateAndConfigurationSetting(
ushort maxRate, ushort minRate, string procCountConfig)
Expand Down