Exemple #1
0
        private void profileKernelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IntPtr baseAddress;
            uint   size = this.GetKernelModeCodeRange(out baseAddress);

            _kernelModules = new Dictionary <IntPtr, KernelModule>();

            foreach (var module in Windows.GetKernelModules())
            {
                _kernelModules.Add(module.BaseAddress, module);
            }

            _profileBase   = baseAddress;
            _profileSize   = size;
            _bucketSizeLog = 6; // 64 byte bucket size
            _bucketSize    = (uint)(2 << (_bucketSizeLog - 1));
            _profileHandle = ProfileHandle.Create(
                null,
                baseAddress,
                size,
                _bucketSizeLog,
                KProfileSource.ProfileTime,
                IntPtr.Zero
                );
            ProfileHandle.SetInterval(KProfileSource.ProfileTime, 1); // 100 nanoseconds

            this.LoadKernelSymbols();
        }