×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùʹÓÃLinux¾ÙÐÐCPUÐÔÄܵ÷ÓÅ

ÔõÑùʹÓÃlinux¾ÙÐÐcpuÐÔÄܵ÷ÓÅ

µ¼ÑÔ£º

Ëæ×ÅÅÌËã»úÊÖÒÕµÄÒ»Ö±Éú³¤£¬CPUÐÔÄܵ÷ÓųÉΪÐí¶àϵͳÖÎÀíÔ±ºÍ¿ª·¢Ö°Ô±¹Ø×¢µÄ½¹µã¡£Linux²Ù×÷ϵͳÌṩÁËÇ¿Ê¢µÄ¹¤¾ßºÍÏÂÁîÀ´×ÊÖúÎÒÃǾÙÐÐCPUÐÔÄܵ÷ÓÅ£¬±¾ÎĽ«ÏÈÈݼ¸ÖÖ³£ÓõÄÒªÁìºÍ¼¼ÇÉ£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£

Ò»¡¢Éó²éCPUÐÅÏ¢

ÔÚ×îÏÈCPUÐÔÄܵ÷ÓÅ֮ǰ£¬ÎÒÃÇÊ×ÏÈÐèÒªÏàʶĿ½ñϵͳÖеÄCPUÐÅÏ¢¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´Éó²éCPUµÄÐͺš¢½¹µãÊý¡¢ÆµÂʵÈÐÅÏ¢£º

cat /proc/cpuinfo

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁÊä³öCPUµÄÏêϸÐÅÏ¢£¬ÈçͼËùʾ£º

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 158
model name  : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
stepping    : 9
microcode   : 0x8e
cpu MHz     : 1440.000
cache size  : 6144 KB
physical id : 0
siblings    : 8
core id     : 0
cpu cores   : 4
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes

µÇ¼ºó¸´ÖÆ

̫ͨ¹ýÎöÕâЩÐÅÏ¢£¬ÎÒÃÇ¿ÉÒÔÏàʶµ½Õâ¸öϵͳÖеÄCPU¾ßÓÐËĸö½¹µã¡¢°Ë¸öỊ̈߳¬²¢ÇÒÓµÓÐ2.80GHzµÄƵÂÊ¡£

¶þ¡¢µ÷½âCPUµ÷ÀíÕ½ÂÔ

LinuxĬÈϽÓÄɵÄÊÇCFS(C Completely Fair Scheduler)µ÷ÀíËã·¨£¬¸ÃËã·¨»á¹«ÕýµØ·ÖÅÉCPUʱ¼ä¸øÿ¸öÀú³Ì¡£µ«ÔÚһЩÌض¨³¡¾°Ï£¬ÎÒÃÇ¿ÉÄÜÐèÒªµ÷½âCPUµ÷ÀíÕ½ÂÔÒÔÓÅ»¯ÐÔÄÜ¡£

Éó²éÄ¿½ñCPUµ÷ÀíÕ½ÂÔ£º

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁÊä³öÄ¿½ñÿ¸öCPU½¹µãµÄµ÷ÀíÕ½ÂÔ£¬Í¨³£ÇéÐÎÏÂÓ¦¸ÃÊÇ’ondemand’»ò’powersave’¡£

ÐÞ¸ÄCPUµ÷ÀíÕ½ÂÔΪ’performance’£º

echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁ½«CPUµ÷ÀíÕ½ÂÔÐÞ¸ÄΪ’performance’ģʽ£¬¸Ãģʽ»áÈÃCPUʼÖÕÊÂÇéÔÚ×î¸ßƵÂÊ£¬ÒÔ»ñÈ¡×î´óµÄÐÔÄÜ¡£

Èý¡¢ÏÞÖÆCPU×ÊÔ´

ÔÚһЩÇ龳ϣ¬ÎÒÃÇÐèÒª¶ÔϵͳÖеÄij¸öÀú³Ì»òÀú³Ì×é¾ÙÐÐCPU×ÊÔ´µÄÏÞÖÆ£¬ÒÔ×èֹij¸öÀú³ÌÕ¼Óùý¶àµÄCPU×ÊÔ´¶øÓ°ÏìÆäËûÀú³Ì¡£

ʹÓÃcpulimitÏÂÁîÏÞÖÆÀú³ÌµÄCPUʹÓÃÂÊ£º

sudo apt-get install cpulimit
cpulimit -l 50 -p <PID>

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÏÂÁÏÞÖÆÀú³ÌµÄCPUʹÓÃÂÊΪ50%¡£PIDÐèÒªÌ滻ΪÄãÒªÏÞÖƵÄÀú³ÌµÄÀú³ÌID¡£

ËÄ¡¢Ê¹ÓÃÐÔÄÜÆÊÎö¹¤¾ß

Õë¶ÔÖØ´óµÄÓ¦ÓóÌÐò£¬ÎÒÃÇ¿ÉÒÔ½èÖúÐÔÄÜÆÊÎö¹¤¾ßÀ´ÉîÈëÆÊÎöCPUµÄÐÔÄÜÆ¿¾±¡£

ʹÓÃperf¹¤¾ß£º

perfÊÇLinuxÄÚºËÌṩµÄÐÔÄÜÆÊÎö¹¤¾ß£¬¿ÉÒÔÓÃÀ´¶ÔCPUÐÔÄܾÙÐÐͳ¼ÆÆÊÎö¡£

sudo apt-get install linux-tools-common # ×°ÖÃperf¹¤¾ß
sudo perf top # Ö´ÐÐÐÔÄÜÆÊÎö

µÇ¼ºó¸´ÖÆ

ʹÓÃperf topÏÂÁî¿ÉÒÔÉó²éϵͳÖÐÄ¿½ñÕ¼ÓÃCPU×ÊÔ´½Ï¸ßµÄÀú³ÌºÍº¯ÊýŲÓá£

±ðµÄ£¬ÉÐÓÐһЩÆäËûµÄÐÔÄÜÆÊÎö¹¤¾ß£¬Èçgprof¡¢oprofileµÈ£¬¶ÁÕß¿ÉÒÔƾ֤ÏÖʵÐèÇóÑ¡ÔñºÏÊʵŤ¾ß¾ÙÐÐʹÓá£

½áÓ

±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃlinux¾ÙÐÐcpuÐÔÄܵ÷ÓÅ£¬Ï£Íû¶ÁÕßÄܹ»Í¨¹ýÕâЩҪÁìºÍ¼¼ÇɸÄÉÆϵͳµÄÐÔÄÜ¡£ÔÚÏÖʵµÄµ÷ÓÅÀú³ÌÖУ¬»¹ÐèҪƾ֤ÏêϸµÄÇéÐκÍÐèÇó¾ÙÐÐÏêϸµÄµ÷ÓÅÕ½ÂÔÖƶ©£¬²¢Ê¹ÓÃϵͳÌṩµÄ¹¤¾ßºÍÏÂÁî¾ÙÐмà¿ØºÍÓÅ»¯¡£Ö»ÓÐÒ»Ö±µÄʵ¼ùºÍµ÷ÊÔ£¬²Å»ªµÖ´ï×î¼ÑµÄÐÔÄܵ÷ÓÅЧ¹û¡£

ÒÔÉϾÍÊÇÔõÑùʹÓÃLinux¾ÙÐÐCPUÐÔÄܵ÷ÓŵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ