void RunTestInParallel() { _accumulator = new Accumulator(); Action[] works = new Action[_threadCount]; for (int i = 0; i < _threadCount; i++) { works[i] = RecordElapsed; } ThreadingHelper.RunWorksInParallel(works); Console.WriteLine("{0,23}.{1,-18} (ns):{2,6} Average,{3,6} Minimal,{4,6} Maxmial,{5,3} Threads", _atomic.GetType().Name, _action.Method.Name, _accumulator.Average, _accumulator.Minimal, _accumulator.Maximal, _accumulator.Count); }
private static int CompareTypes(IAtomic x, IAtomic y) { if (x.GetType() == y.GetType()) { return(0); } if (x is Compound && (y is Atom || y is Isotope)) { return(1); } if (x is Isotope) { if (y is Atom) { return(1); } if (y is Compound) { return(-1); } } if (x is Atom && (y is Isotope || y is Compound)) { return(-1); } return(0); }