{"id":901,"date":"2022-01-06T16:39:22","date_gmt":"2022-01-06T08:39:22","guid":{"rendered":"https:\/\/www.wccass.com\/?p=901"},"modified":"2024-12-31T14:36:16","modified_gmt":"2024-12-31T06:36:16","slug":"linux%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95unixbench%e4%b8%80%e9%94%ae%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/blog.tongyunli.top\/?p=901","title":{"rendered":"Linux\u6027\u80fd\u6d4b\u8bd5UnixBench\u4e00\u952e\u811a\u672c"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/teddysun.com\/wp-content\/uploads\/2013\/07\/unixbench_large.png\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/teddysun.com\/wp-content\/uploads\/2013\/07\/unixbench.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/teddysun.com\/wp-content\/uploads\/2013\/07\/unixbench.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"unixbench\" title=\"Linux\u6027\u80fd\u6d4b\u8bd5UnixBench\u4e00\u952e\u811a\u672c\"\/><\/div><\/a><\/figure><\/div>\n\n\n<p>UnixBench\u662f\u4e00\u4e2a\u7c7bunix\u7cfb\uff08Unix\uff0cBSD\uff0cLinux\uff09\u7edf\u4e0b\u7684\u6027\u80fd\u6d4b\u8bd5\u5de5\u5177\uff0c\u4e00\u4e2a\u5f00\u6e90\u5de5\u5177\uff0c\u88ab\u5e7f\u6cdb\u7528\u4e0e\u6d4b\u8bd5linux\u7cfb\u7edf\u4e3b\u673a\u7684\u6027\u80fd\u3002Unixbench\u7684\u4e3b\u8981\u6d4b\u8bd5\u9879\u76ee\u6709\uff1a\u7cfb\u7edf\u8c03\u7528\u3001\u8bfb\u5199\u3001\u8fdb\u7a0b\u3001\u56fe\u5f62\u5316\u6d4b\u8bd5\u30012D\u30013D\u3001\u7ba1\u9053\u3001\u8fd0\u7b97\u3001C\u5e93\u7b49\u7cfb\u7edf\u57fa\u51c6\u6027\u80fd\u63d0\u4f9b\u6d4b\u8bd5\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u6700\u65b0\u7248\u672cUnixBench5.1.3\uff0c\u5305\u542bsystem\u548cgraphic\u6d4b\u8bd5\uff0c\u5982\u679c\u4f60\u9700\u8981\u6d4b\u8bd5graphic\uff0c\u5219\u9700\u8981\u4fee\u6539Makefile,\u4e0d\u8981\u6ce8\u91ca\u6389\u201dGRAPHIC_TESTS = defined\u201d\uff0c\u540c\u65f6\u9700\u8981\u7cfb\u7edf\u63d0\u4f9bx11perf\u547d\u4ee4gl_glibs\u5e93\u3002<br>\u4e0b\u9762\u7684\u811a\u672c\u4f7f\u7528\u4e86\u6700\u65b0\u7248UnixBench5.1.3\u6765\u6d4b\u8bd5\uff0c\u6ce8\u91ca\u4e86\u5173\u4e8egraphic\u7684\u6d4b\u8bd5\u9879\uff08\u5927\u591a\u6570VPS\u90fd\u662f\u6ca1\u6709\u663e\u5361\u6216\u8005\u662f\u96c6\u663e\uff0c\u6240\u4ee5\u56fe\u50cf\u6027\u80fd\u65e0\u9700\u6d4b\u8bd5\uff09\uff0c\u8fd0\u884c10-30\u5206\u949f\u540e\uff08\u6839\u636eCPU\u5185\u6838\u6570\u91cf\uff0c\u8fd0\u7b97\u65f6\u95f4\u4e0d\u7b49\uff09\u5f97\u51fa\u5206\u6570\uff0c\u8d8a\u9ad8\u8d8a\u597d\u3002<\/p>\n\n\n\n<p><strong>\u6d4b\u8bd5\u65b9\u6cd5\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wget --no-check-certificate https:\/\/github.com\/teddysun\/across\/raw\/master\/unixbench.sh\nchmod +x unixbench.sh\n.\/unixbench.sh<\/pre>\n\n\n\n<p><strong>\u6d4b\u8bd5\u9879\u76ee\uff1a<\/strong><br>Dhrystone 2 using register variables<br>\u6b64\u9879\u7528\u4e8e\u6d4b\u8bd5 string handling\uff0c\u56e0\u4e3a\u6ca1\u6709\u6d6e\u70b9\u64cd\u4f5c\uff0c\u6240\u4ee5\u6df1\u53d7\u8f6f\u4ef6\u548c\u786c\u4ef6\u8bbe\u8ba1\uff08hardware and software design\uff09\u3001\u7f16\u8bd1\u548c\u94fe\u63a5\uff08compiler and linker options\uff09\u3001\u4ee3\u7801\u4f18\u5316\uff08code optimazaton\uff09\u3001\u5bf9\u5185\u5b58\u7684cache\uff08cache memory\uff09\u3001\u7b49\u5f85\u72b6\u6001\uff08wait states\uff09\u3001\u6574\u6570\u6570\u636e\u7c7b\u578b\uff08integer data types\uff09\u7684\u5f71\u54cd\u3002<\/p>\n\n\n\n<p>Double-Precision Whetstone<br>\u8fd9\u4e00\u9879\u6d4b\u8bd5\u6d6e\u70b9\u6570\u64cd\u4f5c\u7684\u901f\u5ea6\u548c\u6548\u7387\u3002\u8fd9\u4e00\u6d4b\u8bd5\u5305\u62ec\u51e0\u4e2a\u6a21\u5757\uff0c\u6bcf\u4e2a\u6a21\u5757\u90fd\u5305\u62ec\u4e00\u7ec4\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684\u64cd\u4f5c\u3002\u8986\u76d6\u9762\u5f88\u5e7f\u7684\u4e00\u7cfb\u5217 c \u51fd\u6570\uff1asin\uff0ccos\uff0csqrt\uff0cexp\uff0clog \u88ab\u7528\u4e8e\u6574\u6570\u548c\u6d6e\u70b9\u6570\u7684\u6570\u5b66\u8fd0\u7b97\u3001\u6570\u7ec4\u8bbf\u95ee\u3001\u6761\u4ef6\u5206\u652f\uff08conditional branch\uff09\u548c\u7a0b\u5e8f\u8c03\u7528\u3002\u6b64\u6d4b\u8bd5\u540c\u65f6\u6d4b\u8bd5\u4e86\u6574\u6570\u548c\u6d6e\u70b9\u6570\u7b97\u672f\u8fd0\u7b97\u3002<\/p>\n\n\n\n<p>Execl Throughput<br>\u6b64\u6d4b\u8bd5\u8003\u5bdf\u6bcf\u79d2\u949f\u53ef\u4ee5\u6267\u884c\u7684 execl \u7cfb\u7edf\u8c03\u7528\u7684\u6b21\u6570\u3002 execl \u7cfb\u7edf\u8c03\u7528\u662f exec \u51fd\u6570\u65cf\u7684\u4e00\u5458\u3002\u5b83\u548c\u5176\u4ed6\u4e00\u4e9b\u4e0e\u4e4b\u76f8\u4f3c\u7684\u547d\u4ee4\u4e00\u6837\u662f execve\uff08\uff09 \u51fd\u6570\u7684\u524d\u7aef\u3002<\/p>\n\n\n\n<p>File copy<br>\u6d4b\u8bd5\u4ece\u4e00\u4e2a\u6587\u4ef6\u5411\u53e6\u5916\u4e00\u4e2a\u6587\u4ef6\u4f20\u8f93\u6570\u636e\u7684\u901f\u7387\u3002\u6bcf\u6b21\u6d4b\u8bd5\u4f7f\u7528\u4e0d\u540c\u5927\u5c0f\u7684\u7f13\u51b2\u533a\u3002\u8fd9\u4e00\u9488\u5bf9\u6587\u4ef6 read\u3001write\u3001copy \u64cd\u4f5c\u7684\u6d4b\u8bd5\u7edf\u8ba1\u89c4\u5b9a\u65f6\u95f4\uff08\u9ed8\u8ba4\u662f 10s\uff09\u5185\u7684\u6587\u4ef6 read\u3001write\u3001copy \u64cd\u4f5c\u6b21\u6570\u3002<\/p>\n\n\n\n<p>Pipe Throughput<br>\u7ba1\u9053\uff08pipe\uff09\u662f\u8fdb\u7a0b\u95f4\u4ea4\u6d41\u7684\u6700\u7b80\u5355\u65b9\u5f0f\uff0c\u8fd9\u91cc\u7684 Pipe throughtput \u6307\u7684\u662f\u4e00\u79d2\u949f\u5185\u4e00\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u5411\u4e00\u4e2a\u7ba1\u9053\u5199 512 \u5b57\u8282\u6570\u636e\u7136\u540e\u518d\u8bfb\u56de\u7684\u6b21\u6570\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cpipe throughtput \u5728\u5b9e\u9645\u7f16\u7a0b\u4e2d\u6ca1\u6709\u5bf9\u5e94\u7684\u771f\u5b9e\u5b58\u5728\u3002<\/p>\n\n\n\n<p>Pipe-based Context Switching<br>\u8fd9\u4e2a\u6d4b\u8bd5\u4e24\u4e2a\u8fdb\u7a0b\uff08\u6bcf\u79d2\u949f\uff09\u901a\u8fc7\u4e00\u4e2a\u7ba1\u9053\u4ea4\u6362\u4e00\u4e2a\u4e0d\u65ad\u589e\u957f\u7684\u6574\u6570\u7684\u6b21\u6570\u3002\u8fd9\u4e00\u70b9\u5f88\u5411\u73b0\u5b9e\u7f16\u7a0b\u4e2d\u7684\u4e00\u4e9b\u5e94\u7528\uff0c\u8fd9\u4e2a\u6d4b\u8bd5\u7a0b\u5e8f\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u5b50\u8fdb\u7a0b\uff0c\u518d\u548c\u8fd9\u4e2a\u5b50\u8fdb\u7a0b\u8fdb\u884c\u53cc\u5411\u7684\u7ba1\u9053\u4f20\u8f93\u3002<\/p>\n\n\n\n<p>Process Creation<br>\u6d4b\u8bd5\u6bcf\u79d2\u949f\u4e00\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u521b\u5efa\u5b50\u8fdb\u7a0b\u7136\u540e\u6536\u56de\u5b50\u8fdb\u7a0b\u7684\u6b21\u6570\uff08\u5b50\u8fdb\u7a0b\u4e00\u5b9a\u7acb\u5373\u9000\u51fa\uff09\u3002process creation \u7684\u5173\u6ce8\u70b9\u662f\u65b0\u8fdb\u7a0b\u8fdb\u7a0b\u63a7\u5236\u5757\uff08process control block\uff09\u7684\u521b\u5efa\u548c\u5185\u5b58\u5206\u914d\uff0c\u5373\u4e00\u9488\u89c1\u8840\u5730\u5173\u6ce8\u5185\u5b58\u5e26\u5bbd\u3002\u4e00\u822c\u8bf4\u6765\uff0c\u8fd9\u4e2a\u6d4b\u8bd5\u88ab\u7528\u4e8e\u5bf9\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u7a0b\u521b\u5efa\u8fd9\u4e00\u7cfb\u7edf\u8c03\u7528\u7684\u4e0d\u540c\u5b9e\u73b0\u7684\u6bd4\u8f83\u3002<\/p>\n\n\n\n<p>System Call Overhead<br>\u6d4b\u8bd5\u8fdb\u5165\u548c\u79bb\u5f00\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u7684\u4ee3\u4ef7\uff0c\u5373\u4e00\u6b21\u7cfb\u7edf\u8c03\u7528\u7684\u4ee3\u4ef7\u3002\u5b83\u5229\u7528\u4e00\u4e2a\u53cd\u590d\u5730\u8c03\u7528 getpid \u51fd\u6570\u7684\u5c0f\u7a0b\u5e8f\u8fbe\u5230\u6b64\u76ee\u7684\u3002<\/p>\n\n\n\n<p>Shell Scripts<br>\u6d4b\u8bd5\u4e00\u79d2\u949f\u5185\u4e00\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u5e76\u53d1\u5730\u5f00\u59cb\u4e00\u4e2a shell \u811a\u672c\u7684 n \u4e2a\u62f7\u8d1d\u7684\u6b21\u6570\uff0cn \u4e00\u822c\u53d6\u503c 1\uff0c2\uff0c4\uff0c8\u3002\uff08\u6211\u5728\u6d4b\u8bd5\u65f6\u53d6 1\uff0c 8\uff09\u3002\u8fd9\u4e2a\u811a\u672c\u5bf9\u4e00\u4e2a\u6570\u636e\u6587\u4ef6\u8fdb\u884c\u4e00\u7cfb\u5217\u7684\u53d8\u5f62\u64cd\u4f5c\uff08transformation\uff09\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u662f\u6211\u7684\u4e00\u4e2a512MB\uff0c2\u6838\uff0cOpenVZ\u7684VPS\u7684\u8dd1\u5206\u7ed3\u679c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">   BYTE UNIX Benchmarks (Version 5.1.3)\n\n   System: vpn: GNU\/Linux\n   OS: GNU\/Linux -- 2.6.32-042stab076.8 -- #1 SMP Tue May 14 20:38:14 MSK 2013\n   Machine: i686 (i386)\n   Language: en_US.utf8 (charmap=\"UTF-8\", collate=\"UTF-8\")\n   CPU 0: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4533.6 bogomips)\n          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER\/SYSEXIT, SYSCALL\/SYSRET, Intel virtualization\n   CPU 1: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4533.6 bogomips)\n          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER\/SYSEXIT, SYSCALL\/SYSRET, Intel virtualization\n   09:41:17 up 31 days,  9:21,  1 user,  load average: 0.23, 0.05, 0.02; runlevel 3\n\n------------------------------------------------------------------------\nBenchmark Run: Mon Jul 29 2013 09:41:17 - 10:09:29\n2 CPUs in system; running 1 parallel copy of tests\n\nDhrystone 2 using register variables       17172222.3 lps   (10.0 s, 7 samples)\nDouble-Precision Whetstone                     2600.2 MWIPS (10.0 s, 7 samples)\nExecl Throughput                               4152.8 lps   (30.0 s, 2 samples)\nFile Copy 1024 bufsize 2000 maxblocks        622759.5 KBps  (30.0 s, 2 samples)\nFile Copy 256 bufsize 500 maxblocks          172634.3 KBps  (30.0 s, 2 samples)\nFile Copy 4096 bufsize 8000 maxblocks       1218236.9 KBps  (30.0 s, 2 samples)\nPipe Throughput                             1416230.5 lps   (10.0 s, 7 samples)\nPipe-based Context Switching                 206509.4 lps   (10.0 s, 7 samples)\nProcess Creation                               8568.6 lps   (30.0 s, 2 samples)\nShell Scripts (1 concurrent)                   3145.9 lpm   (60.0 s, 2 samples)\nShell Scripts (8 concurrent)                    528.3 lpm   (60.0 s, 2 samples)\nSystem Call Overhead                        1528474.7 lps   (10.0 s, 7 samples)\n\nSystem Benchmarks Index Values               BASELINE       RESULT    INDEX\nDhrystone 2 using register variables         116700.0   17172222.3   1471.5\nDouble-Precision Whetstone                       55.0       2600.2    472.8\nExecl Throughput                                 43.0       4152.8    965.8\nFile Copy 1024 bufsize 2000 maxblocks          3960.0     622759.5   1572.6\nFile Copy 256 bufsize 500 maxblocks            1655.0     172634.3   1043.1\nFile Copy 4096 bufsize 8000 maxblocks          5800.0    1218236.9   2100.4\nPipe Throughput                               12440.0    1416230.5   1138.4\nPipe-based Context Switching                   4000.0     206509.4    516.3\nProcess Creation                                126.0       8568.6    680.0\nShell Scripts (1 concurrent)                     42.4       3145.9    742.0\nShell Scripts (8 concurrent)                      6.0        528.3    880.5\nSystem Call Overhead                          15000.0    1528474.7   1019.0\n                                                                   ========\nSystem Benchmarks Index Score                                         960.4\n\n------------------------------------------------------------------------\nBenchmark Run: Mon Jul 29 2013 10:09:29 - 10:39:56\n2 CPUs in system; running 2 parallel copies of tests\n\nDhrystone 2 using register variables       16851634.7 lps   (10.0 s, 7 samples)\nDouble-Precision Whetstone                     5182.9 MWIPS (10.0 s, 7 samples)\nExecl Throughput                               4101.9 lps   (30.0 s, 2 samples)\nFile Copy 1024 bufsize 2000 maxblocks        635244.9 KBps  (30.0 s, 2 samples)\nFile Copy 256 bufsize 500 maxblocks          174430.2 KBps  (30.0 s, 2 samples)\nFile Copy 4096 bufsize 8000 maxblocks       1219982.0 KBps  (30.0 s, 2 samples)\nPipe Throughput                             1387297.9 lps   (10.0 s, 7 samples)\nPipe-based Context Switching                 196296.1 lps   (10.0 s, 7 samples)\nProcess Creation                              10889.9 lps   (30.0 s, 2 samples)\nShell Scripts (1 concurrent)                   4073.7 lpm   (60.0 s, 2 samples)\nShell Scripts (8 concurrent)                    550.5 lpm   (60.2 s, 2 samples)\nSystem Call Overhead                        1538517.4 lps   (10.0 s, 7 samples)\n\nSystem Benchmarks Index Values               BASELINE       RESULT    INDEX\nDhrystone 2 using register variables         116700.0   16851634.7   1444.0\nDouble-Precision Whetstone                       55.0       5182.9    942.3\nExecl Throughput                                 43.0       4101.9    953.9\nFile Copy 1024 bufsize 2000 maxblocks          3960.0     635244.9   1604.2\nFile Copy 256 bufsize 500 maxblocks            1655.0     174430.2   1054.0\nFile Copy 4096 bufsize 8000 maxblocks          5800.0    1219982.0   2103.4\nPipe Throughput                               12440.0    1387297.9   1115.2\nPipe-based Context Switching                   4000.0     196296.1    490.7\nProcess Creation                                126.0      10889.9    864.3\nShell Scripts (1 concurrent)                     42.4       4073.7    960.8\nShell Scripts (8 concurrent)                      6.0        550.5    917.5\nSystem Call Overhead                          15000.0    1538517.4   1025.7\n                                                                   ========\nSystem Benchmarks Index Score                                        1058.3<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>UnixBench\u662f\u4e00\u4e2a\u7c7bunix\u7cfb\uff08Unix\uff0cBSD\uff0cLinux\uff09\u7edf\u4e0b\u7684\u6027\u80fd\u6d4b\u8bd5\u5de5\u5177\uff0c\u4e00\u4e2a\u5f00\u6e90\u5de5\u5177\uff0c\u88ab\u5e7f\u6cdb\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[62],"class_list":["post-901","post","type-post","status-publish","format-standard","hentry","category-jishu","tag-zongjie"],"_links":{"self":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/posts\/901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=901"}],"version-history":[{"count":2,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/posts\/901\/revisions"}],"predecessor-version":[{"id":1099,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/posts\/901\/revisions\/1099"}],"wp:attachment":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}