コード例 #1
0
        public static int GetInterval(KProfileSource profileSource)
        {
            int interval;

            Win32.NtQueryIntervalProfile(profileSource, out interval).ThrowIf();

            return(interval);
        }
コード例 #2
0
        public static void SetInterval(KProfileSource profileSource, int interval)
        {
            NtStatus status;

            if ((status = Win32.NtSetIntervalProfile(interval, profileSource)) >= NtStatus.Error)
            {
                Win32.Throw(status);
            }
        }
コード例 #3
0
        public static int GetInterval(KProfileSource profileSource)
        {
            NtStatus status;
            int      interval;

            if ((status = Win32.NtQueryIntervalProfile(profileSource, out interval)) >= NtStatus.Error)
            {
                Win32.Throw(status);
            }

            return(interval);
        }
コード例 #4
0
        public static ProfileHandle Create(
            ProcessHandle processHandle,
            IntPtr rangeBase,
            uint rangeSize,
            int bucketSize,
            KProfileSource profileSource,
            IntPtr affinity
            )
        {
            NtStatus status;
            IntPtr   handle;

            if (bucketSize < 2 || bucketSize > 30)
            {
                throw new ArgumentException("Bucket size must be between 2 and 30, inclusive.");
            }

            unchecked
            {
                uint        realBucketSize = (uint)(2 << (bucketSize - 1));
                MemoryAlloc buffer         = new MemoryAlloc((int)((rangeSize - 1) / realBucketSize + 1) * sizeof(int)); // divide, round up

                if ((status = Win32.NtCreateProfile(
                         out handle,
                         processHandle ?? IntPtr.Zero,
                         rangeBase,
                         new IntPtr(rangeSize),
                         bucketSize,
                         buffer,
                         buffer.Size,
                         profileSource,
                         affinity
                         )) >= NtStatus.Error)
                {
                    Win32.Throw(status);
                }

                return(new ProfileHandle(handle, true, rangeBase, rangeSize, realBucketSize, buffer));
            }
        }
コード例 #5
0
 public static void SetInterval(KProfileSource profileSource, int interval)
 {
     Win32.NtSetIntervalProfile(interval, profileSource).ThrowIf();
 }