-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from liammclennan/fix-end-to-end-tests
Fix end to end tests
- Loading branch information
Showing
7 changed files
with
237 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Serilog.Core; | ||
|
||
namespace SeqCli.Cli.Commands.Bench; | ||
|
||
class QueryBenchRunResults | ||
{ | ||
readonly Logger _reportingLogger; | ||
List<QueryBenchCaseTimings> _collectedTimings = new(); | ||
|
||
public static QueryBenchCase FINAL_COUNT_CASE = new() | ||
{ | ||
Id = "final-count-star", | ||
Query = "select count(*) from stream", | ||
}; | ||
|
||
public QueryBenchRunResults(Logger reportingLogger) | ||
{ | ||
_reportingLogger = reportingLogger; | ||
} | ||
|
||
public void Add(QueryBenchCaseTimings caseTimings) | ||
{ | ||
_collectedTimings.Add(caseTimings); | ||
} | ||
|
||
public void LogSummary(string description) | ||
{ | ||
_reportingLogger.Information( | ||
"Query benchmark {Description} complete in {TotalMeanElapsed:N0} ms with {MeanRelativeStandardDeviationPercentage:N1}% deviation, processed {FinalEventCount:N0} events at {EventsPerMs:N0} events/ms", | ||
description, | ||
TotalMeanElapsed(), | ||
MeanRelativeStandardDeviationPercentage(), | ||
FinalEventCount(), | ||
FinalEventCount() * _collectedTimings.Count / TotalMeanElapsed()); | ||
} | ||
|
||
private double TotalMeanElapsed() | ||
{ | ||
return _collectedTimings.Sum(c => c.MeanElapsed); | ||
} | ||
|
||
private double MeanRelativeStandardDeviationPercentage() | ||
{ | ||
return _collectedTimings.Average(c => c.RelativeStandardDeviationElapsed) * 100; | ||
} | ||
|
||
private int FinalEventCount() | ||
{ | ||
var benchCase = _collectedTimings.Single(c => c.Id == FINAL_COUNT_CASE.Id); | ||
return Convert.ToInt32(benchCase.LastResult); | ||
} | ||
} |
Oops, something went wrong.