本文整理汇总了C#中IConfig.?.GetJobs方法的典型用法代码示例。如果您正苦于以下问题:C# IConfig.?.GetJobs方法的具体用法?C# IConfig.?.GetJobs怎么用?C# IConfig.?.GetJobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConfig
的用法示例。
在下文中一共展示了IConfig.?.GetJobs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypeToBenchmarks
public static IList<Benchmark> TypeToBenchmarks(Type type, IConfig config = null)
{
config = GetFullConfig(type, config);
var allMethods = type.GetMethods();
var setupMethod = GetSetupMethod(allMethods);
var targetMethods = allMethods.Where(method => method.HasAttribute<BenchmarkAttribute>()).ToArray();
var parameterDefinitions = GetParameterDefinitions(type);
var parameterInstancesList = parameterDefinitions.Expand();
var rawJobs = config?.GetJobs().ToArray() ?? new IJob[0];
if (rawJobs.IsEmpty())
rawJobs = new[] { Job.Default };
var jobs = rawJobs.ToArray();
var targets = GetTargets(targetMethods, type, setupMethod).ToArray();
return (
from target in targets
from job in jobs
from parameterInstancese in parameterInstancesList
select new Benchmark(target, job, parameterInstancese)).ToSortedList();
}
示例2: MethodsToBenchmarks
public static Benchmark[] MethodsToBenchmarks(Type containingType, MethodInfo[] methods, IConfig config = null)
{
var setupMethod = GetSetupMethod(methods);
var targetMethods = methods.Where(method => method.HasAttribute<BenchmarkAttribute>()).ToArray();
var parameterDefinitions = GetParameterDefinitions(containingType);
var parameterInstancesList = parameterDefinitions.Expand();
var rawJobs = config?.GetJobs().ToArray() ?? new IJob[0];
if (rawJobs.IsEmpty())
rawJobs = new[] { Job.Default };
var jobs = rawJobs.Distinct().ToArray();
var targets = GetTargets(targetMethods, containingType, setupMethod).ToArray();
var benchmarks = (
from target in targets
from job in jobs
from parameterInstance in parameterInstancesList
select new Benchmark(target, job, parameterInstance)).ToArray();
var orderProvider = config?.GetOrderProvider() ?? DefaultOrderProvider.Instance;
return orderProvider.GetExecutionOrder(benchmarks).ToArray();
}