distributed-computing/tasks/mironov-eo/lab_5/ConsoleApp1/ConsoleApp1/Program.cs
2023-12-06 13:58:56 +03:00

95 lines
2.4 KiB
C#

// See https://aka.ms/new-console-template for more information
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using ConsoleApp1;
BenchmarkRunner.Run<MatrixTest>();
[MemoryDiagnoser]
public class MatrixTest
{
int[,] firstMatrix10;
int[,] secondMatrix10;
int[,] firstMatrix100;
int[,] secondMatrix100;
int[,] firstMatrix1000;
int[,] secondMatrix1000;
MatrixHelper matrixHelper;
public MatrixTest()
{
matrixHelper = new MatrixHelper();
firstMatrix10 = matrixHelper.RandomGenerateMatrix(10);
secondMatrix10 = matrixHelper.RandomGenerateMatrix(10);
firstMatrix100 = matrixHelper.RandomGenerateMatrix(100);
secondMatrix100 = matrixHelper.RandomGenerateMatrix(100);
firstMatrix1000 = matrixHelper.RandomGenerateMatrix(1000);
secondMatrix1000 = matrixHelper.RandomGenerateMatrix(1000);
}
[Benchmark]
public int[][] MultiplicationMatrix100Tread1()
{
return matrixHelper.MultiplicationMatrix(firstMatrix100, secondMatrix100, 1);
}
[Benchmark]
public int[][] MultiplicationMatrix100Tread5()
{
return matrixHelper.MultiplicationMatrix(firstMatrix100, secondMatrix100, 5);
}
[Benchmark]
public int[][] MultiplicationMatrix100Tread15()
{
return matrixHelper.MultiplicationMatrix(firstMatrix100, secondMatrix100, 15);
}
[Benchmark]
public int[][] MultiplicationMatrix1000Tread1()
{
return matrixHelper.MultiplicationMatrix(firstMatrix1000, secondMatrix1000, 1);
}
[Benchmark]
public int[][] MultiplicationMatrix1000Tread5()
{
return matrixHelper.MultiplicationMatrix(firstMatrix1000, secondMatrix1000, 5);
}
[Benchmark]
public int[][] MultiplicationMatrix1000Tread15()
{
return matrixHelper.MultiplicationMatrix(firstMatrix1000, secondMatrix1000, 15);
}
[Benchmark]
public int[][] MultiplicationMatrix10Tread1()
{
return matrixHelper.MultiplicationMatrix(firstMatrix10, secondMatrix10, 1);
}
[Benchmark]
public int[][] MultiplicationMatrix10Tread5()
{
return matrixHelper.MultiplicationMatrix(firstMatrix10, secondMatrix10, 5);
}
[Benchmark]
public int[][] MultiplicationMatrix10Tread15()
{
return matrixHelper.MultiplicationMatrix(firstMatrix10, secondMatrix10, 15);
}
}