feat: 添加新项目与启动文件

添加启动文件 launchSettings.json ,指定启动参数
添加用来测试的项目
main
bicijinlian 2 years ago
parent 7151b47398
commit 14fae381b7

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BenchMarkDotnetStudy.Core\BenchMarkDotnetStudy.Core.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,45 @@
using System.Collections;
namespace BenchMarkDotnetStudy.BenchmarkDemo
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Benchmark 基准测试示例");
if (args?.Length > 0)
{
Console.WriteLine($"命令行参数有{args.Length}个,分别是[{string.Join(" | ", args)}]");
}
else
{
Console.WriteLine("没有命令行参数");
}
var allEnvs = Environment.GetEnvironmentVariables();
var defaultColor = Console.ForegroundColor;
foreach (DictionaryEntry item in allEnvs)
{
if (item.Key.ToString().Contains("DOTNET_"))
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.Write($"Key = ");
Console.ForegroundColor = ConsoleColor.Green;
Console.Write($"{item.Key}, ");
Console.ForegroundColor = ConsoleColor.Blue;
Console.Write($"Value = ");
Console.ForegroundColor = ConsoleColor.Green;
Console.Write($"{item.Value}");
Console.Write($"{Environment.NewLine}");
}
}
Console.ForegroundColor = defaultColor;
}
}
}

@ -0,0 +1,8 @@
{
"profiles": {
"BenchMarkDotnetStudy.BenchmarkDemo": {
"commandName": "Project",
"commandLineArgs": "-- demo ssss"
}
}
}

@ -17,7 +17,9 @@ namespace BenchMarkDotnetStudy.BenchmarkStudy
Console.WriteLine("无命令行参数");
}
var summary = BenchmarkRunner.Run<CounterTest3>();
//var summary = BenchmarkRunner.Run<CounterTest3>();
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new DebugInProcessConfig());
// MockArgsRun();
}

@ -0,0 +1,8 @@
{
"profiles": {
"BenchMarkDotnetStudy.BenchmarkStudy": {
"commandName": "Project",
"commandLineArgs": "--filter *CounterTest3.Thread2_Test"
}
}
}

@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{9390267A-7
Docs\在笔记中使用基准测试.ipynb = Docs\在笔记中使用基准测试.ipynb
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchMarkDotnetStudy.BenchmarkDemo", "BenchMarkDotnetStudy.BenchmarkDemo\BenchMarkDotnetStudy.BenchmarkDemo.csproj", "{E6C935EE-96C5-4642-95BA-DBF4F3A5AAA7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -32,6 +34,10 @@ Global
{AFA892FB-C52A-443D-B0F0-3E458DDCDC7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFA892FB-C52A-443D-B0F0-3E458DDCDC7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFA892FB-C52A-443D-B0F0-3E458DDCDC7F}.Release|Any CPU.Build.0 = Release|Any CPU
{E6C935EE-96C5-4642-95BA-DBF4F3A5AAA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6C935EE-96C5-4642-95BA-DBF4F3A5AAA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6C935EE-96C5-4642-95BA-DBF4F3A5AAA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6C935EE-96C5-4642-95BA-DBF4F3A5AAA7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

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