{"id":1635,"date":"2020-09-21T17:15:59","date_gmt":"2020-09-21T09:15:59","guid":{"rendered":"http:\/\/iqotom.com\/?p=1635"},"modified":"2020-09-21T17:16:05","modified_gmt":"2020-09-21T09:16:05","slug":"linux%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae%e6%9f%a5%e7%9c%8bcpu%e9%a2%91%e7%8e%87","status":"publish","type":"post","link":"http:\/\/iqotom.com\/?p=1635","title":{"rendered":"Linux\u5982\u4f55\u8bbe\u7f6e\u67e5\u770bCPU\u9891\u7387"},"content":{"rendered":"\n<p style=\"font-size:18px\">\u9700\u8981\u5b89\u88c5<code>cpufrequtils<\/code>\u3002\u6b64\u8f6f\u4ef6\u662f\u67e5\u770bcpu\u5f53\u524d\u9891\u7387\u4ee5\u53ca\u4fee\u6539\u9891\u7387\u3001\u9009\u62e9cpu\u3001\u9009\u62e9cpu\u8fd0\u884c\u65b9\u5f0f\u7684\u3002\u6ce8\u610f\uff0c\u53ea\u652f\u6301\u67d0\u4e9b\u53ef\u8c03\u8282\u9891\u7387\u7684cpu\uff0c\u5982intel\u7684\u7b14\u8bb0\u672ccpu\u3002\u53ef\u80fd\u53ef\u4ee5\u8d85\u9891 \uff0c\u6ca1\u6562\u5b9e\u9a8c\uff0c\u90a3\u4f4d\u8bd5\u8bd5\u770b\u597d\u4e86\u3002 <\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p><code>cpufreq-info, cpufreq-selector, cpufreq-set<\/code>\u3002<br>\u5177\u4f53\u7528\u6cd5\u53ef\u4ee5\u770bman\uff0c\u6216\u8005\u5728\u547d\u4ee4\u540e\u52a0-h\u3002<br>\u6bd4\u5982<code>man cpufreq-info<\/code> \u6216\u8005 <code>cpufreq-info -h<\/code> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"> \u4e00\u3001\u67e5\u770bcpu\u7c7b\u578b\u3001\u5f53\u524d\u9891\u7387\u3001\u652f\u6301\u9891\u7387\u3001\u8fd0\u884c\u6a21\u5f0f\u7b49\u3002 <\/h2>\n\n\n\n<p><strong>cpufreq-info<\/strong><br>\u8fd9\u662f\u6211\u7684cpu\u5728powersave\u6a21\u5f0f\u4e0b\u7684\u60c5\u51b5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">zhuqin@ubuntu:~$ cpufreq-info \ncpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006\nReport errors and bugs to [email]linux@brodo.de[\/email]\">linux@brodo.de, please.\nanalyzing CPU 0:\ndriver: centrino\nCPUs which need to switch frequency at the same time: 0\nhardware limits: 798 MHz - 1.73 GHz\navailable frequency steps: 1.73 GHz, 1.73 GHz, 1.73 GHz, 1.73 GHz, 1.73GHz, 1.73 GHz, 1.73 GHz, 1.33 GHz, 1.06 GHz, 798 MHz\navailable cpufreq governors: powersave, userspace, ondemand, conservative, performance\ncurrent policy: frequency should be within 798 MHz and 1.73 GHz.\nThe governor \"powersave\" may decide which speed to use\nwithin this range.\ncurrent CPU frequency is 798 MHz.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">  \u4e8c\u3001\u9009\u62e9\u9700\u8981\u8c03\u6574\u7684cpu <\/h2>\n\n\n\n<p><code>sudo cpufreq-selector -c cpu<\/code>\u53f7\u6216\u8005<code>sudo cpufreq-set -c cpu<\/code>\u53f7<br>\u53ef\u80fd\u5bf9\u53cc\u6838\u6216\u591a\u6838cpu\u8fdb\u884c\u9009\u62e9\u3002\u6211\u7684\u4e0d\u662f\u53cc\u6838\uff0c\u6ca1\u6cd5\u5b9e\u9a8c\uff0c\u8fd8\u8bf7\u6709duo core\u7684\u670b\u53cb\u5b9e\u9a8c\u4e00\u4e0b\u5e76\u8ddf\u5e16\u6c47\u62a5\u60c5\u51b5\u3002 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001 \u8c03\u6574cpu\u9891\u7387 <\/h2>\n\n\n\n<p><code>sudo cpufreq-selector -f <\/code>\u4f60\u6240\u9700\u8981\u7684\u9891\u7387\u6216\u8005<code>sudo cpufreq-set -f<\/code> \u4f60\u6240\u9700\u8981\u7684\u9891\u7387<br>\u6ce8\u610f\uff0c\u6b64\u5904\u7684\u9891\u7387\u5fc5\u987b\u662f\u4ee5KHz\u4e3a\u5355\u4f4d\uff0c\u5e76\u4e14\u662f\u53ef\u4ee5\u8fbe\u5230\u7684\u9891\u7387\uff08\u4e5f\u5c31\u662f\u7528cpufreq-info\u67e5\u770b\u5230\u7684\u5404\u4e2a\u9891\u7387\uff09\uff0ccpu\u9891\u7387\uff1d\u500d\u9891x\u5916\u9891\u3002\u4ee5\u4e0b\u51e1\u662f\u6d89\u53ca\u9891\u7387\u7684\u4e00\u5f8b\u5982\u6b64\u3002 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001 \u8c03\u6574cpu\u9891\u7387\u4e0a\u4e0b\u9650 <\/h2>\n\n\n\n<p><code>sudo cpufreq-set -d<\/code> \u9891\u7387\u4e0b\u9650<br><code>sudo cpufreq-set -u<\/code> \u9891\u7387\u4e0a\u9650<br>\u56e0\u6b64\uff0c\u53ef\u80fd\u53ef\u4ee5\u5bf9cpu\u8fdb\u884c\u964d\u9891\u6216\u8005\u8d85\u9891<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001 \u8c03\u6574cpu\u8fd0\u884c\u6a21\u5f0f <\/h2>\n\n\n\n<p> <code>sudo cpufreq-selecotr -g<\/code> \u6a21\u5f0f\u6216\u8005<code>suod cpufreq-set -g<\/code> \u6a21\u5f0f <br> \u8fd9\u91cc\uff0c\u6a21\u5f0f\u5c31\u662f\u6267\u884c<code>cpufreq-info<\/code>\u540e\u770b\u5230\u7684\u6240\u652f\u6301\u7684\u6a21\u5f0f\u3002\u6bd4\u5982\u6211\u7684\u652f\u6301\u4ee5\u4e0b\u51e0\u79cd\uff1a<code>powersave, userspace, ondemand, conservative, performance<\/code>\u3002 <br> <code>powersave<\/code>\uff0c\u662f\u65e0\u8bba\u5982\u4f55\u90fd\u53ea\u4f1a\u4fdd\u6301\u6700\u4f4e\u9891\u7387\u7684\u6240\u8c13\u201c\u7701\u7535\u201d\u6a21\u5f0f\uff1b <br> <code>userspace<\/code>\uff0c\u662f\u81ea\u5b9a\u4e49\u9891\u7387\u65f6\u7684\u6a21\u5f0f\uff0c\u8fd9\u4e2a\u662f\u5f53\u4f60\u8bbe\u5b9a\u7279\u5b9a\u9891\u7387\u65f6\u81ea\u52a8\u8f6c\u53d8\u7684\uff1b <br> <code>ondemand<\/code>\uff0c\u9ed8\u8ba4\u6a21\u5f0f\u3002\u4e00\u6709cpu\u8ba1\u7b97\u91cf\u7684\u4efb\u52a1\uff0c\u5c31\u4f1a\u7acb\u5373\u8fbe\u5230\u6700\u5927\u9891\u7387\u8fd0\u884c\uff0c\u7b49\u6267\u884c\u5b8c\u6bd5\u5c31\u7acb\u5373\u56de\u5230\u6700\u4f4e\u9891\u7387\uff1b <br> <code>conservative<\/code>\uff0c\u7ffb\u8bd1\u6210\u4fdd\u5b88\uff08\u4e2d\u5eb8\uff09\u6a21\u5f0f\uff0c\u4f1a\u81ea\u52a8\u5728\u9891\u7387\u4e0a\u4e0b\u9650\u8c03\u6574\uff0c\u548c<code>ondemand<\/code>\u7684\u533a\u522b\u5728\u4e8e\u5b83\u4f1a\u6309\u9700\u5206\u914d\u9891\u7387\uff0c\u800c\u4e0d\u662f\u4e00\u5473\u8ffd\u6c42\u6700\u9ad8\u9891\u7387\uff1b <br> <code>performance<\/code>\uff0c\u987e\u540d\u601d\u4e49\u53ea\u6ce8\u91cd\u6548\u7387\uff0c\u65e0\u8bba\u5982\u4f55\u4e00\u76f4\u4fdd\u6301\u4ee5\u6700\u5927\u9891\u7387\u8fd0\u884c\u3002 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001 \u6dfb\u52a0cpu\u76d1\u89c6\u5668 <\/h2>\n\n\n\n<p> \u76d1\u89c6cpu\u9891\u7387\u7684\u7cfb\u7edf\u5c31\u6709\uff0c\u53f3\u952e\u5355\u51fb\u9762\u677f\uff0c\u9009\u62e9\u201c\u6dfb\u52a0\u5230\u9762\u677f\u201d\uff0c\u91cc\u9762\u627e\u5230\u201ccpu\u9891\u7387\u8303\u56f4\u76d1\u89c6\u5668\u201d\u3002 <br> \u53e6\u5916\uff0c\u5982\u679c\u5acc\u547d\u4ee4\u884c\u9ebb\u70e6\uff0c\u53ef\u4ee5\u8fd9\u4e48\u505a\uff1a<br> <code>sudo chmod +s \/usr\/bin\/cpufreq-selector <\/code><br> \u7136\u540e\uff0ccpu\u9891\u7387\u8303\u56f4\u76d1\u89c6\u5668\u7684\u9996\u9009\u9879\u91cc\u5c31\u4f1a\u591a\u51fa\u4e00\u4e2a\u201c\u9891\u7387\u9009\u62e9\u5668\u201d\uff0c\u663e\u793a\u83dc\u5355\u9009\u62e9\u201c\u9891\u7387\u548c\u8c03\u901f\u5668\u201d\u3002\u9f20\u6807\u5de6\u952e\u5355\u51fbcpu\u9891\u7387\u8303\u56f4\u76d1\u89c6\u5668\uff0c\u4f1a\u53d1\u73b0\u201c\u9891\u7387\u201d\u548c\u201c\u8c03\u901f\u5668\u201d\u4e24\u4e2a\u83dc\u5355\uff0c\u5c31\u53ef\u4ee5\u968f\u4fbf\u8c03\u4e86\u3002\u5728\u8fd9\u91cc\u7279\u522b\u611f\u8c22Vstar\u3002 <br> \u76d1\u89c6\u6e29\u5ea6\u7684\u9700\u8981\u81ea\u5df1\u5b89\u88c5:<br><code> sudo apt-get install sensors-applet <\/code><br> \u7136\u540e\u4e5f\u662f\u8fd9\u6837\u6dfb\u52a0\u5230\u9762\u677f\uff0c\u540d\u5b57\u53eb\u201cHardware sensors monitor\u201d\u3002 <br><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u6765\u6e90\uff1a <a href=\"http:\/\/www.cppblog.com\/jerryma\/archive\/2012\/04\/25\/172713.aspx\">http:\/\/www.cppblog.com\/jerryma\/archive\/2012\/04\/25\/172713.aspx<\/a> <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u8981\u5b89\u88c5cpufrequtils\u3002\u6b64\u8f6f\u4ef6\u662f\u67e5\u770bcpu\u5f53\u524d\u9891\u7387\u4ee5\u53ca\u4fee\u6539\u9891\u7387\u3001\u9009\u62e9cpu\u3001\u9009\u62e9cpu\u8fd0\u884c\u65b9\u5f0f\u7684\u3002\u6ce8\u2026 <span class=\"read-more\"><a href=\"http:\/\/iqotom.com\/?p=1635\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":169,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,81],"tags":[],"_links":{"self":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/1635"}],"collection":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1635"}],"version-history":[{"count":2,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/1635\/revisions"}],"predecessor-version":[{"id":1637,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/1635\/revisions\/1637"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/media\/169"}],"wp:attachment":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1635"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}