Remove code that was moved to System.Native (dotnet/corertdotnet/coreclr#6932)
authorFilip Navara <filip.navara@gmail.com>
Mon, 4 Feb 2019 13:09:20 +0000 (14:09 +0100)
committerJan Kotas <jkotas@microsoft.com>
Mon, 4 Feb 2019 15:27:59 +0000 (07:27 -0800)
* 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>
Commit migrated from https://github.com/dotnet/coreclr/commit/cee7a5596992f2c25a262c1f081d29c2951cac19

src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.GetCpuUtilization.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.GetSystemTimeAsTicks.cs [new file with mode: 0644]
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

diff --git a/src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.GetCpuUtilization.cs b/src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.GetCpuUtilization.cs
new file mode 100644 (file)
index 0000000..35e77c4
--- /dev/null
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+    internal unsafe partial class Sys
+    {
+        [StructLayout(LayoutKind.Sequential)]
+        internal struct ProcessCpuInformation
+        {
+            ulong lastRecordedCurrentTime;
+            ulong lastRecordedKernelTime;
+            ulong lastRecordedUserTime;
+        }
+
+        [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCpuUtilization")]
+        internal static extern unsafe int GetCpuUtilization(ref ProcessCpuInformation previousCpuInfo);
+    }
+}
diff --git a/src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.GetSystemTimeAsTicks.cs b/src/libraries/System.Private.CoreLib/src/Interop/Unix/System.Native/Interop.GetSystemTimeAsTicks.cs
new file mode 100644 (file)
index 0000000..d33b3f3
--- /dev/null
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+    internal unsafe partial class Sys
+    {
+        [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetSystemTimeAsTicks")]
+        internal static extern long GetSystemTimeAsTicks();
+    }
+}
index b113504..1fe9b28 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.FLock.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.FSync.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.FTruncate.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetCpuUtilization.cs" Condition="'$(FeaturePortableThreadPool)' == 'true'" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetCwd.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetEUid.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetHostName.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetPwUid.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetSystemTimeAsTicks.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetTimestamp.cs" Condition="'$(FeaturePortableThreadPool)' == 'true'" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetUnixName.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetUnixRelease.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.LockFileRegion.cs" />