feat: 基础功能

docs: 文档更新
main
bicijinlian 2 years ago
parent 0cf03db251
commit 7151b47398

@ -1,3 +1,4 @@
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running; using BenchmarkDotNet.Running;
namespace BenchMarkDotnetStudy.BenchmarkStudy namespace BenchMarkDotnetStudy.BenchmarkStudy
@ -7,12 +8,33 @@ namespace BenchMarkDotnetStudy.BenchmarkStudy
static void Main(string[] args) static void Main(string[] args)
{ {
Console.WriteLine("Benchmark 测试!"); Console.WriteLine("Benchmark 测试!");
if (args != null && args?.Length > 0)
{
Console.WriteLine($"有{args.Length}个命令行参数, 分别为[{string.Join(" | ", args)}]");
}
else
{
Console.WriteLine("无命令行参数");
}
var summary = BenchmarkRunner.Run<CounterTest3>(); var summary = BenchmarkRunner.Run<CounterTest3>();
Console.WriteLine("Benchmark 测试结束:"); // MockArgsRun();
}
public static void MockArgsRun()
{
//模拟命令行参数:参数和参数值分两个参数写
var mockArgs = new string[] { "--filter", "*CounterTest3.Thread2_Test" };
//显示模拟参数
Console.WriteLine($"有{mockArgs.Length}个模拟命令行参数, 分别为[{string.Join(" | ", mockArgs)}]");
//执行方式一
var summary = BenchmarkRunner.Run<CounterTest3>(null, mockArgs);
Console.WriteLine($"总耗时:{summary.AllRuntimes}"); //执行方式二:推荐
var summaries = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(mockArgs, new DebugInProcessConfig());
} }
} }
} }

@ -3,11 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290 VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchMarkDotnetStudy.Core", "BenchMarkDotnetStudy.Core\BenchMarkDotnetStudy.Core.csproj", "{8C37BE95-8908-4038-BF56-F0F1A5F4C52C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchMarkDotnetStudy.Core", "BenchMarkDotnetStudy.Core\BenchMarkDotnetStudy.Core.csproj", "{8C37BE95-8908-4038-BF56-F0F1A5F4C52C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchMarkDotnetStudy.CApp", "BenchMarkDotnetStudy.CApp\BenchMarkDotnetStudy.CApp.csproj", "{D5D6E7DF-82AF-4F78-BB60-A0BE378B97E4}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchMarkDotnetStudy.CApp", "BenchMarkDotnetStudy.CApp\BenchMarkDotnetStudy.CApp.csproj", "{D5D6E7DF-82AF-4F78-BB60-A0BE378B97E4}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchMarkDotnetStudy.BenchmarkStudy", "BenchMarkDotnetStudy.BenchmarkStudy\BenchMarkDotnetStudy.BenchmarkStudy.csproj", "{AFA892FB-C52A-443D-B0F0-3E458DDCDC7F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchMarkDotnetStudy.BenchmarkStudy", "BenchMarkDotnetStudy.BenchmarkStudy\BenchMarkDotnetStudy.BenchmarkStudy.csproj", "{AFA892FB-C52A-443D-B0F0-3E458DDCDC7F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{9390267A-73EF-4CF8-A70C-2CD2A6CE6E2E}"
ProjectSection(SolutionItems) = preProject
Docs\在笔记中使用基准测试.ipynb = Docs\在笔记中使用基准测试.ipynb
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save