CoreFreq£ºLinuxϵÄCPUƵÂʼà¿Ø¹¤¾ßÏÈÈÝ
CoreFreq£ºLinuxϵÄCPUƵÂʼà¿Ø¹¤¾ßÏÈÈÝ
ÔÚLinuxϵͳÖУ¬¹ØÓÚCPUƵÂʵļà¿ØºÍÖÎÀíÒ»Ö±ÊÇÒ»¸ö½ÏÁ¿Ö÷ÒªµÄʹÃü¡£Í¨¹ý¼à¿ØCPUµÄƵÂÊ£¬ÎÒÃÇ¿ÉÒÔʵʱÏàʶCPUµÄÔËÐÐ״̬£¬µ÷½âƵÂÊÒÔÌá¸ßÐÔÄÜ»ò½µµÍ¹¦ºÄ¡£ÔÚLinuxϵͳÖУ¬ÓÐÐí¶à¹¤¾ß¿ÉÒÔÓÃÀ´¼à¿ØCPUƵÂÊ£¬ÆäÖÐÒ»¸ö½ÏÁ¿ÓÅÒìµÄ¹¤¾ßÊÇCoreFreq¡£±¾ÎĽ«ÏÈÈÝCoreFreq¹¤¾ßµÄ»ù±¾¹¦Ð§ÒÔ¼°ÔõÑùÔÚLinuxϵͳÖÐ×°ÖúÍʹÓÃËü¡£
CoreFreq¼ò½é
CoreFreqÊÇÒ»¸öÕë¶ÔIntelºÍAMD´¦ÀíÆ÷µÄ¸ß¼¶CPUƵÂʼà¿Ø¹¤¾ß£¬Ö¼ÔÚÌṩÏêϸµÄCPUƵÂʺ͹¦ºÄÐÅÏ¢£¬×ÊÖúÓû§ÓÅ»¯CPUµÄÐÔÄܺ͹¦ºÄ¡£CoreFreqÖ§³Ö¶àÖÖCPU¼Ü¹¹£¬²¢ÌṩÁ˸»ºñµÄ¹¦Ð§ºÍ²ÎÊýÑ¡Ï¿ÉÒÔÀû±ãµØ¼à¿ØCPUµÄÐÔÄܺ͹¦ºÄÇéÐΡ£
×°ÖÃCoreFreq
ÔÚLinuxϵͳÖÐ×°ÖÃCoreFreqºÜÊǼòÆÓ£¬¿ÉÒÔͨ¹ý°ü¹ÜÀí¹¤¾ß»òÔ´´úÂë¾ÙÐÐ×°Öá£ÒÔÏÂÊÇʹÓðü¹ÜÀí¹¤¾ß×°ÖÃCoreFreqµÄ°ì·¨£º
¹ØÓÚ»ùÓÚDebianµÄϵͳ£¨ÈçUbuntu£©£º
sudo apt-get update sudo apt-get install corefreq
µÇ¼ºó¸´ÖÆ
¹ØÓÚ»ùÓÚFedoraµÄϵͳ£º
sudo dnf install corefreq
µÇ¼ºó¸´ÖÆ
¹ØÓÚÆäËû¿¯Ðа棬¿ÉÒÔ´ÓÔ´´úÂë±àÒë×°Öá£Ê×ÏÈÏÂÔØCoreFreqµÄÔ´´úÂë°ü£¬È»ºóÖ´ÐÐÒÔÏÂÏÂÁî¾ÙÐбàÒëºÍ×°Öãº
tar -zxvf CoreFreq-X.X.X.tar.gz cd CoreFreq-X.X.X make sudo make install
µÇ¼ºó¸´ÖÆ
ʹÓÃCoreFreq
×°ÖÃÍê³Éºó£¬¿ÉÒÔͨ¹ýÏÂÁîÐлòͼÐνçÃæÀ´Æô¶¯CoreFreq¡£ÒÔÏÂÊÇһЩ³£ÓõÄÏÂÁîʾÀý£º
Æô¶¯CoreFreqÏÂÁîÐнçÃ棺
sudo corefreq-cli
µÇ¼ºó¸´ÖÆ
Æô¶¯CoreFreqͼÐνçÃ棺
sudo corefreq-gtk
µÇ¼ºó¸´ÖÆ
ʾÀý´úÂë
ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄPython¾ç±¾Ê¾Àý£¬Ê¹ÓÃCoreFreqÌṩµÄAPI»ñÈ¡CPUƵÂÊÐÅÏ¢²¢´òÓ¡³öÀ´£º
import corefreq_api corefreq_api.init() corefreq_api.enable_event_sampling() corefreq_api.start_monitor() for core in corefreq_api.core_list.values(): print(f"Core {core.core_id}:") for freq in core.freq.values(): print(f"Frequency: {freq.actual/1000} GHz") corefreq_api.stop_monitor() corefreq_api.finish()
µÇ¼ºó¸´ÖÆ
ͨ¹ýÒÔÉÏ´úÂëʾÀý£¬ÎÒÃÇ¿ÉÒÔ¿´µ½ÔõÑùʹÓÃCoreFreqµÄAPIÀ´»ñÈ¡CPUƵÂÊÐÅÏ¢£¬²¢¶ÔÆä¾ÙÐд¦Àí¡£
×ܽáһϣ¬CoreFreqÊÇÒ»¸ö¹¦Ð§Ç¿Ê¢µÄLinuxϵÄCPUƵÂʼà¿Ø¹¤¾ß£¬¿ÉÒÔ×ÊÖúÓû§¼à¿ØCPUµÄÐÔÄܺ͹¦ºÄÇéÐΡ£Í¨¹ý±¾ÎĵÄÏÈÈÝ£¬ÐÅÍжÁÕß¿ÉÒÔ¸üºÃµØÏàʶCoreFreqµÄ»ù±¾¹¦Ð§ºÍʹÓÃÒªÁ죬´Ó¶ø¸üºÃµØ¾ÙÐÐCPUƵÂÊÖÎÀíºÍÓÅ»¯¡£
ÒÔÉϾÍÊÇCoreFreq£ºLinuxϵÄCPUƵÂʼà¿Ø¹¤¾ßÏÈÈݵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡