dotnet / BenchmarkDotNet

Powerful .NET library for benchmarking
https://benchmarkdotnet.org
MIT License
10.63k stars 973 forks source link

Cross platform disassembler doensn't output anything on macOS #1499

Open NinoFloris opened 4 years ago

NinoFloris commented 4 years ago

Cross platform disassembler doesn't output anything on macOS

Details: .net core 5.0 preview 6, BDN 0.12.1 (which should have xplat support)

For a benchmark like

open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running

type Service =
    abstract Prop : int

[<Sealed>]
type Impl() =
    interface Service with
        member x.Prop = 1

[<DisassemblyDiagnoser(exportGithubMarkdown= true)>]
type Devirt() =
    [<Benchmark>]
    member _.DevirtProp() = (Impl() :> Service).Prop

[<EntryPoint>]
let main argv =
   BenchmarkRunner.Run<Devirt>() |> ignore
   0

BDN returns

// Diagnostic Output - DisassemblyDiagnoser No benchmarks were disassembled

This does not seem to be an F# issue, a quick port of this benchmark to C# bore no fruit either.

0xd4d commented 4 years ago

Could be that clrmd is unable to read anything from the process. Updating to latest 1.x or trying 2.x could possibly fix that https://www.nuget.org/packages/Microsoft.Diagnostics.Runtime/

adamsitnik commented 2 years ago

I've ported BDN to use ClrMd2 (https://github.com/dotnet/BenchmarkDotNet/pull/2040) but I was not able to get macOS support: https://github.com/microsoft/clrmd/issues/1034

It seems that attaching a debugger to another process requires a lot of work on macOS: http://os-tres.net/blog/2010/02/17/mac-os-x-and-task-for-pid-mach-call/