From df7148688dcad87039cd92d71b0280bd47f06fa7 Mon Sep 17 00:00:00 2001 From: Roman Efremov Date: Wed, 25 Dec 2024 13:54:07 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D1=82=D1=8C=20NPlot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...csproj => DD.Persistence.Benchmark.csproj} | 3 +- .../Tests/WitsDataBenchmark.cs | 59 +++++-------------- 2 files changed, 17 insertions(+), 45 deletions(-) rename Persistence.Benchmark/{Persistence.Benchmark.csproj => DD.Persistence.Benchmark.csproj} (89%) diff --git a/Persistence.Benchmark/Persistence.Benchmark.csproj b/Persistence.Benchmark/DD.Persistence.Benchmark.csproj similarity index 89% rename from Persistence.Benchmark/Persistence.Benchmark.csproj rename to Persistence.Benchmark/DD.Persistence.Benchmark.csproj index 8649307..3f154ee 100644 --- a/Persistence.Benchmark/Persistence.Benchmark.csproj +++ b/Persistence.Benchmark/DD.Persistence.Benchmark.csproj @@ -2,13 +2,12 @@ Exe - net8.0 + net9.0 enable enable - diff --git a/Persistence.Benchmark/Tests/WitsDataBenchmark.cs b/Persistence.Benchmark/Tests/WitsDataBenchmark.cs index 4fe42aa..0b2ecb7 100644 --- a/Persistence.Benchmark/Tests/WitsDataBenchmark.cs +++ b/Persistence.Benchmark/Tests/WitsDataBenchmark.cs @@ -1,7 +1,6 @@ using DD.Persistence.Client; using DD.Persistence.Models; using Microsoft.Extensions.DependencyInjection; -using NPlot; using System.Diagnostics; namespace Persistence.Benchmark.Tests; @@ -26,54 +25,28 @@ public static class WitsDataBenchmark var sw = new Stopwatch(); - //// Create a new bitmap plot surface - //var plotSurface = new NPlot.Bitmap.PlotSurface2D(800, 600); - //// Create a line plot - //var linePlot = new LinePlot(); + var abscissaData = new List() { }; + var ordinateData = new List() { }; + var saved = 0; + foreach (var item in data) + { + var time = sw.Elapsed; - //var abscissaData = new List() { }; - //var ordinateData = new List() { }; + sw.Start(); + var response = await client.AddRange(item, source.Token); + sw.Stop(); - //var saved = 0; - //foreach (var item in data) - //{ - // var time = sw.Elapsed; + Console.WriteLine($"Сохранено: {response.ToString()}"); + saved = saved + response; + abscissaData.Add(saved / 100_000); - // sw.Start(); - // var response = await client.AddRange(item, source.Token); - // sw.Stop(); - - // Console.WriteLine($"Сохранено: {response.ToString()}"); - // saved = saved + response; - // abscissaData.Add(saved / 100_000); - - // Console.WriteLine($"Затрачено времени на сохранение части: {sw.Elapsed - time}"); - // ordinateData.Add((double)(sw.Elapsed - time).TotalSeconds); - //} - - //Console.WriteLine($"Затрачено времени на сохранение: {sw.Elapsed}"); - - - //// Add the line plot to the plot surface - //linePlot.AbscissaData = abscissaData; - //linePlot.OrdinateData = ordinateData; - //plotSurface.Add(linePlot); - - //// Customize the plot (e.g., titles, labels) - //plotSurface.Title = "График"; - //plotSurface.XAxis1.Label = "Количество сохраненных записей в БД (100.000)"; - //plotSurface.YAxis1.Label = "Время на сохранение 100.000 записей (сек.)"; - - //// Refresh the plot to render it - //plotSurface.Refresh(); - - //#pragma warning disable - //// Save the plot as a PNG image - //plotSurface.Bitmap.Save("C:\\Users\\fremo\\source\\repos\\persistence\\Persistence.Benchmark\\plot.png", System.Drawing.Imaging.ImageFormat.Png); - //#pragma warning enable + Console.WriteLine($"Затрачено времени на сохранение части: {sw.Elapsed - time}"); + ordinateData.Add((double)(sw.Elapsed - time).TotalSeconds); + } + Console.WriteLine($"Затрачено времени на сохранение: {sw.Elapsed}"); var dis = Guid.Parse(discriminatorId); var date = DateTime.Now.AddDays(-1);