diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2019-04-04 12:46:33 +0200 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2019-04-04 12:46:33 +0200 |
commit | 6e629e9ccd58be36fcc858d357cdf0811bdcb380 (patch) | |
tree | c39f36c7ce91da4a8b60164169038db4979f34e0 /src/vm/gcenv.os.cpp | |
parent | dd80afe98f969e3a309917643c0e45e83aaa37bf (diff) | |
download | coreclr-6e629e9ccd58be36fcc858d357cdf0811bdcb380.tar.gz coreclr-6e629e9ccd58be36fcc858d357cdf0811bdcb380.tar.bz2 coreclr-6e629e9ccd58be36fcc858d357cdf0811bdcb380.zip |
Modify affinity range config format for Windows
Each entry has to be prefixed by group number followed by comma. There
is nothing like global CPU index on Windows, all the APIs that support
more than 64 processors use group, in-group index pair. So specifying
the affinity this way matches what users are used to.
Diffstat (limited to 'src/vm/gcenv.os.cpp')
-rw-r--r-- | src/vm/gcenv.os.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp index 243b8979ed..909319889e 100644 --- a/src/vm/gcenv.os.cpp +++ b/src/vm/gcenv.os.cpp @@ -912,6 +912,55 @@ bool GCToOSInterface::GetProcessorForHeap(uint16_t heap_number, uint16_t* proc_n return success; } +// Parse the confing string describing affinitization ranges and update the passed in affinitySet accordingly +// Parameters: +// config_string - string describing the affinitization range, platform specific +// start_index - the range start index extracted from the config_string +// end_index - the range end index extracted from the config_string, equal to the start_index if only an index and not a range was passed in +// Return: +// true if the configString was successfully parsed, false if it was not correct +bool GCToOSInterface::ParseGCHeapAffinitizeRangesEntry(const char** config_string, size_t* start_index, size_t* end_index) +{ + size_t index_offset = 0; + + char* number_end; + size_t group_number = strtoul(*config_string, &number_end, 10); + + if ((number_end == *config_string) || (*number_end != ':')) + { + // No number or no colon after the number found, invalid format + return false; + } + + WORD group_begin; + WORD group_size; + if (!CPUGroupInfo::GetCPUGroupRange((WORD)group_number, &group_begin, &group_size)) + { + // group number out of range + return false; + } + + index_offset = group_begin; + *config_string = number_end + 1; + + size_t start, end; + if (!ParseIndexOrRange(config_string, &start, &end)) + { + return false; + } + + if ((start >= group_size) || (end >= group_size)) + { + // Invalid CPU index values or range + return false; + } + + *start_index = index_offset + start; + *end_index = index_offset + end; + + return true; +} + // Initialize the critical section void CLRCriticalSection::Initialize() { |