Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions DevPack.Benchmarks/DevPack.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.Benchmarks</AssemblyName>
<RootNamespace>Skyline.DataMiner.Solutions.MediaOps.Plan.Benchmarks</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DevPack\Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.csproj" />
<ProjectReference Include="..\DevPack.UnitTesting\Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.UnitTesting.csproj" />
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions DevPack.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Skyline.DataMiner.Solutions.MediaOps.Plan.Benchmarks
{
using BenchmarkDotNet.Running;

internal static class Program
{
private static void Main(string[] args)
{
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
namespace Skyline.DataMiner.Solutions.MediaOps.Plan.Benchmarks.Workflow.Jobs
{
using System;
using System.Linq;

using BenchmarkDotNet.Attributes;

using Skyline.DataMiner.Net;
using Skyline.DataMiner.Net.Apps.DataMinerObjectModel;
using Skyline.DataMiner.Net.Messages.SLDataGateway;
using Skyline.DataMiner.Solutions.MediaOps.Plan.API;
using Skyline.DataMiner.Solutions.MediaOps.Plan.Storage.DOM.SlcWorkflow;
using Skyline.DataMiner.Solutions.MediaOps.Plan.UnitTesting.Simulation;

[MemoryDiagnoser]
[InProcess]
public class ReadJobsWithinTimespanBenchmarks
{
private static readonly DateTime SeedStartUtc = new DateTime(2026, 01, 01, 00, 00, 00, DateTimeKind.Utc);
private static readonly DateTime BenchmarkWindowStartUtc = SeedStartUtc.AddDays(10);

private IConnection? connection;
private MediaOpsPlanApi? api;
private FilterElement<DomInstance>? timespanFilter;

[Params(1, 24, 168)]
public int TimespanHours { get; set; }

[GlobalSetup]
public void GlobalSetup()
{
var dms = MediaOpsPlanSimulation.Create();
connection = dms.CreateConnection();
api = (MediaOpsPlanApi)(connection.GetMediaOpsPlanApi() ?? throw new InvalidOperationException("Unable to create MediaOpsPlanApi"));

SeedJobs();

var windowEndUtc = BenchmarkWindowStartUtc.AddHours(TimespanHours);
timespanFilter = new ANDFilterElement<DomInstance>(
DomInstanceExposers.DomDefinitionId.Equal(SlcWorkflowIds.Definitions.Jobs.Id),
DomInstanceExposers.FieldValues.DomInstanceField(SlcWorkflowIds.Sections.JobInfo.JobStart).GreaterThanOrEqual(BenchmarkWindowStartUtc),
DomInstanceExposers.FieldValues.DomInstanceField(SlcWorkflowIds.Sections.JobInfo.JobEnd).LessThanOrEqual(windowEndUtc));
}

[Benchmark(Description = "Read all jobs within a timespan")]
public Job[] ReadAllJobsWithinTimespan()
{
return api!.DomHelpers.SlcWorkflowHelper
.GetJobs(timespanFilter!)
.Select(domJob => new Job(api, domJob))
.ToArray();
}

[GlobalCleanup]
public void GlobalCleanup()
{
connection?.Dispose();
}

private void SeedJobs()
{
var jobs = Enumerable.Range(0, 24 * 30)
.Select(index =>
{
var start = SeedStartUtc.AddHours(index);
var end = start.AddMinutes(45);

return new Job
{
Name = $"Benchmark Job {index:D4}",
Start = start,
End = end,
PreRollStart = start,
PostRollEnd = end,
};
})
.ToArray();

api!.Jobs.Create(jobs);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.Tests" />
<InternalsVisibleTo Include="Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.Benchmarks" />
<InternalsVisibleTo Include="Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.UnitTesting" />
<InternalsVisibleTo Include="Skyline.DataMiner.Utils.MediaOps.Temp.Common" />
<!-- Allows Moq/Castle DynamicProxy to mock interfaces (e.g. IMediaOpsPlanApi) that expose internal members. -->
Expand Down
1 change: 1 addition & 0 deletions MediaOps Plan.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Project Path="DevPack.UnitTesting/Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.UnitTesting.csproj" />
</Folder>
<Project Path="DevPack.Automation/Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.Automation.csproj" />
<Project Path="DevPack.Benchmarks/DevPack.Benchmarks.csproj" />
<Project Path="DevPack.GQI/Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.GQI.csproj" />
<Project Path="DevPack.Protocol/Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.Protocol.csproj" />
<Project Path="DevPack/Skyline.DataMiner.Dev.Utils.Solutions.MediaOps.Plan.csproj" />
Expand Down