------------ STARTING TestAndPerf.Perf.PerfLogging+Perf_Logger_Val ----------
ERROR: Error occurred during $TestAndPerf.Perf.PerfLogging+Perf_Logger_Val SETUP
.
NBench.NBenchException: error while retrieving counter ---> System.Collections.G
eneric.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at NBench.BenchmarkContext.GetCounter(String name)
--- End of inner exception stack trace ---
at NBench.BenchmarkContext.GetCounter(String name)
at TestAndPerf.Perf.PerfLogging.Setup(BenchmarkContext context) in D:\Develop
ment\Production-WS\Infrastructure\TestAndPerf\Perf\PerfLogging.cs:line 21
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(BenchmarkContext con
text)
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(Int64 runCount, Benc
hmarkContext context)
at NBench.Sdk.Benchmark.PreRun()
--------------- BEGIN WARMUP ---------------
Elapsed: 00:00:00.6864496
TotalBytesAllocated - bytes: 231,480.00 ,bytes: /s 337,213.35 , ns / bytes: 2,96
5.48
TotalCollections [Gen2] - collections: 0.00 ,collections: /s 0.00 , ns / collect
ions: 686,449,682.04
[Counter] Counter_Logger_Val - operations: 1.00 ,operations: /s 1.46 , ns / oper
ations: 686,449,682.04
--------------- END WARMUP ---------------
WARNING: Error during previous run of TestAndPerf.Perf.PerfLogging+Perf_Logger_V
al. Aborting run...
--------------- RESULTS: TestAndPerf.Perf.PerfLogging+Perf_Logger_Val ----------
-----
Test to ensure that minimal Througput of __.Val is sufficient
--------------- DATA ---------------
TotalBytesAllocated: Max: 231,480.00 bytes, Average: 231,480.00 bytes, Min: 231,
480.00 bytes, StdDev: 0.00 bytes
TotalBytesAllocated: Max / s: 337,213.35 bytes, Average / s: 337,213.35 bytes, M
in / s: 337,213.35 bytes, StdDev / s: 0.00 bytes
TotalCollections [Gen2]: Max: 0.00 collections, Average: 0.00 collections, Min:
0.00 collections, StdDev: 0.00 collections
TotalCollections [Gen2]: Max / s: 0.00 collections, Average / s: 0.00 collection
s, Min / s: 0.00 collections, StdDev / s: 0.00 collections
[Counter] Counter_Logger_Val: Max: 1.00 operations, Average: 1.00 operations, Mi
n: 1.00 operations, StdDev: 0.00 operations
[Counter] Counter_Logger_Val: Max / s: 1.46 operations, Average / s: 1.46 operat
ions, Min / s: 1.46 operations, StdDev / s: 0.00 operations
--------------- ASSERTIONS ---------------
[FAIL] Expected [Counter] Counter_Logger_Val to must be greater than 1,000,000.0
0 operations; actual value was 1.46 operations.
[PASS] Expected TotalBytesAllocated to must be less than or equal to 16,384,000.
00 bytes; actual value was 231,480.00 bytes.
[PASS] Expected TotalCollections [Gen2] to must be exactly 0.00 collections; act
ual value was 0.00 collections.
--------------- EXCEPTIONS ---------------
NBench.NBenchException: Error occurred during $TestAndPerf.Perf.PerfLogging+Perf
_Logger_Val SETUP. ---> NBench.NBenchException: error while retrieving counter -
--> System.Collections.Generic.KeyNotFoundException: The given key was not prese
nt in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at NBench.BenchmarkContext.GetCounter(String name)
--- End of inner exception stack trace ---
at NBench.BenchmarkContext.GetCounter(String name)
at TestAndPerf.Perf.PerfLogging.Setup(BenchmarkContext context) in D:\Develop
ment\Production-WS\Infrastructure\TestAndPerf\Perf\PerfLogging.cs:line 21
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(BenchmarkContext con
text)
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(Int64 runCount, Benc
hmarkContext context)
at NBench.Sdk.Benchmark.PreRun()
--- End of inner exception stack trace ---
## Exceptions
------------ FINISHED TestAndPerf.Perf.PerfLogging+Perf_Logger_Val ----------
------------ STARTING TestAndPerf.Perf.PerfLogging+Test_Logger_DB ----------
ERROR: Error occurred during $TestAndPerf.Perf.PerfLogging+Test_Logger_DB SETUP.
NBench.NBenchException: error while retrieving counter ---> System.Collections.G
eneric.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at NBench.BenchmarkContext.GetCounter(String name)
--- End of inner exception stack trace ---
at NBench.BenchmarkContext.GetCounter(String name)
at TestAndPerf.Perf.PerfLogging.Setup(BenchmarkContext context) in D:\Develop
ment\Production-WS\Infrastructure\TestAndPerf\Perf\PerfLogging.cs:line 20
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(BenchmarkContext con
text)
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(Int64 runCount, Benc
hmarkContext context)
at NBench.Sdk.Benchmark.PreRun()
ERROR: Error occurred during $TestAndPerf.Perf.PerfLogging+Test_Logger_DB RUN.
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
at TestAndPerf.Perf.PerfLogging.Test_Logger_DB(BenchmarkContext context) in D
:\Development\Production-WS\Infrastructure\TestAndPerf\Perf\PerfLogging.cs:line
51
at NBench.Sdk.Benchmark.RunBenchmark()
at NBench.Sdk.Benchmark.RunSingleBenchmark()
--------------- BEGIN WARMUP ---------------
Elapsed: 00:00:00.0077538
TotalBytesAllocated - bytes: -6,595,792.00 ,bytes: /s -16,066,096,111,520.00 , n
s / bytes: 410.54
TotalCollections [Gen2] - collections: 0.00 ,collections: /s 0.00 , ns / collect
ions: 410.54
[Counter] Counter_Logger_DB - operations: 0.00 ,operations: /s 0.00 , ns / opera
tions: 410.54
--------------- END WARMUP ---------------
WARNING: Error during previous run of TestAndPerf.Perf.PerfLogging+Test_Logger_D
B. Aborting run...
--------------- RESULTS: TestAndPerf.Perf.PerfLogging+Test_Logger_DB -----------
----
Test to ensure that minimal Througput of __.DB is sufficient
--------------- DATA ---------------
TotalBytesAllocated: Max: -6,595,792.00 bytes, Average: -6,595,792.00 bytes, Min
: -6,595,792.00 bytes, StdDev: 0.00 bytes
TotalBytesAllocated: Max / s: -16,066,096,111,520.00 bytes, Average / s: -16,066
,096,111,520.00 bytes, Min / s: -16,066,096,111,520.00 bytes, StdDev / s: 0.00 b
ytes
TotalCollections [Gen2]: Max: 0.00 collections, Average: 0.00 collections, Min:
0.00 collections, StdDev: 0.00 collections
TotalCollections [Gen2]: Max / s: 0.00 collections, Average / s: 0.00 collection
s, Min / s: 0.00 collections, StdDev / s: 0.00 collections
[Counter] Counter_Logger_DB: Max: 0.00 operations, Average: 0.00 operations, Min
: 0.00 operations, StdDev: 0.00 operations
[Counter] Counter_Logger_DB: Max / s: 0.00 operations, Average / s: 0.00 operati
ons, Min / s: 0.00 operations, StdDev / s: 0.00 operations
--------------- ASSERTIONS ---------------
[FAIL] Expected [Counter] Counter_Logger_DB to must be greater than 1,000,000.00
operations; actual value was 0.00 operations.
[PASS] Expected TotalBytesAllocated to must be less than or equal to 16,384,000.
00 bytes; actual value was -6,595,792.00 bytes.
[PASS] Expected TotalCollections [Gen2] to must be exactly 0.00 collections; act
ual value was 0.00 collections.
--------------- EXCEPTIONS ---------------
NBench.NBenchException: Error occurred during $TestAndPerf.Perf.PerfLogging+Test
_Logger_DB SETUP. ---> NBench.NBenchException: error while retrieving counter --
-> System.Collections.Generic.KeyNotFoundException: The given key was not presen
t in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at NBench.BenchmarkContext.GetCounter(String name)
--- End of inner exception stack trace ---
at NBench.BenchmarkContext.GetCounter(String name)
at TestAndPerf.Perf.PerfLogging.Setup(BenchmarkContext context) in D:\Develop
ment\Production-WS\Infrastructure\TestAndPerf\Perf\PerfLogging.cs:line 20
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(BenchmarkContext con
text)
at NBench.Sdk.ReflectionBenchmarkInvoker.InvokePerfSetup(Int64 runCount, Benc
hmarkContext context)
at NBench.Sdk.Benchmark.PreRun()
--- End of inner exception stack trace ---
NBench.NBenchException: Error occurred during $TestAndPerf.Perf.PerfLogging+Test
_Logger_DB RUN. ---> System.NullReferenceException: Object reference not set to
an instance of an object.
at TestAndPerf.Perf.PerfLogging.Test_Logger_DB(BenchmarkContext context) in D
:\Development\Production-WS\Infrastructure\TestAndPerf\Perf\PerfLogging.cs:line
51
at NBench.Sdk.Benchmark.RunBenchmark()
at NBench.Sdk.Benchmark.RunSingleBenchmark()
--- End of inner exception stack trace ---
## Exceptions
------------ FINISHED TestAndPerf.Perf.PerfLogging+Test_Logger_DB ----------
I have used following code, please help if there is any issue in my setup or if i am missing something
public class PerfLogging
{
private Counter Counter_Logger_Val;
private Counter Counter_Logger_DB;
[PerfSetup]
public void Setup(BenchmarkContext context)
{
Counter_Logger_Val = context.GetCounter("Counter_Logger_Val");
Counter_Logger_DB = context.GetCounter("Counter_Logger_DB");
}
[PerfBenchmark(Description = "Test to ensure that minimal Througput of __.Val is sufficient",
NumberOfIterations = 3, RunMode = RunMode.Throughput,
RunTimeMilliseconds = 1000, TestMode = TestMode.Test)]
[CounterThroughputAssertion("Counter_Logger_Val", MustBe.GreaterThan, 1000000d)]
[MemoryAssertion(MemoryMetric.TotalBytesAllocated, MustBe.LessThanOrEqualTo, ByteConstants.SixteenKb * 1000)]
[GcTotalAssertion(GcMetric.TotalCollections, GcGeneration.Gen2, MustBe.ExactlyEqualTo, 0.0d)]
public void Perf_Logger_Val(BenchmarkContext context)
{
Assert.Equal(__.Val(Logger.Level.NotSpecified), "NotSpecified");
string[] values = { "", null, "A" };
Assert.Equal(__.Val(values), "A");
Assert.Equal(__.Val(false, values), "");
Counter_Logger_Val.Increment();
}
[PerfBenchmark(Description = "Test to ensure that minimal Througput of __.DB is sufficient",
NumberOfIterations = 3, RunMode = RunMode.Throughput,
RunTimeMilliseconds = 1000, TestMode = TestMode.Test)]
[CounterThroughputAssertion("Counter_Logger_DB", MustBe.GreaterThan, 1000000d)]
[MemoryAssertion(MemoryMetric.TotalBytesAllocated, MustBe.LessThanOrEqualTo, ByteConstants.SixteenKb * 1000)]
[GcTotalAssertion(GcMetric.TotalCollections, GcGeneration.Gen2, MustBe.ExactlyEqualTo, 0.0d)]
public void Test_Logger_DB(BenchmarkContext context)
{
Assert.Equal(__.DB("DB", "USER", "PASSWORD"), "USER/********@DB");
typeof(Options).GetField("_ShowPassword", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static).SetValue(null, 1);
Assert.Equal(__.DB("DB", "USER", "PASSWORD"), "USER/PASSWORD@DB");
typeof(Options).GetField("_ShowPassword", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static).SetValue(null, 0);
Counter_Logger_DB.Increment();
}
}