public TestParameters(API api, StartIndexBase startIndexBase, int?startIndexOffset = null) { Api = api; StartIndexBase = startIndexBase; StartIndexOffset = startIndexOffset ?? DEFAULT_STARTINDEXOFFSET; if (api == API.For64) { // StartIndexBase.Int64 was set to -1 since Enum can't take a Int64.MaxValue. Fixing this below. long indexBase64 = (startIndexBase == StartIndexBase.Int64) ? long.MaxValue : (long)startIndexBase; StartIndex64 = indexBase64 + StartIndexOffset; } else { // startIndexBase must not be StartIndexBase.Int64 StartIndex = (int)startIndexBase + StartIndexOffset; } WorkloadPattern = WorkloadPattern.Similar; // setting defaults. Count = 0; ChunkSize = -1; StateOption = ActionWithState.None; LocalOption = ActionWithLocal.None; ParallelOption = WithParallelOption.None; //partitioner options ParallelForeachDataSourceType = DataSourceType.Collection; PartitionerType = PartitionerType.IListBalancedOOB; }
public static void ParrallelFor(API api, StartIndexBase startIndexBase, int count, WithParallelOption parallelOption, ActionWithState stateOption, ActionWithLocal localOption) { var parameters = new TestParameters(api, startIndexBase) { Count = count, ParallelOption = parallelOption, StateOption = stateOption, LocalOption = localOption }; var test = new ParallelForTest(parameters); test.RealRun(); }
public static void TestForeach_Partitioner(int count, int chunkSize, PartitionerType partitionerType, WithParallelOption parallelOption, ActionWithLocal localOption, ActionWithState stateOption) { var parameters = new TestParameters(API.Foreach, StartIndexBase.Zero) { Count = count, ChunkSize = chunkSize, PartitionerType = partitionerType, ParallelForeachDataSourceType = DataSourceType.Partitioner, ParallelOption = parallelOption, LocalOption = localOption, StateOption = stateOption, }; var test = new ParallelForTest(parameters); test.RealRun(); }