From 33dda22799d8780b37458ec6e319894050705c80 Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Tue, 1 Aug 2023 14:21:25 -0500 Subject: [PATCH] fixed `RequestsPerSecond` property in BDN (#6867) had to add a null check to make sure we weren't missing reports --- .../Akka.Benchmarks/Configurations/Configs.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs b/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs index d07c6833556..b8afd531f15 100644 --- a/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs +++ b/src/benchmark/Akka.Benchmarks/Configurations/Configs.cs @@ -36,13 +36,17 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyl { var benchmarkAttribute = benchmarkCase.Descriptor.WorkloadMethod.GetCustomAttribute(); var totalOperations = benchmarkAttribute?.OperationsPerInvoke ?? 1; - - var report = summary[benchmarkCase]; - var nsPerOperation = report.ResultStatistics.Mean; - var operationsPerSecond = 1 / (nsPerOperation / 1e9); + if (summary.HasReport(benchmarkCase)) + { + var report = summary[benchmarkCase]; + var nsPerOperation = report.ResultStatistics.Mean; + var operationsPerSecond = 1 / (nsPerOperation / 1e9); - return operationsPerSecond.ToString("N2"); // or format as you like + return operationsPerSecond.ToString("N2"); // or format as you like + } + + return ""; } }