Currently I chose to represent the CPU load as 1/1000s of the connection time. For example, if we have spent 5 CPU seconds for a peer that has been connected for 1000 seconds, then cpu_load
will be 5.
Output of bitcoin-cli getpeerinfo |jq '.[].cpu_load ' |sort -n
:
00.003207936170212766
10.003909962962962963
20.004000127659574468
30.004340326086956522
40.00904279365079365
50.0270041914893617
60.03776429787234042
70.04154987234042553
80.05750733333333333
90.0828310843373494
100.1014558936170213
110.1453753214285714
120.1619409404761905
- After running for a few hours:
00.5100616477272727
10.7087315352941177
20.7814365649717514
30.8773131578947369
40.9717403481228669
51.069695995623632
61.078479046189377
71.153550253945481
81.167638256213824
91.187242140449438
101.199645694868011
111.199951082706767
121.220689207655502
131.264582222222222
141.265083146221971
151.282676876955162
161.301380197644649
171.303624877378436
181.333201868001821
191.341489760490639
201.343411334541063
211.361829386934673
221.364938446935725
231.372325493506493
241.385421828947368
251.472354355769231
261.612321964879852
271.641998848148148
281.648207868421053
291.681837521410579
301.783343262569832
311.78646682029841
321.837577241385135
331.844571151379764
341.851067047263682
351.908551290322581
361.915087061408061
371.923511220435511
381.939589383639822
391.940788162162162
401.962705583687341
412.000298126030624
422.008423324931507
432.00921122707588
442.018911893157895
452.019168323205742
462.019358503865546
472.030658536117768
482.034708427345187
492.03510252110758
502.04022746739726
512.054511708699122
522.07339420882353
532.076240002244949
542.080369749066667
552.08561637254902
562.092916448969578
572.095147154892331
582.119004164227642
592.129640033722438
602.145774200383772
612.164519192393115
622.27069154817898
632.29444800067659
642.313547881255947
652.31539280930693
662.368903822619457
672.445622954545454
682.503377741525424
692.557022695182724
702.56755574523507
712.709643024574987
722.724320047021944
732.913325884282384
743.154521111713488
753.706281482599432
763.843126643942505
773.865110431762718
783.934123987370194
794.634227207136824
805.185085595879828
815.233027217613057
825.766649107296137
836.105655600034141
846.138089870962286
8510.09238865432725
8610.24402739230769
8710.56650271556122
8820.75054951145038
8947.69228849275363
9077.79810328289474
91145.2686368960396
Maybe using an integer would be better for this? Then it would have to have higher resolution, e.g. instead of 1/1000s it should show 1/1Bs? Then the above numbers would vary from 3207 to 145'268'636. E.g. the lightest peer has caused 3207 nanoseconds of CPU time for each 1 second (=1B nanoseconds) of connection time.