C# Класс NBench.Sdk.Compiler.ReflectionDiscovery

IDiscovery implementation built using reflection
Наследование: IDiscovery
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
BenchmarkContextType System.Type
MeasurementAttributeType System.Type
MeasurementConfiguratorType System.Type
PerformanceBenchmarkAttributeType System.Type

Открытые методы

Метод Описание
ClassesWithPerformanceBenchmarks ( Assembly targetAssembly ) : IReadOnlyList

Finds all classes with at least one method decorated with a PerfBenchmarkAttribute. inside targetAssembly.

ConfiguratorSupportsMeasurement ( Type measurementType, Type expectedConfiguratorType, bool exact = false ) : bool

Determine if a given IMeasurementConfigurator type is a match for a MeasurementAttribute type.

CreateBenchmarksForClass ( Type classWithBenchmarks ) : IReadOnlyList
CreateBenchmarksForClass ( TypeInfo classWithBenchmarks ) : IReadOnlyList
CreateInvokerForBenchmark ( BenchmarkClassMetadata benchmarkClass ) : IBenchmarkInvoker
CreateSettingsForBenchmark ( BenchmarkClassMetadata benchmarkClass ) : BenchmarkSettings
FindBenchmarks ( Assembly targetAssembly ) : IEnumerable
FindBenchmarks ( Type targetType ) : IEnumerable
FindBestMatchingConfiguratorForMeasurement ( Type measurementType, IEnumerable knownConfigurators ) : Type
GetCleanupMethod ( TypeInfo classWithBenchmarks ) : BenchmarkMethodMetadata
GetConfiguratorForMeasurement ( Type measurementType, Assembly specificAssembly = null ) : IMeasurementConfigurator

Creates a IMeasurementConfigurator instance for the provided MeasurementAttribute type.

GetConfiguratorTypeForMeasurement ( Type measurementType, Assembly specificAssembly = null ) : Type

Finds a matching IMeasurementConfigurator{T} type for a given type of MeasurementAttribute

GetSetupMethod ( TypeInfo classWithBenchmarks ) : BenchmarkMethodMetadata
IsTypeInvalidForBenchmarks ( TypeInfo info ) : bool
IsValidConfiguratorType ( Type configuratorType ) : bool

Check if a given configuratorType is a valid implementation of IMeasurementConfigurator{T}.

LoadAllTypeConfigurators ( ) : IEnumerable
MethodTakesBenchmarkContext ( MethodInfo info ) : bool
ReflectionDiscovery ( IBenchmarkOutput output ) : System
ReflectionDiscovery ( IBenchmarkOutput output, IBenchmarkAssertionRunner benchmarkAssertions, RunnerSettings settings ) : System

Приватные методы

Метод Описание
GetConfiguratorInterfaces ( Type type ) : IEnumerable
MethodHasValidBenchmark ( MethodInfo x ) : bool
SupportsType ( Type measurementType, Type configuratorType, bool exact ) : bool
ValidateTypeIsMeasurementAttribute ( Type measurementType ) : void

Описание методов

ClassesWithPerformanceBenchmarks() публичный статический Метод

Finds all classes with at least one method decorated with a PerfBenchmarkAttribute. inside targetAssembly.
public static ClassesWithPerformanceBenchmarks ( Assembly targetAssembly ) : IReadOnlyList
targetAssembly System.Reflection.Assembly The assembly we're scanning for benchmarks.
Результат IReadOnlyList

ConfiguratorSupportsMeasurement() публичный статический Метод

Determine if a given IMeasurementConfigurator type is a match for a MeasurementAttribute type.
public static ConfiguratorSupportsMeasurement ( Type measurementType, Type expectedConfiguratorType, bool exact = false ) : bool
measurementType System.Type A type.
expectedConfiguratorType System.Type A type.
exact bool /// 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 . ///
Результат bool

CreateBenchmarksForClass() публичный статический Метод

public static CreateBenchmarksForClass ( Type classWithBenchmarks ) : IReadOnlyList
classWithBenchmarks System.Type
Результат IReadOnlyList

CreateBenchmarksForClass() публичный статический Метод

public static CreateBenchmarksForClass ( TypeInfo classWithBenchmarks ) : IReadOnlyList
classWithBenchmarks System.Reflection.TypeInfo
Результат IReadOnlyList

CreateInvokerForBenchmark() публичный статический Метод

public static CreateInvokerForBenchmark ( BenchmarkClassMetadata benchmarkClass ) : IBenchmarkInvoker
benchmarkClass BenchmarkClassMetadata
Результат IBenchmarkInvoker

CreateSettingsForBenchmark() публичный Метод

public CreateSettingsForBenchmark ( BenchmarkClassMetadata benchmarkClass ) : BenchmarkSettings
benchmarkClass BenchmarkClassMetadata
Результат BenchmarkSettings

FindBenchmarks() публичный Метод

public FindBenchmarks ( Assembly targetAssembly ) : IEnumerable
targetAssembly System.Reflection.Assembly
Результат IEnumerable

FindBenchmarks() публичный Метод

public FindBenchmarks ( Type targetType ) : IEnumerable
targetType System.Type
Результат IEnumerable

FindBestMatchingConfiguratorForMeasurement() публичный статический Метод

public static FindBestMatchingConfiguratorForMeasurement ( Type measurementType, IEnumerable knownConfigurators ) : Type
measurementType System.Type
knownConfigurators IEnumerable
Результат System.Type

GetCleanupMethod() публичный статический Метод

public static GetCleanupMethod ( TypeInfo classWithBenchmarks ) : BenchmarkMethodMetadata
classWithBenchmarks System.Reflection.TypeInfo
Результат BenchmarkMethodMetadata

GetConfiguratorForMeasurement() публичный Метод

Creates a IMeasurementConfigurator instance for the provided MeasurementAttribute type.
public GetConfiguratorForMeasurement ( Type measurementType, Assembly specificAssembly = null ) : IMeasurementConfigurator
measurementType System.Type A type of
specificAssembly System.Reflection.Assembly /// Optional parameter. If an is provided, we limit our search /// for definitions to just that target assembly. ///
Результат IMeasurementConfigurator

GetConfiguratorTypeForMeasurement() публичный Метод

Finds a matching IMeasurementConfigurator{T} type for a given type of MeasurementAttribute
public GetConfiguratorTypeForMeasurement ( Type measurementType, Assembly specificAssembly = null ) : Type
measurementType System.Type A type of
specificAssembly System.Reflection.Assembly /// Optional parameter. If an is provided, we limit our search /// for definitions to just that target assembly. ///
Результат System.Type

GetSetupMethod() публичный статический Метод

public static GetSetupMethod ( TypeInfo classWithBenchmarks ) : BenchmarkMethodMetadata
classWithBenchmarks System.Reflection.TypeInfo
Результат BenchmarkMethodMetadata

IsTypeInvalidForBenchmarks() публичный статический Метод

public static IsTypeInvalidForBenchmarks ( TypeInfo info ) : bool
info System.Reflection.TypeInfo
Результат bool

IsValidConfiguratorType() публичный статический Метод

Check if a given configuratorType is a valid implementation of IMeasurementConfigurator{T}.
public static IsValidConfiguratorType ( Type configuratorType ) : bool
configuratorType System.Type The we're going to test.
Результат bool

LoadAllTypeConfigurators() публичный статический Метод

public static LoadAllTypeConfigurators ( ) : IEnumerable
Результат IEnumerable

MethodTakesBenchmarkContext() публичный статический Метод

public static MethodTakesBenchmarkContext ( MethodInfo info ) : bool
info System.Reflection.MethodInfo
Результат bool

ReflectionDiscovery() публичный Метод

public ReflectionDiscovery ( IBenchmarkOutput output ) : System
output IBenchmarkOutput
Результат System

ReflectionDiscovery() публичный Метод

public ReflectionDiscovery ( IBenchmarkOutput output, IBenchmarkAssertionRunner benchmarkAssertions, RunnerSettings settings ) : System
output IBenchmarkOutput
benchmarkAssertions IBenchmarkAssertionRunner
settings RunnerSettings
Результат System

Описание свойств

BenchmarkContextType публичное статическое свойство

public static Type,System BenchmarkContextType
Результат System.Type

MeasurementAttributeType публичное статическое свойство

public static Type,System MeasurementAttributeType
Результат System.Type

MeasurementConfiguratorType публичное статическое свойство

public static Type,System MeasurementConfiguratorType
Результат System.Type

PerformanceBenchmarkAttributeType публичное статическое свойство

public static Type,System PerformanceBenchmarkAttributeType
Результат System.Type