<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="11.0.0" />

System.Diagnostics.PerformanceCounterInstanceLifetime

Specifies the lifetime of a performance counter instance.
Global = 0

Remove the performance counter instance when no counters are using the process category.

Process = 1

Remove the performance counter instance when the process is closed.