Class ReflectionDiscovery
Inheritance
System.Object
ReflectionDiscovery
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: NBench.dll
Syntax
public class ReflectionDiscovery : IDiscovery
Constructors
ReflectionDiscovery(IBenchmarkOutput)
Declaration
public ReflectionDiscovery(IBenchmarkOutput output)
Parameters
ReflectionDiscovery(IBenchmarkOutput, IBenchmarkAssertionRunner, RunnerSettings)
Declaration
public ReflectionDiscovery(IBenchmarkOutput output, IBenchmarkAssertionRunner benchmarkAssertions, RunnerSettings settings)
Parameters
Fields
BenchmarkContextType
Declaration
public static readonly Type BenchmarkContextType
Field Value
Type |
Description |
System.Type |
|
MeasurementAttributeType
Declaration
public static readonly Type MeasurementAttributeType
Field Value
Type |
Description |
System.Type |
|
MeasurementConfiguratorType
Declaration
public static readonly Type MeasurementConfiguratorType
Field Value
Type |
Description |
System.Type |
|
Declaration
public static readonly Type PerformanceBenchmarkAttributeType
Field Value
Type |
Description |
System.Type |
|
Properties
BenchmarkAssertions
Declaration
public IBenchmarkAssertionRunner BenchmarkAssertions { get; }
Property Value
Output
Declaration
public IBenchmarkOutput Output { get; }
Property Value
RunnerSettings
Declaration
public RunnerSettings RunnerSettings { get; }
Property Value
Trace
Declaration
public IBenchmarkTrace Trace { get; }
Property Value
Methods
Declaration
public static IReadOnlyList<TypeInfo> ClassesWithPerformanceBenchmarks(Assembly targetAssembly)
Parameters
Type |
Name |
Description |
System.Reflection.Assembly |
targetAssembly |
The assembly we're scanning for benchmarks.
|
Returns
Type |
Description |
System.Collections.Generic.IReadOnlyList<System.Reflection.TypeInfo> |
A list of all applicable types that contain at least one method with a
PerfBenchmarkAttribute.
|
ConfiguratorSupportsMeasurement(Type, Type, Boolean)
Declaration
public static bool ConfiguratorSupportsMeasurement(Type measurementType, Type expectedConfiguratorType, bool exact = false)
Parameters
Type |
Name |
Description |
System.Type |
measurementType |
A MeasurementAttribute type.
|
System.Type |
expectedConfiguratorType |
A IMeasurementConfigurator type.
|
System.Boolean |
exact |
If true , then this method will look for an exact 1:1 type match.
If false , which is the default then this method will return true
when any applicable types are assignable from measurementType .
|
Returns
Type |
Description |
System.Boolean |
true if a match was found, false otherwise.
|
CreateBenchmarksForClass(TypeInfo)
Declaration
public static IReadOnlyList<BenchmarkClassMetadata> CreateBenchmarksForClass(TypeInfo classWithBenchmarks)
Parameters
Type |
Name |
Description |
System.Reflection.TypeInfo |
classWithBenchmarks |
|
Returns
CreateBenchmarksForClass(Type)
Declaration
public static IReadOnlyList<BenchmarkClassMetadata> CreateBenchmarksForClass(Type classWithBenchmarks)
Parameters
Type |
Name |
Description |
System.Type |
classWithBenchmarks |
|
Returns
Declaration
public static IBenchmarkInvoker CreateInvokerForBenchmark(BenchmarkClassMetadata benchmarkClass)
Parameters
Returns
Declaration
public BenchmarkSettings CreateSettingsForBenchmark(BenchmarkClassMetadata benchmarkClass)
Parameters
Returns
FindBenchmarks(Assembly)
Declaration
public IEnumerable<Benchmark> FindBenchmarks(Assembly targetAssembly)
Parameters
Type |
Name |
Description |
System.Reflection.Assembly |
targetAssembly |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Benchmark> |
|
FindBenchmarks(Type)
Declaration
public IEnumerable<Benchmark> FindBenchmarks(Type targetType)
Parameters
Type |
Name |
Description |
System.Type |
targetType |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Benchmark> |
|
Declaration
public static Type FindBestMatchingConfiguratorForMeasurement(Type measurementType, IEnumerable<Type> knownConfigurators)
Parameters
Type |
Name |
Description |
System.Type |
measurementType |
|
System.Collections.Generic.IEnumerable<System.Type> |
knownConfigurators |
|
Returns
Type |
Description |
System.Type |
|
GetCleanupMethod(TypeInfo)
Declaration
public static BenchmarkMethodMetadata GetCleanupMethod(TypeInfo classWithBenchmarks)
Parameters
Type |
Name |
Description |
System.Reflection.TypeInfo |
classWithBenchmarks |
|
Returns
Declaration
public IMeasurementConfigurator GetConfiguratorForMeasurement(Type measurementType, IAssemblyLoader specificAssembly = null)
Parameters
Returns
Declaration
public Type GetConfiguratorTypeForMeasurement(Type measurementType, IAssemblyLoader specificAssembly = null)
Parameters
Returns
GetSetupMethod(TypeInfo)
Declaration
public static BenchmarkMethodMetadata GetSetupMethod(TypeInfo classWithBenchmarks)
Parameters
Type |
Name |
Description |
System.Reflection.TypeInfo |
classWithBenchmarks |
|
Returns
IsTypeInvalidForBenchmarks(TypeInfo)
Declaration
public static bool IsTypeInvalidForBenchmarks(TypeInfo info)
Parameters
Type |
Name |
Description |
System.Reflection.TypeInfo |
info |
|
Returns
Type |
Description |
System.Boolean |
|
IsValidConfiguratorType(Type)
Declaration
public static bool IsValidConfiguratorType(Type configuratorType)
Parameters
Type |
Name |
Description |
System.Type |
configuratorType |
The System.Type we're going to test.
|
Returns
LoadAllTypeConfigurators(IAssemblyLoader)
Declaration
public static IEnumerable<Type> LoadAllTypeConfigurators(IAssemblyLoader loader)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Type> |
|
LoadAllTypeConfigurators(Assembly, IBenchmarkOutput)
Declaration
public static IEnumerable<Type> LoadAllTypeConfigurators(Assembly assembly, IBenchmarkOutput output = null)
Parameters
Type |
Name |
Description |
System.Reflection.Assembly |
assembly |
|
IBenchmarkOutput |
output |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Type> |
|
MethodTakesBenchmarkContext(MethodInfo)
Declaration
public static bool MethodTakesBenchmarkContext(MethodInfo info)
Parameters
Type |
Name |
Description |
System.Reflection.MethodInfo |
info |
|
Returns
Type |
Description |
System.Boolean |
|
Implements