COMException (segmentation fault) when running HardwareCounters
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- csharp
調査の方向性
まず、提供された net8.0 デモを HardwareCounters 付きで実行し、Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableKernelProvider、BenchmarkDotNet.Diagnostics.Windows.KernelSession.EnableProviders、EtwProfiler.Start で発生する失敗を確認します。Windows 11 の COMException を再現し、ハードウェアカウンターの実行を成功させるために必要な条件を特定します。ベンチマークがリソース使用中の例外や Segmentation fault なしで実行されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hello,
I am trying hardware counters for the first time after finding this article. I have unfortunately been unable to use these counters as I run into an exception when using them. I have stripped everything back to a tiny demo and still receive the error.
I'm on Windows 11 Pro.
My dotnet --version is 8.0.412.
$ dotnet run -c Release
// Validating benchmarks:
// ***** BenchmarkRunner: Start *****
// ***** Found 1 benchmark(s) in total *****
// ***** Building 1 exe(s) in Parallel: Start *****
// start dotnet restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true /p:ArtifactsPath="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1/" /p:OutDir="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\bin\Release\net8.0/" /p:OutputPath="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\bin\Release\net8.0/" /p:PublishDir="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\publish/" in C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1
// command took 0.62 sec and exited with 0
// start dotnet build -c Release --no-restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true /p:ArtifactsPath="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1/" /p:OutDir="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\bin\Release\net8.0/" /p:OutputPath="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\bin\Release\net8.0/" /p:PublishDir="C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\publish/" --output "C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\bin\Release\net8.0/" in C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1
// command took 3.23 sec and exited with 0
// ***** Done, took 00:00:03 (3.88 sec) *****
// Found 1 benchmarks:
// DemoClass.Demo: DefaultJob
Setup power plan (GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c FriendlyName: High performance)
// **************************
// Benchmark: DemoClass.Demo: DefaultJob
// *** Execute ***
// Launch: 1 / 1
// Execute: dotnet Benchmarking-DefaultJob-1.dll --anonymousPipes 1764 1440 --benchmarkName DemoClass.Demo --job Default --benchmarkId 0 in C:\Users\{some-directory}\bin\Release\net8.0\Benchmarking-DefaultJob-1\bin\Release\net8.0
Unhandled exception. System.Runtime.InteropServices.COMException (0x800700AA): The requested resource is in use. (0x800700AA)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableKernelProvider(Keywords flags, Keywords stackCapture)
at BenchmarkDotNet.Diagnostics.Windows.KernelSession.EnableProviders()
at BenchmarkDotNet.Diagnostics.Windows.EtwProfiler.Start(DiagnoserActionParameters parameters)
at BenchmarkDotNet.Diagnostics.Windows.EtwProfiler.Handle(HostSignal signal, DiagnoserActionParameters parameters)
at BenchmarkDotNet.Diagnosers.CompositeDiagnoser.Handle(HostSignal signal, DiagnoserActionParameters parameters)
at BenchmarkDotNet.Toolchains.DotNetCli.DotNetCliExecutor.Execute(BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, ILogger logger, ArtifactsPaths artifactsPaths, IDiagnoser diagnoser, String executableName, IResolver resolver, Int32 launchIndex)
at BenchmarkDotNet.Toolchains.DotNetCli.DotNetCliExecutor.Execute(ExecuteParameters executeParameters)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.RunExecute(ILogger logger, BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, IToolchain toolchain, BuildResult buildResult, IResolver resolver, IDiagnoser diagnoser, Int32 launchIndex)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.Execute(ILogger logger, BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, IToolchain toolchain, BuildResult buildResult, IResolver resolver)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.RunCore(BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, ILogger logger, IResolver resolver, BuildResult buildResult)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo benchmarkRunInfo, Dictionary`2 buildResults, IResolver resolver, ILogger logger, EventProcessor eventProcessor, List`1 artifactsToCleanup, String resultsFolderPath, String logFilePath, Int32 totalBenchmarkCount, StartedClock& runsChronometer, Int32& benchmarksToRunCount, TaskbarProgress taskbarProgress)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo[] benchmarkRunInfos)
at BenchmarkDotNet.Running.BenchmarkRunner.RunWithDirtyAssemblyResolveHelper(Type type, IConfig config, String[] args)
at BenchmarkDotNet.Running.BenchmarkRunner.<>c__DisplayClass0_0`1.<Run>b__0()
at BenchmarkDotNet.Running.BenchmarkRunner.RunWithExceptionHandling(Func`1 run)
at BenchmarkDotNet.Running.BenchmarkRunner.Run[T](IConfig config, String[] args)
at Program.<Main>$(String[] args) in C:\Users\{some-directory}\Program.cs:line 5
Successfully reverted power plan (GUID: 381b4222-f694-41f0-9685-ff5bb260df2e FriendlyName: Balanced)
// * Artifacts cleanup *
Artifacts cleanup is finished
Segmentation fault
Here is my program.
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Running;
var summary = BenchmarkRunner.Run<DemoClass>();
Console.WriteLine(summary);
[MemoryDiagnoser]
[HardwareCounters(HardwareCounter.BranchMispredictions, HardwareCounter.BranchInstructions)]
public class DemoClass
{
[Benchmark]
public int Demo() => 1 + 2;
}
And here is my csproj.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../{ProgramName}.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.15.2" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.2" />
</ItemGroup>
</Project>
- 主要言語
- C#
- スター
- 11.5k
- フォーク
- 1.1k
- 平均マージ
- 1日 21分
- マージ済み PR(30日)
- 25
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/BenchmarkDotNet のほかの issue
-
Area:Toolchains up-for-grabs
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
dotnet/BenchmarkDotNet#3266 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Area:Diagnosers
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
dotnet/BenchmarkDotNet#3246 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Migrate release/release-preview workflow to use Trusted Publishing再び着手できるかも @AndreyAkinshin が 51 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンArea:DevOps
dotnet/BenchmarkDotNet#3226 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Area:CommandLine
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
dotnet/BenchmarkDotNet#3182 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
Area:Diagnosers
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
dotnet/BenchmarkDotNet#3158 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
dotnet/BenchmarkDotNet の issue をすべて見る
似ている issue
-
area-ai untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
dotnet/extensions#7790 ·
メンテナーはふだん 1 日以内に返信
-
P2 testing
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#134766 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
0 - Backlog Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
BrighterCommand/Brighter#4444 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信