public static CpuUsage?Get(CpuUsageScope scope)
        {
            long kernelMicroseconds;
            long userMicroseconds;
            bool isOk;

            if (scope == CpuUsageScope.Thread)
            {
                isOk = WindowsCpuUsageInterop.GetThreadTimes(out kernelMicroseconds, out userMicroseconds);
            }
            else
            {
                isOk = WindowsCpuUsageInterop.GetProcessTimes(out kernelMicroseconds, out userMicroseconds);
            }

            if (!isOk)
            {
                return(null);
            }

            const long m = 1000000L;

            return(new CpuUsage()
            {
                KernelUsage = new TimeValue()
                {
                    Seconds = kernelMicroseconds / m, MicroSeconds = kernelMicroseconds % m
                },
                UserUsage = new TimeValue()
                {
                    Seconds = userMicroseconds / m, MicroSeconds = userMicroseconds % m
                },
            });
        }
        public static long GetThreadId()
        {
            if (CrossInfo.ThePlatform == CrossInfo.Platform.Linux)
            {
                return(pthread_self_onLinux().ToInt64());
            }

            else if (CrossInfo.ThePlatform == CrossInfo.Platform.MacOSX)
            {
                return(MacOsThreadInfoInterop.mach_thread_self());
            }

            else if (CrossInfo.ThePlatform == CrossInfo.Platform.Windows)
            {
                return(WindowsCpuUsageInterop.GetCurrentThread().ToInt64());
            }

            throw new NotSupportedException($"Platform '{CrossInfo.ThePlatform}' is not supported");
        }