Search code examples
windows-8cpucpu-cachecpu-speed

How can i check my CPU cache in Windows 8?


i have a problem: i can not find any panel or command in windows 8 which can show me my CPU cache?

there is some softwares can get sysconfig. but those are not full info. it's completely all information except CPU_CACHE.


Solution

  • You can use WMI to query the Cache. Here is a small C# program:

    using System;
    using System.Management;
    using System.Windows.Forms;
    
    namespace WMISample
    {
        public class MyWMIQuery
        {
            public static void Main()
            {
                try
                {
                    ManagementObjectSearcher searcher = 
                        new ManagementObjectSearcher("root\\CIMV2", 
                        "SELECT * FROM Win32_Processor"); 
    
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        Console.WriteLine("-----------------------------------");
                        Console.WriteLine("Win32_Processor instance");
                        Console.WriteLine("-----------------------------------");
                        Console.WriteLine("L2CacheSize: {0}", queryObj["L2CacheSize"]);
                        Console.WriteLine("L3CacheSize: {0}", queryObj["L3CacheSize"]);
                    }
                }
                catch (ManagementException e)
                {
                    MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
                }
            }
        }
    }