Remove code that was moved to System.Native#6932
Conversation
Yup |
8898088 to
33c2d0b
Compare
|
Oh, right... I totally forgot that ProjectN is Windows-only. |
33c2d0b to
becd5a3
Compare
|
|
||
| // Cache the frequency on the managed side to avoid the cost of P/Invoke on every access to Frequency | ||
| public static ulong Frequency { get; } = Interop.Sys.GetHighPrecisionCounterFrequency(); | ||
| static HighPerformanceCounter() |
There was a problem hiding this comment.
Explicit static constructors are not good for performance.
There was a problem hiding this comment.
What is the recommended pattern then? LazyInitializer? This class has just two fields and anyone using it is bound to use both, so I assumed it would be ok.
There was a problem hiding this comment.
Non-explicit before field constructor like what was there before or like what is in the Windows version.
There was a problem hiding this comment.
I see. The Windows version works for this. The Unix version cannot be used because of the out parameter in the CoreFX prototype of the native function.
There was a problem hiding this comment.
The Windows version has the same out parameter: https://github.com/dotnet/corert/blob/master/src/System.Private.CoreLib/src/System/HighPerformanceCounter.Windows.cs#L22
Yep. The best way to do that is to submit a PR to CoreFX first to move them. |
Only two of them exist there, I can do it for them. The other two never had the C# declaration in CoreFX. |
b2b3220 to
5f0c07e
Compare
* Remove code that was already moved from System.Private.CoreLib.Native to System.Native. * Move Interop files for System.Native to shared Interop directory. * Add FeaturePortableThreadPool conditions to csproj files. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Remove code that was already moved from System.Private.CoreLib.Native to System.Native. * Move Interop files for System.Native to shared Interop directory. * Add FeaturePortableThreadPool conditions to csproj files. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Remove code that was already moved from System.Private.CoreLib.Native to System.Native. * Move Interop files for System.Native to shared Interop directory. * Add FeaturePortableThreadPool conditions to csproj files. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Remove code that was already moved from System.Private.CoreLib.Native to System.Native. * Move Interop files for System.Native to shared Interop directory. * Add FeaturePortableThreadPool conditions to csproj files. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Remove code that was already moved from System.Private.CoreLib.Native to System.Native. * Move Interop files for System.Native to shared Interop directory. * Add FeaturePortableThreadPool conditions to csproj files. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Remove code that was already moved from System.Private.CoreLib.Native to System.Native. * Move Interop files for System.Native to shared Interop directory. * Add FeaturePortableThreadPool conditions to csproj files. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Testing build. I assume the C# P/Invoke prototypes should be moved to shared CoreLib (to be in CoreFX too). Will this be ok with ProjectN?