{"id":1921,"date":"2024-03-02T16:06:31","date_gmt":"2024-03-02T16:06:31","guid":{"rendered":"https:\/\/mvermeulen.org\/perf\/?page_id=1921"},"modified":"2024-03-03T18:36:07","modified_gmt":"2024-03-03T18:36:07","slug":"ctx-clock","status":"publish","type":"page","link":"https:\/\/mvermeulen.org\/perf\/workloads\/phoronix\/ctx-clock\/","title":{"rendered":"ctx-clock"},"content":{"rendered":"\n<p>A simple test to measure context switch times. These show 304 with CraftyOS, 342 with Ubuntu on AMD and 210 with Ubuntu on Intel. This is a quick running single-threaded test.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"960\" src=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/systemtime-11.png\" alt=\"\" class=\"wp-image-1941\" srcset=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/systemtime-11.png 1280w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/systemtime-11-1024x768.png 1024w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/systemtime-11-768x576.png 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n\n\n<p>Topdown profile has just a few data points<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"960\" src=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/amdtopdown-12.png\" alt=\"\" class=\"wp-image-1943\" srcset=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/amdtopdown-12.png 1280w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/amdtopdown-12-1024x768.png 1024w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/03\/amdtopdown-12-768x576.png 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n\n\n<p>AMD metrics show only 20 seconds total and 0.29 cores, so also a good portion is test overhead.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>elapsed              20.054\non_cpu               0.018          # 0.29 \/ 16 cores\nutime                4.042\nstime                1.866\nnvcsw                1983           # 87.51%\nnivcsw               283            # 12.49%\ninblock              16             # 0.80\/sec\nonblock              12544          # 625.52\/sec\ncpu-clock            5923191652     # 5.923 seconds\ntask-clock           5925358739     # 5.925 seconds\npage faults          140133         # 23649.707\/sec\ncontext switches     2208           # 372.636\/sec\ncpu migrations       256            # 43.204\/sec\nmajor page faults    2              # 0.338\/sec\nminor page faults    140131         # 23649.370\/sec\nalignment faults     0              # 0.000\/sec\nemulation faults     0              # 0.000\/sec\nbranches             3629543676     # 199.805 branches per 1000 inst\nbranch misses        371673029      # 10.24% branch miss\nconditional          1807110712     # 99.481 conditional branches per 1000 inst\nindirect             75718384       # 4.168 indirect branches per 1000 inst\ncpu-cycles           19927118685    # 0.06 GHz\ninstructions         18009441706    # 0.90 IPC\nslots                41533810722    #\nretiring             8878414099     # 21.4% (21.4%)\n-- ucode             98614793       #     0.2%\n-- fastpath          8779799306     #    21.1%\nfrontend             26228231198    # 63.1% (63.2%) high\n-- latency           22577908482    #    54.4%\n-- bandwidth         3650322716     #     8.8%\nbackend              5866295650     # 14.1% (14.1%) low\n-- cpu               1052188093     #     2.5%\n-- memory            4814107557     #    11.6%\nspeculation          536345946      #  1.3% ( 1.3%)\n-- branch mispredict 535403653      #     1.3%\n-- pipeline restart  942293         #     0.0%\nsmt-contention       24259787       #  0.1% ( 0.0%)\ncpu-cycles           19881119763    # 0.06 GHz\ninstructions         17840215116    # 0.90 IPC\ninstructions         6060750171     # 17.474 l2 access per 1000 inst\nl2 hit from l1       89913971       # 19.00% l2 miss\nl2 miss from l1      11199606       #\nl2 hit from l2 pf    7069515        #\nl3 hit from l2 pf    4232960        #\nl3 miss from l2 pf   4690054        #\ninstructions         6068369854     # 7.045 float per 1000 inst\nfloat 512            67             # 0.000 AVX-512 per 1000 inst\nfloat 256            8              # 0.000 AVX-256 per 1000 inst\nfloat 128            42754042       # 7.045 AVX-128 per 1000 inst\nfloat MMX            0              # 0.000 MMX per 1000 inst\nfloat scalar         0              # 0.000 scalar per 1000 inst\ninstructions         18108100860    #\nopcache              6120325302     # 337.988 opcache per 1000 inst\nopcache miss         2693214500     # 44.0% opcache miss rate\nl1 dTLB miss         25740136       # 1.421 L1 dTLB per 1000 inst\nl2 dTLB miss         4195826        # 0.232 L2 dTLB per 1000 inst\ninstructions         18080295033    #\nicache               6535414495     # 361.466 icache per 1000 inst\nicache miss          149961081      #  2.3% icache miss rate\nl1 iTLB miss         7771605        # 0.430 L1 iTLB per 1000 inst\nl2 iTLB miss         0              # 0.000 L2 iTLB per 1000 inst\ntlb flush            14969          # 0.001 TLB flush per 1000 inst\n<\/code><\/pre>\n\n\n\n<p>Intel metrics<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>elapsed              18.250\non_cpu               0.013          # 0.21 \/ 16 cores\nutime                2.545\nstime                1.207\nnvcsw                1883           # 92.85%\nnivcsw               145            # 7.15%\ninblock              368            # 20.16\/sec\nonblock              1312           # 71.89\/sec\ncpu-clock            3762909328     # 3.763 seconds\ntask-clock           3765381454     # 3.765 seconds\npage faults          136945         # 36369.489\/sec\ncontext switches     1949           # 517.610\/sec\ncpu migrations       247            # 65.598\/sec\nmajor page faults    2              # 0.531\/sec\nminor page faults    136943         # 36368.958\/sec\nalignment faults     0              # 0.000\/sec\nemulation faults     0              # 0.000\/sec\nbranches             2890931293     # 177.255 branches per 1000 inst\nbranch misses        18691925       # 0.65% branch miss\nconditional          2890943133     # 177.256 conditional branches per 1000 inst\nindirect             80373303       # 4.928 indirect branches per 1000 inst\nslots                77725376588    #\nretiring             20898113762    # 26.9% (26.9%)\n-- ucode             6193687965     #     8.0%\n-- fastpath          14704425797    #    18.9%\nfrontend             22874502550    # 29.4% (29.4%)\n-- latency           12004279543    #    15.4%\n-- bandwidth         10870223007    #    14.0%\nbackend              31453841215    # 40.5% (40.5%)\n-- cpu               26097993769    #    33.6%\n-- memory            5355847446     #     6.9%\nspeculation          2567763043     #  3.3% ( 3.3%)\n-- branch mispredict 2409561026     #     3.1%\n-- pipeline restart  158202017      #     0.2%\nsmt-contention       0              #  0.0% ( 0.0%)\ncpu-cycles           12974231376    # 0.05 GHz\ninstructions         15984695138    # 1.23 IPC\nl2 access            250615984      # 15.719 l2 access per 1000 inst\nl2 miss              78419869       # 31.29% l2 miss\ncpu-cycles           13129389639    # 11.0% memory latency\nload stalls          1364727104     #  5.0% l1 bound\nl1 miss              703062088      #  2.7% l2 bound\nl2 miss              350707746      #  0.8% l3 bound\nl3 miss              251978924      #  1.9% dram bound\nstore_stalls         80035758       #  0.6% store bound\n<\/code><\/pre>\n\n\n\n<p>Process overview shows more time in Phoronix test suite routines than in the ctx_clock executable<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>354 processes\n\t 68 clinfo                  18.85     6.28\n\t  3 ctx_clock                3.04     1.11\n\t 38 vulkaninfo               1.33     1.33\n\t  4 vulkani:disk$0           0.14     0.14\n\t  6 glxinfo:gdrv0            0.11     0.11\n\t  6 glxinfo:gl0              0.11     0.11\n\t  6 php                      0.08     0.06\n\t  2 llvmpipe-0               0.07     0.07\n\t  2 llvmpipe-1               0.07     0.07\n\t  2 llvmpipe-10              0.07     0.07\n\t  2 llvmpipe-11              0.07     0.07\n\t  2 llvmpipe-12              0.07     0.07\n\t  2 llvmpipe-13              0.07     0.07\n\t  2 llvmpipe-14              0.07     0.07\n\t  2 llvmpipe-15              0.07     0.07\n\t  2 llvmpipe-2               0.07     0.07\n\t  2 llvmpipe-3               0.07     0.07\n\t  2 llvmpipe-4               0.07     0.07\n\t  2 llvmpipe-5               0.07     0.07\n\t  2 llvmpipe-6               0.07     0.07\n\t  2 llvmpipe-7               0.07     0.07\n\t  2 llvmpipe-8               0.07     0.07\n\t  2 llvmpipe-9               0.07     0.07\n\t  2 glxinfo                  0.05     0.05\n\t  2 glxinfo:cs0              0.05     0.05\n\t  2 glxinfo:disk$0           0.05     0.05\n\t  2 glxinfo:sh0              0.05     0.05\n\t  2 glxinfo:shlo0            0.05     0.05\n\t  6 clang                    0.04     0.08\n\t  1 lspci                    0.01     0.01\n\t  3 rocminfo                 0.00     0.01\n\t  1 ps                       0.00     0.01\n\t 82 sh                       0.00     0.00\n\t 13 gcc                      0.00     0.00\n\t 12 gsettings                0.00     0.00\n\t  8 stat                     0.00     0.00\n\t  8 systemd-detect-          0.00     0.00\n\t  6 llvm-link                0.00     0.00\n\t  5 phoronix-test-s          0.00     0.00\n\t  3 ctx-clock                0.00     0.00\n\t  3 gmain                    0.00     0.00\n\t  2 cc                       0.00     0.00\n\t  2 lscpu                    0.00     0.00\n\t  2 uname                    0.00     0.00\n\t  2 which                    0.00     0.00\n\t  2 xset                     0.00     0.00\n\t  1 date                     0.00     0.00\n\t  1 dconf worker             0.00     0.00\n\t  1 dirname                  0.00     0.00\n\t  1 dmesg                    0.00     0.00\n\t  1 dmidecode                0.00     0.00\n\t  1 grep                     0.00     0.00\n\t  1 ifconfig                 0.00     0.00\n\t  1 ip                       0.00     0.00\n\t  1 lsmod                    0.00     0.00\n\t  1 mktemp                   0.00     0.00\n\t  1 qdbus                    0.00     0.00\n\t  1 readlink                 0.00     0.00\n\t  1 realpath                 0.00     0.00\n\t  1 sed                      0.00     0.00\n\t  1 sort                     0.00     0.00\n\t  1 stty                     0.00     0.00\n\t  1 systemctl                0.00     0.00\n\t  1 template.sh              0.00     0.00\n\t  1 wc                       0.00     0.00\n\t  1 xrandr                   0.00     0.00\n0 processes running\n47 maximum processes\n<\/code><\/pre>\n\n\n\n<p>Computation structure shows ~1.4 seconds per invocation<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>      875082) ctx-clock        cpu=1 start=5.60  finish=6.97 \n        875083) ctx_clock        cpu=4 start=5.60  finish=6.97 \n      875084) ctx-clock        cpu=8 start=10.97 finish=12.38\n        875085) ctx_clock        cpu=9 start=10.98 finish=12.38\n      875088) ctx-clock        cpu=0 start=16.39 finish=17.79\n        875089) ctx_clock        cpu=9 start=16.39 finish=17.79\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A simple test to measure context switch times. These show 304 with CraftyOS, 342 with Ubuntu on AMD and 210 with Ubuntu on Intel. This is a quick running single-threaded test. Topdown profile has just a few data points AMD <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/mvermeulen.org\/perf\/workloads\/phoronix\/ctx-clock\/\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":58,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1921","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/1921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/comments?post=1921"}],"version-history":[{"count":2,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/1921\/revisions"}],"predecessor-version":[{"id":1944,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/1921\/revisions\/1944"}],"up":[{"embeddable":true,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/58"}],"wp:attachment":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/media?parent=1921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}