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:
0.003207936170212766
0.003909962962962963
0.004000127659574468
0.004340326086956522
0.00904279365079365
0.0270041914893617
0.03776429787234042
0.04154987234042553
0.05750733333333333
0.0828310843373494
0.1014558936170213
0.1453753214285714
0.1619409404761905
- After running for a few hours:
0.5100616477272727
0.7087315352941177
0.7814365649717514
0.8773131578947369
0.9717403481228669
1.069695995623632
1.078479046189377
1.153550253945481
1.167638256213824
1.187242140449438
1.199645694868011
1.199951082706767
1.220689207655502
1.264582222222222
1.265083146221971
1.282676876955162
1.301380197644649
1.303624877378436
1.333201868001821
1.341489760490639
1.343411334541063
1.361829386934673
1.364938446935725
1.372325493506493
1.385421828947368
1.472354355769231
1.612321964879852
1.641998848148148
1.648207868421053
1.681837521410579
1.783343262569832
1.78646682029841
1.837577241385135
1.844571151379764
1.851067047263682
1.908551290322581
1.915087061408061
1.923511220435511
1.939589383639822
1.940788162162162
1.962705583687341
2.000298126030624
2.008423324931507
2.00921122707588
2.018911893157895
2.019168323205742
2.019358503865546
2.030658536117768
2.034708427345187
2.03510252110758
2.04022746739726
2.054511708699122
2.07339420882353
2.076240002244949
2.080369749066667
2.08561637254902
2.092916448969578
2.095147154892331
2.119004164227642
2.129640033722438
2.145774200383772
2.164519192393115
2.27069154817898
2.29444800067659
2.313547881255947
2.31539280930693
2.368903822619457
2.445622954545454
2.503377741525424
2.557022695182724
2.56755574523507
2.709643024574987
2.724320047021944
2.913325884282384
3.154521111713488
3.706281482599432
3.843126643942505
3.865110431762718
3.934123987370194
4.634227207136824
5.185085595879828
5.233027217613057
5.766649107296137
6.105655600034141
6.138089870962286
10.09238865432725
10.24402739230769
10.56650271556122
20.75054951145038
47.69228849275363
77.79810328289474
145.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.