private double[] _results; // global place to store the workload results for verification #endregion public ParallelInvokeTest(ParallelInvokeTestParameters parameters) { _count = parameters.Count; _actionType = parameters.ActionType; _actions = new Action[_count]; _results = new double[_count]; // initialize actions for (int i = 0; i < _count; i++) { int iCopy = i; if (_actionType == ActionType.Empty) { _actions[i] = new Action(delegate { }); } else if (_actionType == ActionType.EqualWorkload) { _actions[i] = new Action(delegate { _results[iCopy] = ZetaSequence(SEED); }); } else { _actions[i] = new Action(delegate { _results[iCopy] = ZetaSequence((iCopy + 1) * SEED); }); } } }
private double[] _results; // global place to store the workload results for verication #endregion public ParallelInvokeTest(ParallelInvokeTestParameters parameters) { _count = parameters.Count; _actionType = parameters.ActionType; _actions = new Action[_count]; _results = new double[_count]; // intialize actions for (int i = 0; i < _count; i++) { int iCopy = i; if (_actionType == ActionType.Empty) { _actions[i] = new Action(delegate { }); } else if (_actionType == ActionType.EqualWorkload) { _actions[i] = new Action(delegate { _results[iCopy] = ZetaSequence(SEED); }); } else { _actions[i] = new Action(delegate { _results[iCopy] = ZetaSequence((iCopy + 1) * SEED); }); } } }
public static void ParallelInvoke11() { ParallelInvokeTestParameters parameters = new ParallelInvokeTestParameters { Count = 97, ActionType = ActionType.EqualWorkload, }; ParallelInvokeTest test = new ParallelInvokeTest(parameters); test.RealRun(); }
public static void ParallelInvoke7() { ParallelInvokeTestParameters parameters = new ParallelInvokeTestParameters { Count = 97, ActionType = ActionType.Empty, }; ParallelInvokeTest test = new ParallelInvokeTest(parameters); test.RealRun(); }
public static void ParallelInvoke2() { ParallelInvokeTestParameters parameters = new ParallelInvokeTestParameters { Count = 10, ActionType = ActionType.DifferentWorkload, }; ParallelInvokeTest test = new ParallelInvokeTest(parameters); test.RealRun(); }