Skip to content

Commit 57eb566

Browse files
[WIP] Introduce Phd
1 parent a58872b commit 57eb566

File tree

135 files changed

+12774
-1384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+12774
-1384
lines changed

BenchmarkDotNet.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkDotNet.Exporters.P
5959
EndProject
6060
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkDotNet.Exporters.Plotting.Tests", "tests\BenchmarkDotNet.Exporters.Plotting.Tests\BenchmarkDotNet.Exporters.Plotting.Tests.csproj", "{199AC83E-30BD-40CD-87CE-0C838AC0320D}"
6161
EndProject
62+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfolizer", "..\perfolizer\src\Perfolizer\Perfolizer\Perfolizer.csproj", "{CC6E253E-04E1-41CB-AA85-290A60E37677}"
63+
EndProject
64+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perfolizer.Tests", "..\perfolizer\src\Perfolizer\Perfolizer.Tests\Perfolizer.Tests.csproj", "{71F1801D-D0AD-4A33-8253-B72776761D3A}"
65+
EndProject
6266
Global
6367
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6468
Debug|Any CPU = Debug|Any CPU
@@ -161,6 +165,14 @@ Global
161165
{199AC83E-30BD-40CD-87CE-0C838AC0320D}.Debug|Any CPU.Build.0 = Debug|Any CPU
162166
{199AC83E-30BD-40CD-87CE-0C838AC0320D}.Release|Any CPU.ActiveCfg = Release|Any CPU
163167
{199AC83E-30BD-40CD-87CE-0C838AC0320D}.Release|Any CPU.Build.0 = Release|Any CPU
168+
{CC6E253E-04E1-41CB-AA85-290A60E37677}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
169+
{CC6E253E-04E1-41CB-AA85-290A60E37677}.Debug|Any CPU.Build.0 = Debug|Any CPU
170+
{CC6E253E-04E1-41CB-AA85-290A60E37677}.Release|Any CPU.ActiveCfg = Release|Any CPU
171+
{CC6E253E-04E1-41CB-AA85-290A60E37677}.Release|Any CPU.Build.0 = Release|Any CPU
172+
{71F1801D-D0AD-4A33-8253-B72776761D3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
173+
{71F1801D-D0AD-4A33-8253-B72776761D3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
174+
{71F1801D-D0AD-4A33-8253-B72776761D3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
175+
{71F1801D-D0AD-4A33-8253-B72776761D3A}.Release|Any CPU.Build.0 = Release|Any CPU
164176
EndGlobalSection
165177
GlobalSection(SolutionProperties) = preSolution
166178
HideSolutionNode = FALSE
@@ -190,6 +202,8 @@ Global
190202
{2E2283A3-6DA6-4482-8518-99D6D9F689AB} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
191203
{B92ECCEF-7C27-4012-9E19-679F3C40A6A6} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
192204
{199AC83E-30BD-40CD-87CE-0C838AC0320D} = {14195214-591A-45B7-851A-19D3BA2413F9}
205+
{CC6E253E-04E1-41CB-AA85-290A60E37677} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
206+
{71F1801D-D0AD-4A33-8253-B72776761D3A} = {14195214-591A-45B7-851A-19D3BA2413F9}
193207
EndGlobalSection
194208
GlobalSection(ExtensibilityGlobals) = postSolution
195209
SolutionGuid = {4D9AF12B-1F7F-45A7-9E8C-E4E46ADCBD1F}

src/BenchmarkDotNet.Diagnostics.Windows/HardwareCounters.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using BenchmarkDotNet.Detectors;
45
using BenchmarkDotNet.Diagnosers;
56
using BenchmarkDotNet.Portability;
67
using BenchmarkDotNet.Toolchains.InProcess.Emit;
@@ -31,7 +32,7 @@ private static readonly Dictionary<HardwareCounter, string> EtwTranslations
3132

3233
public static IEnumerable<ValidationError> Validate(ValidationParameters validationParameters, bool mandatory)
3334
{
34-
if (!RuntimeInformation.IsWindows())
35+
if (!OsDetector.IsWindows())
3536
{
3637
yield return new ValidationError(true, "Hardware Counters and EtwProfiler are supported only on Windows");
3738
yield break;

src/BenchmarkDotNet.Diagnostics.Windows/JitDiagnoser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using BenchmarkDotNet.Detectors;
34
using BenchmarkDotNet.Diagnosers;
45
using BenchmarkDotNet.Engines;
56
using BenchmarkDotNet.Loggers;
@@ -33,7 +34,7 @@ public void Handle(HostSignal signal, DiagnoserActionParameters parameters)
3334

3435
public IEnumerable<ValidationError> Validate(ValidationParameters validationParameters)
3536
{
36-
if (!RuntimeInformation.IsWindows())
37+
if (!OsDetector.IsWindows())
3738
{
3839
yield return new ValidationError(true, $"{GetType().Name} is supported only on Windows");
3940
}

src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
using System.Collections.Immutable;
44
using System.Linq;
55
using BenchmarkDotNet.Analysers;
6+
using BenchmarkDotNet.Detectors;
67
using BenchmarkDotNet.Diagnosers;
78
using BenchmarkDotNet.Engines;
89
using BenchmarkDotNet.Exporters;
910
using BenchmarkDotNet.Jobs;
1011
using BenchmarkDotNet.Loggers;
11-
using BenchmarkDotNet.Portability;
1212
using BenchmarkDotNet.Reports;
1313
using BenchmarkDotNet.Running;
1414
using BenchmarkDotNet.Validators;
@@ -124,10 +124,10 @@ internal static bool IsSupported(RuntimeMoniker runtimeMoniker)
124124
case RuntimeMoniker.NetCoreApp20:
125125
case RuntimeMoniker.NetCoreApp21:
126126
case RuntimeMoniker.NetCoreApp22:
127-
return RuntimeInformation.IsWindows();
127+
return OsDetector.IsWindows();
128128
case RuntimeMoniker.NetCoreApp30:
129129
case RuntimeMoniker.NetCoreApp31:
130-
return RuntimeInformation.IsWindows() || RuntimeInformation.IsLinux();
130+
return OsDetector.IsWindows() || OsDetector.IsLinux();
131131
default:
132132
throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, $"Runtime moniker {runtimeMoniker} is not supported");
133133
}

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
using System.Collections.Immutable;
44
using System.Linq;
55
using BenchmarkDotNet.Analysers;
6+
using BenchmarkDotNet.Detectors;
67
using BenchmarkDotNet.Diagnosers;
78
using BenchmarkDotNet.Engines;
89
using BenchmarkDotNet.Exporters;
910
using BenchmarkDotNet.Jobs;
1011
using BenchmarkDotNet.Loggers;
11-
using BenchmarkDotNet.Portability;
1212
using BenchmarkDotNet.Reports;
1313
using BenchmarkDotNet.Running;
1414
using BenchmarkDotNet.Toolchains;
@@ -118,10 +118,10 @@ internal static bool IsSupported(RuntimeMoniker runtimeMoniker)
118118
case RuntimeMoniker.NetCoreApp20:
119119
case RuntimeMoniker.NetCoreApp21:
120120
case RuntimeMoniker.NetCoreApp22:
121-
return RuntimeInformation.IsWindows();
121+
return OsDetector.IsWindows();
122122
case RuntimeMoniker.NetCoreApp30:
123123
case RuntimeMoniker.NetCoreApp31:
124-
return RuntimeInformation.IsWindows() || RuntimeInformation.IsLinux();
124+
return OsDetector.IsWindows() || OsDetector.IsLinux();
125125
default:
126126
throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, $"Runtime moniker {runtimeMoniker} is not supported");
127127
}

src/BenchmarkDotNet/Analysers/ZeroMeasurementAnalyser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private ZeroMeasurementAnalyser() { }
1919

2020
protected override IEnumerable<Conclusion> AnalyseReport(BenchmarkReport report, Summary summary)
2121
{
22-
var currentFrequency = summary.HostEnvironmentInfo.CpuInfo.Value.MaxFrequency;
22+
var currentFrequency = summary.HostEnvironmentInfo.Cpu.Value.MaxFrequency();
2323
if (!currentFrequency.HasValue || currentFrequency <= 0)
2424
currentFrequency = FallbackCpuResolutionValue.ToFrequency();
2525

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using System;
2+
using BenchmarkDotNet.Exporters;
3+
4+
namespace BenchmarkDotNet.Attributes;
5+
6+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
7+
public class PhdExporterAttribute() : ExporterConfigBaseAttribute(new PhdJsonExporter());

src/BenchmarkDotNet/BenchmarkDotNet.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
</PropertyGroup>
1414
<ItemGroup>
1515
<EmbeddedResource Include="Templates\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
16-
<EmbeddedResource Include="Environments\microarchitectures.txt" />
1716
</ItemGroup>
1817
<ItemGroup>
1918
<PackageReference Include="CommandLineParser" Version="2.9.1" />
2019
<PackageReference Include="Gee.External.Capstone" Version="2.3.0" />
2120
<PackageReference Include="Iced" Version="1.17.0" />
2221
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.2.332302" />
23-
<PackageReference Include="Perfolizer" Version="[0.3.17]" />
22+
<!-- <PackageReference Include="Perfolizer" Version="[0.3.17]" />-->
2423
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.8" PrivateAssets="contentfiles;analyzers" />
2524
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
2625
<!-- Do not update these packages, or else netcoreapp3.0 and older will no longer work -->
@@ -47,6 +46,7 @@
4746
<EmbeddedResource Include="Disassemblers\net462\win7-x64\Iced.dll" />
4847
</ItemGroup>
4948
<ItemGroup>
49+
<ProjectReference Include="..\..\..\perfolizer\src\Perfolizer\Perfolizer\Perfolizer.csproj" />
5050
<ProjectReference Include="..\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj" />
5151
</ItemGroup>
5252
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETStandard' ">

src/BenchmarkDotNet/Configs/DefaultConfig.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.IO;
55
using BenchmarkDotNet.Analysers;
66
using BenchmarkDotNet.Columns;
7+
using BenchmarkDotNet.Detectors;
78
using BenchmarkDotNet.Diagnosers;
89
using BenchmarkDotNet.EventProcessors;
910
using BenchmarkDotNet.Exporters;
@@ -90,7 +91,7 @@ public string ArtifactsPath
9091
{
9192
get
9293
{
93-
var root = RuntimeInformation.IsAndroid() ?
94+
var root = OsDetector.IsAndroid() ?
9495
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) :
9596
Directory.GetCurrentDirectory();
9697
return Path.Combine(root, "BenchmarkDotNet.Artifacts");

src/BenchmarkDotNet/Portability/Cpu/HardwareIntrinsics.cs renamed to src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
using System.Collections.Generic;
33
using System.Diagnostics.CodeAnalysis;
44
using System.Numerics;
5-
using BenchmarkDotNet.Environments;
65
using System.Text;
7-
6+
using BenchmarkDotNet.Environments;
87
#if NET6_0_OR_GREATER
98
using System.Runtime.Intrinsics.X86;
109
using System.Runtime.Intrinsics.Arm;
1110
#endif
1211

13-
namespace BenchmarkDotNet.Portability.Cpu
12+
namespace BenchmarkDotNet.Detectors.Cpu
1413
{
1514
internal static class HardwareIntrinsics
1615
{

0 commit comments

Comments
 (0)