Skip to content

Commit

Permalink
Merge branch 'release/v2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswalpen committed Sep 28, 2022
2 parents 5aefc44 + 10db13a commit a159152
Show file tree
Hide file tree
Showing 102 changed files with 3,289 additions and 391 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"WickedFlame_MeasureMap" /o:"wickedflame" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="src/Tests/**/coverage.opencover.xml"
.\.sonar\scanner\dotnet-sonarscanner begin /k:"WickedFlame_MeasureMap" /o:"wickedflame" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="src/Tests/**/coverage.*.opencover.xml"
dotnet build
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ artifacts
*.user
*.jtconfig
*.suo
*.lutconfig
.JustCode/PersistanceMap.solution-user.settings.xml
.JustCode/PersistanceMap.solution-user.settings.xml
_Resharper.*
Expand Down
32 changes: 29 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
# MeasureMap Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## vNext

### Added
- Benchmarks Trace throughput per second
- Customizable Tracer for Results

### Changed
- Benchmarks now Trace iterartions instead of memory used
- Complete redo of the trace output

### Fixed

## v2.0.0
### Added
- Add ThreadId and Iteration to the Tracedetails
- Wait for all threads to end

### Changed
- Changed Targetframework to netstandard2.0
- Changed from Task to full Threads
- Display more infos in the traces
- Use Stopwatch instead of DateTime.Now for more accuracy
- Wait for all threads to end


### Fixed

## v1.7.0
### Added
- Set the duration that a Profilersession should run for
- Set a Interval to define the pace a task should be executed at

### Changed
- Updated .NET Versions to .NetStandard 2.1 and .NET Framework 4.8

### Fixed
7 changes: 7 additions & 0 deletions MeasureMap.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{364A83BE-EC1F-42DA-ACCB-69DE17631CF3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeasureMap.Benchmark", "src\Tests\MeasureMap.Benchmark\MeasureMap.Benchmark.csproj", "{5BA1A434-30F8-4233-B4C1-A668AB50BC4B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -37,13 +39,18 @@ Global
{09EB8BCB-A514-4178-9C28-4503BBD4C528}.Release|Any CPU.Build.0 = Release|Any CPU
{364A83BE-EC1F-42DA-ACCB-69DE17631CF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{364A83BE-EC1F-42DA-ACCB-69DE17631CF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BA1A434-30F8-4233-B4C1-A668AB50BC4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5BA1A434-30F8-4233-B4C1-A668AB50BC4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BA1A434-30F8-4233-B4C1-A668AB50BC4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BA1A434-30F8-4233-B4C1-A668AB50BC4B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{09EB8BCB-A514-4178-9C28-4503BBD4C528} = {C302527D-DA3E-472C-9EBA-3F8C2A1ACDDE}
{364A83BE-EC1F-42DA-ACCB-69DE17631CF3} = {3BE4645D-C5EB-4675-AEE2-68BFE6AC84EB}
{5BA1A434-30F8-4233-B4C1-A668AB50BC4B} = {C302527D-DA3E-472C-9EBA-3F8C2A1ACDDE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2E89D7E4-1ED8-4DD2-9BE7-31DC2F349AEB}
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# http://www.appveyor.com/docs/appveyor-yml

environment:
base_version: 2.0.0
base_version: 2.0.1

# version format
version: $(base_version).{build}
Expand Down
2 changes: 1 addition & 1 deletion build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Build : NukeBuild
[GitRepository] readonly GitRepository GitRepository;

[Parameter("Version to be injected in the Build")]
public string Version { get; set; } = $"1.8.0";
public string Version { get; set; } = $"2.0.1";

[Parameter("The Buildnumber provided by the CI")]
public string BuildNo = "1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,15 @@ namespace MeasureMap
/// <summary>
/// Defines the redults of benchmarktests
/// </summary>
public interface IProfilerResultCollection : IEnumerable<IProfilerResult>
{
/// <summary>
/// Add a result of benchmarktest
/// </summary>
/// <param name="name">The name of the result</param>
/// <param name="result">The result</param>
void Add(string name, IProfilerResult result);

/// <summary>
/// Gets the amount of iterations that the benchmarktests were run
/// </summary>
int Iterations { get; }

/// <summary>
/// Gets the keys collection
/// </summary>
IEnumerable<string> Keys { get; }

/// <summary>
/// Indexer for benchmarkresults
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
IProfilerResult this[string key] { get; }
}

/// <summary>
/// Defines the redults of benchmarktests
/// </summary>
public class ProfilerResultCollection : IProfilerResultCollection
public class BenchmarkResult : IBenchmarkResult
{
private readonly Dictionary<string, IProfilerResult> _results;

/// <summary>
/// Creates an instance of a ProfilerResultCollection
/// Creates an instance of a BenchmarkResult
/// </summary>
/// <param name="iterations"></param>
public ProfilerResultCollection(int iterations)
public BenchmarkResult(int iterations)
{
_results = new Dictionary<string, IProfilerResult>();
Iterations = iterations;
Expand Down
89 changes: 89 additions & 0 deletions src/MeasureMap/BenchmarkResultExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using MeasureMap.Tracers;
using MeasureMap.Tracers.Metrics;

namespace MeasureMap
{
/// <summary>
/// Extension methods for the IBenchmarkResult
/// </summary>
public static class BenchmarkResultExtensions
{
/// <summary>
/// Traces the output of a Benchmark Test
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public static void Trace(this IBenchmarkResult result)
{
result.Trace(TraceOptions.Default.Tracer, TraceOptions.Default.ResultWriter, TraceOptions.Default.Clone());
}

/// <summary>
/// Traces the output of a Benchmark Test
/// </summary>
/// <param name="result"></param>
/// <param name="metrics"></param>
/// <returns></returns>
public static void Trace(this IBenchmarkResult result, TraceMetrics metrics)
{
var options = TraceOptions.Default.Clone();
options.Metrics = metrics;
result.Trace(options);
}

/// <summary>
/// Trace the output of a Benchmark Test
/// </summary>
/// <param name="result"></param>
/// <param name="options"></param>
public static void Trace(this IBenchmarkResult result, TraceOptions options)
{
result.Trace(options.Tracer, options.ResultWriter, options);
}

/// <summary>
/// Trace the output of a Benchmark Test
/// </summary>
/// <param name="result"></param>
/// <param name="tracer"></param>
public static void Trace(this IBenchmarkResult result, ITracer tracer)
{
result.Trace(tracer, TraceOptions.Default.ResultWriter, TraceOptions.Default.Clone());
}

/// <summary>
/// Trace the output of a Benchmark Test
/// </summary>
/// <param name="result"></param>
/// <param name="writer"></param>
public static void Trace(this IBenchmarkResult result, IResultWriter writer)
{
result.Trace(TraceOptions.Default.Tracer, writer, TraceOptions.Default.Clone());
}

/// <summary>
/// Trace the output of a Benchmark Test
/// </summary>
/// <param name="result"></param>
/// <param name="tracer"></param>
/// <param name="writer"></param>
public static void Trace(this IBenchmarkResult result, ITracer tracer, IResultWriter writer)
{
result.Trace(tracer, writer, TraceOptions.Default.Clone());
}

/// <summary>
/// Trace the output of a Benchmark Test
/// </summary>
/// <param name="result"></param>
/// <param name="tracer"></param>
/// <param name="writer"></param>
/// <param name="options"></param>
public static void Trace(this IBenchmarkResult result, ITracer tracer, IResultWriter writer, TraceOptions options)
{
options.Metrics ??= BenchmarkTraceMetrics.GetDefaultTraceMetrics();

tracer.Trace(result, writer, options);
}
}
}
4 changes: 2 additions & 2 deletions src/MeasureMap/BenchmarkRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public BenchmarkRunner AddSession(string name, ProfilerSession session)
/// Run all sessions and benchmarks
/// </summary>
/// <returns></returns>
public IProfilerResultCollection RunSessions()
public IBenchmarkResult RunSessions()
{
var results = new ProfilerResultCollection(_settings.Iterations);
var results = new BenchmarkResult(_settings.Iterations);

foreach (var key in _sessions.Keys)
{
Expand Down
2 changes: 1 addition & 1 deletion src/MeasureMap/BenchmarkRunnerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class BenchmarkRunnerExtensions
/// Set the amount of iterations that the benchmarks run
/// </summary>
/// <param name="runner">The benchmark runner</param>
/// <param name="iterations">the amount of itterations</param>
/// <param name="iterations">The amount of iterations</param>
/// <returns></returns>
public static BenchmarkRunner SetIterations(this BenchmarkRunner runner, int iterations)
{
Expand Down
19 changes: 17 additions & 2 deletions src/MeasureMap/Enumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ public abstract class Enumeration : IComparable
/// </summary>
public string Name { get; }

/// <summary>
/// Constructor
/// </summary>
/// <param name="name"></param>
protected Enumeration(string name)
{
Id = -1;
Name = name;
}

/// <summary>
/// Constructor
/// </summary>
Expand Down Expand Up @@ -53,7 +63,7 @@ public string ToLower()
/// <returns></returns>
public int CompareTo(object obj)
{
if (Id.CompareTo(((Enumeration)obj).Id) > 0 || String.Compare(Name, ((Enumeration)obj).Name, StringComparison.Ordinal) > 0)
if (Id.CompareTo(((Enumeration)obj).Id) > 0 || string.Compare(Name, ((Enumeration)obj).Name, StringComparison.Ordinal) > 0)
{
return 1;
}
Expand All @@ -63,7 +73,7 @@ public int CompareTo(object obj)
return 0;
}

return -1;
return -1;
}

/// <summary>
Expand Down Expand Up @@ -94,6 +104,11 @@ public static int Compare(Enumeration left, Enumeration right)
/// <returns></returns>
public override bool Equals(object obj)
{
if (obj is string v)
{
return ToString() == v;
}

return obj is Enumeration en && en.Id == Id && en.ToLower() == ToLower();
}

Expand Down
34 changes: 34 additions & 0 deletions src/MeasureMap/IBenchmarkResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Collections.Generic;

namespace MeasureMap
{
/// <summary>
/// Defines the redults of benchmarktests
/// </summary>
public interface IBenchmarkResult : IEnumerable<IProfilerResult>
{
/// <summary>
/// Add a result of benchmarktest
/// </summary>
/// <param name="name">The name of the result</param>
/// <param name="result">The result</param>
void Add(string name, IProfilerResult result);

/// <summary>
/// Gets the amount of iterations that the benchmarktests were run
/// </summary>
int Iterations { get; }

/// <summary>
/// Gets the keys collection
/// </summary>
IEnumerable<string> Keys { get; }

/// <summary>
/// Indexer for benchmarkresults
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
IProfilerResult this[string key] { get; }
}
}
Loading

0 comments on commit a159152

Please sign in to comment.