Compare commits

..

No commits in common. "main" and "threads" have entirely different histories.

3 changed files with 12 additions and 201 deletions

View File

@ -1,133 +0,0 @@
# nop 测试
```text
.\runs\tswn-032-0nop.exe --team shenjack -x 5500 --start 2501000000000 -t 14 -r 10 --end 2502000000000
2024-08-27T11:15:40.168604Z INFO tswn::cacluate: | 9|Id: 2500790622160|465.88E/d 10.03s↓|6510.747E/d|0 |86.059% 0:0:18|
2024-08-27T11:15:40.220339Z INFO tswn::cacluate: | 3|Id: 2500801403650|465.34E/d 9.97s↑|6512.277E/d|1 |87.139% 0:0:17|
2024-08-27T11:15:40.418147Z INFO tswn::cacluate: | 2|Id: 2500806808950|460.88E/d 10.13s↓|6506.134E/d|0 |87.678% 0:0:16|
2024-08-27T11:15:40.994828Z INFO tswn::cacluate: | 0|Id: 2500812033520|447.67E/d 10.08s↓|6502.401E/d|0 |88.211% 0:0:15|
2024-08-27T11:15:42.015189Z INFO tswn::cacluate: | 1|Id: 2500817419220|467.15E/d 9.96s↑|6504.230E/d|0 |88.729% 0:0:14|
2024-08-27T11:15:42.350449Z INFO tswn::cacluate: | 5|Id: 2500822828510|466.62E/d 10.02s→|6503.487E/d|0 |89.270% 0:0:14|
2024-08-27T11:15:42.849861Z INFO tswn::cacluate: |10|Id: 2500828233980|467.47E/d 9.99s→|6503.921E/d|0 |89.810% 0:0:13|
2024-08-27T11:15:42.956652Z INFO tswn::cacluate: |12|Id: 2500833627700|466.29E/d 9.99s→|6504.194E/d|0 |90.351% 0:0:12|
2024-08-27T11:15:49.833909Z INFO tswn::cacluate: | 7|Id: 2500839027860|466.01E/d 10.01s→|6503.635E/d|0 |90.891% 0:0:12|
2024-08-27T11:15:49.876337Z INFO tswn::cacluate: | 4|Id: 2500844403130|464.35E/d 10.00s→|6503.565E/d|0 |91.430% 0:0:11|
2024-08-27T11:15:49.954604Z INFO tswn::cacluate: | 6|Id: 2500849805230|466.47E/d 10.01s→|6503.289E/d|0 |91.968% 0:0:10|
2024-08-27T11:15:50.054077Z INFO tswn::cacluate: | 8|Id: 2500855181730|464.06E/d 10.01s→|6502.824E/d|0 |92.507% 0:0: 9|
2024-08-27T11:15:50.058150Z INFO tswn::cacluate: |11|Id: 2500860589360|466.88E/d 10.01s→|6502.484E/d|0 |93.045% 0:0: 9|
2024-08-27T11:15:50.195998Z INFO tswn::cacluate: | 9|Id: 2500871391310|465.66E/d 10.00s→|6502.261E/d|0 |93.585% 0:0: 8|
2024-08-27T11:15:50.252994Z INFO tswn::cacluate: | 3|Id: 2500876777230|464.57E/d 10.02s→|6501.489E/d|1 |94.124% 0:0: 7|
2024-08-27T11:15:50.260338Z INFO tswn::cacluate: |13|Id: 2500865999160|465.62E/d 10.04s↓|6499.705E/d|0 |94.662% 0:0: 7|
2024-08-27T11:15:50.371785Z INFO tswn::cacluate: | 2|Id: 2500882111430|463.51E/d 9.94s↑|6502.342E/d|0 |95.201% 0:0: 6|
2024-08-27T11:15:50.972678Z INFO tswn::cacluate: | 0|Id: 2500887292790|448.68E/d 9.98s↑|6503.350E/d|0 |95.737% 0:0: 5|
2024-08-27T11:15:52.075203Z INFO tswn::cacluate: | 1|Id: 2500892699660|465.12E/d 10.04s↓|6501.313E/d|0 |96.256% 0:0: 4|
2024-08-27T11:15:52.345624Z INFO tswn::cacluate: | 5|Id: 2500898100350|466.85E/d 9.99s→|6501.546E/d|0 |96.795% 0:0: 4|
2024-08-27T11:15:52.839529Z INFO tswn::cacluate: |10|Id: 2500903510840|467.96E/d 9.99s→|6502.035E/d|0 |97.335% 0:0: 3|
2024-08-27T11:15:52.966530Z INFO tswn::cacluate: |12|Id: 2500908907720|465.84E/d 10.01s→|6501.579E/d|0 |97.877% 0:0: 2|
2024-08-27T11:15:59.851496Z INFO tswn::cacluate: | 7|Id: 2500914301410|465.20E/d 10.02s→|6500.766E/d|0 |98.416% 0:0: 2|
2024-08-27T11:15:59.959410Z INFO tswn::cacluate: | 6|Id: 2500925074780|466.25E/d 10.00s→|6500.547E/d|0 |98.954% 0:0: 1|
2024-08-27T11:15:59.965259Z INFO tswn::cacluate: | 4|Id: 2500919675870|460.27E/d 10.09s↓|6496.461E/d|0 |99.494% 0:0: 0|
```
```text
.\runs\tswn-032-1nop.exe --team shenjack -x 5500 --start 2501000000000 -t 14 -r 10 --end 2502000000000
2024-08-27T11:19:56.568086Z INFO tswn::cacluate: | 3|Id: 2501739884250|469.35E/d 9.90s↑|6534.054E/d|0 |81.008% 0:0:25|
2024-08-27T11:19:56.710572Z INFO tswn::cacluate: |10|Id: 2501745317300|469.29E/d 10.00s→|6533.924E/d|0 |81.551% 0:0:24|
2024-08-27T11:19:59.050135Z INFO tswn::cacluate: | 5|Id: 2501750765030|470.46E/d 10.00s→|6533.697E/d|0 |82.094% 0:0:23|
2024-08-27T11:19:59.261167Z INFO tswn::cacluate: | 1|Id: 2501756199280|468.74E/d 10.02s→|6532.913E/d|0 |82.639% 0:0:22|
2024-08-27T11:19:59.669063Z INFO tswn::cacluate: | 0|Id: 2501761450780|452.07E/d 10.04s↓|6531.254E/d|0 |83.181% 0:0:22|
2024-08-27T11:20:06.014547Z INFO tswn::cacluate: | 8|Id: 2501766866570|467.79E/d 10.00s→|6531.115E/d|0 |83.704% 0:0:21|
2024-08-27T11:20:06.097383Z INFO tswn::cacluate: |12|Id: 2501772306180|470.55E/d 9.99s→|6531.680E/d|0 |84.246% 0:0:20|
2024-08-27T11:20:06.171995Z INFO tswn::cacluate: |11|Id: 2501783073610|469.30E/d 9.96s↑|6533.586E/d|0 |84.790% 0:0:20|
2024-08-27T11:20:06.177521Z INFO tswn::cacluate: |13|Id: 2501777663960|462.10E/d 10.02s→|6532.769E/d|0 |85.334% 0:0:19|
2024-08-27T11:20:06.267320Z INFO tswn::cacluate: | 6|Id: 2501788503710|469.69E/d 9.99s→|6533.298E/d|0 |85.868% 0:0:18|
2024-08-27T11:20:06.277709Z INFO tswn::cacluate: | 7|Id: 2501793903100|469.94E/d 9.93s↑|6536.730E/d|0 |86.412% 0:0:17|
2024-08-27T11:20:06.371596Z INFO tswn::cacluate: | 4|Id: 2501799282250|465.56E/d 9.98s→|6537.532E/d|0 |86.956% 0:0:17|
2024-08-27T11:20:06.430998Z INFO tswn::cacluate: | 2|Id: 2501810077610|466.40E/d 9.96s↑|6539.367E/d|0 |87.495% 0:0:16|
2024-08-27T11:20:06.447783Z INFO tswn::cacluate: | 9|Id: 2501804700740|467.63E/d 10.01s→|6538.836E/d|0 |88.035% 0:0:15|
2024-08-27T11:20:06.603508Z INFO tswn::cacluate: | 3|Id: 2501815509880|469.08E/d 10.01s→|6538.569E/d|0 |88.576% 0:0:15|
2024-08-27T11:20:06.720975Z INFO tswn::cacluate: |10|Id: 2501820941420|468.80E/d 10.01s→|6538.087E/d|0 |89.119% 0:0:14|
2024-08-27T11:20:09.054462Z INFO tswn::cacluate: | 5|Id: 2501826386520|470.26E/d 10.00s→|6537.889E/d|0 |89.661% 0:0:13|
2024-08-27T11:20:09.302599Z INFO tswn::cacluate: | 1|Id: 2501831811700|467.04E/d 10.04s↓|6536.191E/d|0 |90.206% 0:0:12|
2024-08-27T11:20:09.600818Z INFO tswn::cacluate: | 0|Id: 2501837044000|455.18E/d 9.93s↑|6539.303E/d|0 |90.746% 0:0:12|
2024-08-27T11:20:16.030071Z INFO tswn::cacluate: | 8|Id: 2501842458180|467.07E/d 10.02s→|6538.584E/d|0 |91.273% 0:0:11|
2024-08-27T11:20:16.118297Z INFO tswn::cacluate: |12|Id: 2501847904330|469.57E/d 10.02s↓|6537.605E/d|0 |91.814% 0:0:10|
2024-08-27T11:20:16.161745Z INFO tswn::cacluate: |13|Id: 2501858684360|462.83E/d 9.98s→|6538.340E/d|0 |92.357% 0:0:10|
2024-08-27T11:20:16.165454Z INFO tswn::cacluate: |11|Id: 2501853336040|469.61E/d 9.99s→|6538.652E/d|0 |92.893% 0:0: 9|
2024-08-27T11:20:16.264568Z INFO tswn::cacluate: | 7|Id: 2501869559700|470.56E/d 9.99s→|6539.274E/d|0 |93.436% 0:0: 8|
2024-08-27T11:20:16.271128Z INFO tswn::cacluate: | 6|Id: 2501864120590|469.52E/d 10.00s→|6539.100E/d|0 |93.981% 0:0: 7|
2024-08-27T11:20:16.374665Z INFO tswn::cacluate: | 4|Id: 2501874948130|465.42E/d 10.00s→|6538.961E/d|0 |94.524% 0:0: 7|
2024-08-27T11:20:16.422587Z INFO tswn::cacluate: | 9|Id: 2501885758580|468.81E/d 9.97s↑|6540.146E/d|0 |95.063% 0:0: 6|
```
```text
.\runs\tswn-032-2nop.exe --team shenjack -x 5500 --start 2502000000000 -t 14 -r 10 --end 2502500000000
2024-08-27T11:23:28.402837Z INFO tswn::cacluate: | 3|Id: 2502260237000|462.91E/d 9.99s→|6550.623E/d|0 |67.225% 0:0:21|
2024-08-27T11:23:28.553111Z INFO tswn::cacluate: |10|Id: 2502276528020|470.47E/d 9.98s↑|6551.647E/d|0 |68.297% 0:0:20|
2024-08-27T11:23:28.583092Z INFO tswn::cacluate: | 4|Id: 2502271094660|468.31E/d 10.02s→|6550.847E/d|0 |69.386% 0:0:20|
2024-08-27T11:23:28.585866Z INFO tswn::cacluate: | 5|Id: 2502281971530|470.50E/d 10.00s→|6551.029E/d|0 |70.470% 0:0:19|
2024-08-27T11:23:28.644243Z INFO tswn::cacluate: | 7|Id: 2502287419170|470.57E/d 10.00s→|6550.921E/d|0 |71.559% 0:0:18|
2024-08-27T11:23:28.651193Z INFO tswn::cacluate: |13|Id: 2502292868010|471.71E/d 9.98s↑|6551.850E/d|0 |72.648% 0:0:18|
2024-08-27T11:23:28.825512Z INFO tswn::cacluate: | 0|Id: 2502298212720|458.51E/d 10.07s↓|6548.579E/d|0 |73.740% 0:0:17|
2024-08-27T11:23:29.634693Z INFO tswn::cacluate: | 1|Id: 2502303602490|468.53E/d 9.94s↑|6551.434E/d|0 |74.801% 0:0:16|
2024-08-27T11:23:36.480879Z INFO tswn::cacluate: | 2|Id: 2502309011250|463.66E/d 10.08s↓|6547.782E/d|0 |75.886% 0:0:15|
2024-08-27T11:23:37.839540Z INFO tswn::cacluate: | 8|Id: 2502314399960|469.77E/d 9.91s↑|6551.967E/d|0 |76.959% 0:0:15|
2024-08-27T11:23:38.049643Z INFO tswn::cacluate: |11|Id: 2502319813320|470.14E/d 9.95s↑|6554.388E/d|0 |78.047% 0:0:14|
2024-08-27T11:23:38.137629Z INFO tswn::cacluate: |12|Id: 2502325257230|469.31E/d 10.02s↓|6553.344E/d|0 |79.135% 0:0:13|
2024-08-27T11:23:38.301261Z INFO tswn::cacluate: | 6|Id: 2502330688880|469.43E/d 10.00s→|6553.478E/d|0 |80.221% 0:0:13|
2024-08-27T11:23:38.400254Z INFO tswn::cacluate: | 9|Id: 2502336124900|469.16E/d 10.01s→|6552.961E/d|0 |81.308% 0:0:12|
2024-08-27T11:23:38.511686Z INFO tswn::cacluate: | 3|Id: 2502341482600|458.34E/d 10.10s↓|6548.397E/d|0 |82.394% 0:0:11|
2024-08-27T11:23:38.569865Z INFO tswn::cacluate: |10|Id: 2502346927810|469.69E/d 10.02s→|6547.616E/d|0 |83.455% 0:0:10|
2024-08-27T11:23:38.592913Z INFO tswn::cacluate: | 4|Id: 2502352348010|467.85E/d 10.01s→|6547.163E/d|0 |84.542% 0:0:10|
2024-08-27T11:23:38.601495Z INFO tswn::cacluate: | 5|Id: 2502357793620|469.77E/d 10.02s→|6546.433E/d|0 |85.625% 0:0: 9|
2024-08-27T11:23:38.649368Z INFO tswn::cacluate: | 7|Id: 2502363240020|470.33E/d 10.00s→|6546.197E/d|0 |86.713% 0:0: 8|
2024-08-27T11:23:38.673987Z INFO tswn::cacluate: |13|Id: 2502368699610|470.64E/d 10.02s↓|6545.128E/d|0 |87.801% 0:0: 8|
2024-08-27T11:23:38.836885Z INFO tswn::cacluate: | 0|Id: 2502374006460|458.00E/d 10.01s→|6544.616E/d|0 |88.891% 0:0: 7|
2024-08-27T11:23:39.651066Z INFO tswn::cacluate: | 1|Id: 2502379429270|468.15E/d 10.01s→|6544.231E/d|0 |89.951% 0:0: 6|
2024-08-27T11:23:46.489610Z INFO tswn::cacluate: | 2|Id: 2502384795760|463.74E/d 10.00s→|6544.305E/d|0 |91.035% 0:0: 5|
2024-08-27T11:23:47.875349Z INFO tswn::cacluate: | 8|Id: 2502390232910|468.10E/d 10.04s↓|6542.636E/d|0 |92.108% 0:0: 5|
2024-08-27T11:23:48.064475Z INFO tswn::cacluate: |11|Id: 2502395674290|469.44E/d 10.01s→|6541.944E/d|0 |93.192% 0:0: 4|
2024-08-27T11:23:48.145925Z INFO tswn::cacluate: |12|Id: 2502401106120|468.93E/d 10.01s→|6541.561E/d|0 |94.278% 0:0: 3|
2024-08-27T11:23:48.301662Z INFO tswn::cacluate: | 6|Id: 2502406539320|469.43E/d 10.00s→|6541.559E/d|0 |95.364% 0:0: 3|
2024-08-27T11:23:48.402776Z INFO tswn::cacluate: | 9|Id: 2502411969360|469.04E/d 10.00s→|6541.446E/d|0 |96.450% 0:0: 2|
2024-08-27T11:23:48.488244Z INFO tswn::cacluate: | 3|Id: 2502417274230|460.87E/d 9.95s↑|6543.977E/d|0 |97.536% 0:0: 1|
2024-08-27T11:23:48.554172Z INFO tswn::cacluate: |10|Id: 2502422710400|470.43E/d 9.98s→|6544.721E/d|0 |98.603% 0:0: 0|
2024-08-27T11:23:48.595784Z INFO tswn::cacluate: | 5|Id: 2502433562520|470.08E/d 9.99s→|6545.032E/d|0 |99.692% 0:0: 0|
```
```text
.\runs\tswn-032-3nop.exe --team shenjack -x 5500 --start 2502000000000 -t 14 -r 10 --end 2502500000000
2024-08-27T11:26:53.438235Z INFO tswn::cacluate: | 8|Id: 2502262393760|468.07E/d 10.01s→|6548.903E/d|0 |66.555% 0:0:22|
2024-08-27T11:26:53.447971Z INFO tswn::cacluate: |10|Id: 2502267822430|469.43E/d 9.99s→|6549.297E/d|0 |67.638% 0:0:21|
2024-08-27T11:26:53.518910Z INFO tswn::cacluate: | 4|Id: 2502273213830|467.53E/d 9.96s↑|6551.013E/d|0 |68.725% 0:0:20|
2024-08-27T11:26:53.618341Z INFO tswn::cacluate: | 9|Id: 2502278657180|469.98E/d 10.01s→|6550.692E/d|0 |69.807% 0:0:19|
2024-08-27T11:26:53.697291Z INFO tswn::cacluate: |13|Id: 2502289556650|470.64E/d 9.99s→|6551.046E/d|0 |70.895% 0:0:19|
2024-08-27T11:26:53.720518Z INFO tswn::cacluate: |11|Id: 2502284113480|470.33E/d 10.02s↓|6549.947E/d|0 |71.985% 0:0:18|
2024-08-27T11:26:53.751878Z INFO tswn::cacluate: | 6|Id: 2502294997570|469.95E/d 10.00s→|6549.798E/d|0 |73.073% 0:0:17|
2024-08-27T11:26:54.625637Z INFO tswn::cacluate: | 1|Id: 2502300445180|469.55E/d 10.02s↓|6548.678E/d|0 |74.161% 0:0:17|
2024-08-27T11:26:56.604914Z INFO tswn::cacluate: | 0|Id: 2502305733770|454.03E/d 10.06s↓|6545.775E/d|0 |75.248% 0:0:16|
2024-08-27T11:27:03.148744Z INFO tswn::cacluate: | 7|Id: 2502311163210|470.24E/d 9.98s↑|6546.913E/d|0 |76.299% 0:0:15|
2024-08-27T11:27:03.226064Z INFO tswn::cacluate: | 3|Id: 2502332773820|469.20E/d 9.86s↑|6553.637E/d|0 |77.388% 0:0:14|
2024-08-27T11:27:03.279901Z INFO tswn::cacluate: | 2|Id: 2502316574320|467.72E/d 10.00s→|6553.842E/d|0 |78.474% 0:0:14|
2024-08-27T11:27:03.297312Z INFO tswn::cacluate: | 5|Id: 2502322001270|469.35E/d 9.99s→|6554.306E/d|0 |79.556% 0:0:13|
2024-08-27T11:27:03.343270Z INFO tswn::cacluate: |12|Id: 2502327421100|467.30E/d 10.02s↓|6553.335E/d|0 |80.643% 0:0:12|
2024-08-27T11:27:03.435870Z INFO tswn::cacluate: | 8|Id: 2502338191250|468.18E/d 10.00s→|6553.451E/d|0 |81.725% 0:0:12|
2024-08-27T11:27:03.479603Z INFO tswn::cacluate: |10|Id: 2502343624480|467.96E/d 10.03s↓|6551.975E/d|0 |82.808% 0:0:11|
2024-08-27T11:27:03.560678Z INFO tswn::cacluate: | 4|Id: 2502349035740|465.61E/d 10.04s↓|6550.049E/d|0 |83.892% 0:0:10|
2024-08-27T11:27:03.636146Z INFO tswn::cacluate: | 9|Id: 2502354475370|469.15E/d 10.02s→|6549.218E/d|0 |84.969% 0:0: 9|
2024-08-27T11:27:03.713520Z INFO tswn::cacluate: |13|Id: 2502359922640|469.89E/d 10.02s→|6548.460E/d|0 |86.055% 0:0: 9|
2024-08-27T11:27:03.720766Z INFO tswn::cacluate: |11|Id: 2502365366220|470.32E/d 10.00s→|6548.452E/d|0 |87.143% 0:0: 8|
2024-08-27T11:27:03.762662Z INFO tswn::cacluate: | 6|Id: 2502370805420|469.45E/d 10.01s→|6547.960E/d|0 |88.232% 0:0: 7|
2024-08-27T11:27:04.673794Z INFO tswn::cacluate: | 1|Id: 2502376240070|468.34E/d 10.03s↓|6546.747E/d|0 |89.318% 0:0: 7|
2024-08-27T11:27:06.569116Z INFO tswn::cacluate: | 0|Id: 2502381495060|455.71E/d 9.96s↑|6548.424E/d|0 |90.403% 0:0: 6|
2024-08-27T11:27:13.153554Z INFO tswn::cacluate: | 7|Id: 2502386937670|470.02E/d 10.00s→|6548.203E/d|0 |91.457% 0:0: 5|
2024-08-27T11:27:13.292841Z INFO tswn::cacluate: | 2|Id: 2502397781690|467.37E/d 10.01s→|6547.844E/d|0 |92.545% 0:0: 4|
2024-08-27T11:27:13.303711Z INFO tswn::cacluate: | 3|Id: 2502392368210|466.82E/d 10.05s↓|6545.460E/d|0 |93.627% 0:0: 4|
2024-08-27T11:27:13.308080Z INFO tswn::cacluate: | 5|Id: 2502403214010|468.85E/d 10.01s→|6544.958E/d|0 |94.708% 0:0: 3|
2024-08-27T11:27:13.334978Z INFO tswn::cacluate: |12|Id: 2502408622600|467.69E/d 9.99s→|6545.350E/d|0 |95.793% 0:0: 2|
2024-08-27T11:27:13.436862Z INFO tswn::cacluate: | 8|Id: 2502414041380|468.15E/d 10.00s→|6545.316E/d|0 |96.876% 0:0: 2|
2024-08-27T11:27:13.469038Z INFO tswn::cacluate: |10|Id: 2502419457520|468.46E/d 9.99s→|6545.822E/d|0 |97.959% 0:0: 1|
```
```text

View File

@ -40,7 +40,7 @@ pub struct CacluateConfig {
pub xp_expect: u32, pub xp_expect: u32,
/// 队伍名称 /// 队伍名称
pub team: String, pub team: String,
/// 是否基于时间 ///
pub time_based: bool, pub time_based: bool,
/// 可能的设置指定核心亲和性 /// 可能的设置指定核心亲和性
pub core_affinity: Option<usize>, pub core_affinity: Option<usize>,
@ -134,9 +134,9 @@ pub type ThreadId = u32;
/// ///
/// 最后结尾的时候的逻辑如下: /// 最后结尾的时候的逻辑如下:
/// - 如果是 固定大小 的 batch /// - 如果是 固定大小 的 batch
/// 1. 每次发送之前检测是不是快完事了 ( batch size > 剩余 work size ) /// 1.每次发送之前检测是不是快完事了 ( batch size > 剩余 work size )
/// 2. 如果是, 则发送剩余的 work, 并且把 ended 置为 true /// 2.如果是, 则发送剩余的 work, 并且把 ended 置为 true
/// 3. ended 为 true 的时候, 再发送消息的时候直接发送 None /// 3.ended 为 true 的时候, 再发送消息的时候直接发送 None
/// - 如果是 动态大小 的 batch /// - 如果是 动态大小 的 batch
pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) { pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) {
let mut cores = 0; let mut cores = 0;
@ -228,7 +228,7 @@ pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) {
loop { loop {
// 等待一个 request work // 等待一个 request work
// 大部分时间在这里等待 // 大部分时间在这里等待
if thread_waiter.recv().is_err() { if let Err(_) = thread_waiter.recv() {
// 如果接收到了错误, 则说明所有线程都结束了 // 如果接收到了错误, 则说明所有线程都结束了
// 退出 // 退出
break; break;
@ -238,7 +238,7 @@ pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) {
// 这里不确定是不是会有问题, 先用 unwarp 看看 // 这里不确定是不是会有问题, 先用 unwarp 看看
let thread_id = shared_status.get_idle_thread().unwrap(); let thread_id = shared_status.get_idle_thread().unwrap();
// 先检测是否快结束了 // 先检测是否快结束了
if shared_status.top_id + cli_arg.batch_size.unwrap() >= cli_arg.end { if shared_status.top_id + cli_arg.batch_size.unwrap() as u64 >= cli_arg.end {
// 如果快结束了, 则发送剩余的 work 然后发送 None // 如果快结束了, 则发送剩余的 work 然后发送 None
let _ = work_sender.send(Some((thread_id as u32, shared_status.top_id..cli_arg.end))); let _ = work_sender.send(Some((thread_id as u32, shared_status.top_id..cli_arg.end)));
info!("最后一个 batch({}..{}) 已发送", shared_status.top_id, cli_arg.end); info!("最后一个 batch({}..{}) 已发送", shared_status.top_id, cli_arg.end);
@ -254,11 +254,11 @@ pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) {
// 如果没有结束, 则发送一个 batch // 如果没有结束, 则发送一个 batch
let _ = work_sender.send(Some(( let _ = work_sender.send(Some((
thread_id as u32, thread_id as u32,
shared_status.top_id..shared_status.top_id + cli_arg.batch_size.unwrap(), shared_status.top_id..shared_status.top_id + cli_arg.batch_size.unwrap() as u64,
))); )));
} }
// 更新 top_i // 更新 top_i
shared_status.top_id += cli_arg.batch_size.unwrap(); shared_status.top_id += cli_arg.batch_size.unwrap() as u64;
} }
} }
let full_end_time = Instant::now(); let full_end_time = Instant::now();
@ -279,7 +279,6 @@ pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) {
/// 所有的状态输出都在子线程, 也就是这里 /// 所有的状态输出都在子线程, 也就是这里
/// ///
/// 1. 通过 `Receiver` 获取到主线程的数据 /// 1. 通过 `Receiver` 获取到主线程的数据
///
/// 获取到数据后, 开始计算 /// 获取到数据后, 开始计算
/// 计算完一个 batch 后, 输出一次状态 /// 计算完一个 batch 后, 输出一次状态
/// 这里的状态是在所有运算线程中共享的一个状态 /// 这里的状态是在所有运算线程中共享的一个状态
@ -383,7 +382,7 @@ pub fn inner_cacl(config: &CacluateConfig, range: Range<u64>, main_namer: &mut N
// 这堆操作放在这边了, 保证统计没问题 // 这堆操作放在这边了, 保证统计没问题
let name = gen_name(i); let name = gen_name(i);
// 新加的提前检测 // 新加的提前检测
if likely(!main_namer.replace_name(team_namer, &name)) { if likely(!main_namer.replace_name(&team_namer, &name)) {
continue; continue;
} }
let prop = main_namer.get_property(); let prop = main_namer.get_property();
@ -395,14 +394,14 @@ pub fn inner_cacl(config: &CacluateConfig, range: Range<u64>, main_namer: &mut N
main_namer.update_skill(); main_namer.update_skill();
let xu; let xu;
let xu_qd = crate::evaluate::xuping::XuPing2_0_1015_QD::evaluate(main_namer); let xu_qd = crate::evaluate::xuping::XuPing2_0_1015_QD::evaluate(&main_namer);
if likely((xu_qd as u32) < config.xp_expect) { if likely((xu_qd as u32) < config.xp_expect) {
xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(main_namer); xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer);
if likely((xu as u32) < config.xp_expect) { if likely((xu as u32) < config.xp_expect) {
continue; continue;
} }
} else { } else {
xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(main_namer); xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer);
} }
get_count += 1; get_count += 1;
info!("Id:{:>15}|{}|{:.4}|{:.4}|{}", i, full_name, xu, xu_qd, main_namer.get_info()); info!("Id:{:>15}|{}|{:.4}|{:.4}|{}", i, full_name, xu, xu_qd, main_namer.get_info());

View File

@ -707,22 +707,6 @@ mod test {
#[test] #[test]
fn val_test() { fn val_test() {
let team = TeamNamer::new_unchecked("x"); let team = TeamNamer::new_unchecked("x");
let team_val: Vec<u8> = vec![
0, 59, 5, 27, 36, 119, 125, 25, 127, 133, 143, 18, 88, 163, 214, 134, 72, 85, 55, 103, 58, 80, 12, 3, 197, 86, 112,
227, 37, 180, 202, 184, 126, 15, 169, 96, 35, 149, 160, 90, 130, 10, 207, 254, 31, 253, 194, 150, 198, 111, 161, 87,
128, 129, 24, 73, 238, 34, 245, 168, 52, 42, 232, 142, 152, 135, 201, 132, 200, 144, 203, 138, 154, 141, 109, 47,
155, 93, 145, 82, 185, 113, 186, 69, 217, 166, 210, 92, 131, 183, 151, 171, 251, 40, 98, 195, 41, 7, 244, 30, 26, 65,
179, 16, 100, 218, 211, 120, 45, 237, 182, 8, 137, 107, 67, 61, 176, 249, 190, 123, 122, 243, 70, 247, 174, 241, 209,
148, 228, 50, 208, 14, 51, 146, 117, 68, 162, 234, 102, 104, 62, 11, 76, 84, 9, 139, 224, 235, 108, 44, 78, 222, 242,
167, 89, 172, 114, 115, 221, 233, 140, 193, 255, 191, 4, 188, 66, 29, 6, 64, 204, 192, 178, 77, 216, 196, 57, 164,
95, 75, 229, 212, 223, 215, 97, 136, 220, 38, 219, 94, 158, 252, 226, 21, 239, 157, 32, 39, 124, 46, 105, 175, 230,
156, 248, 106, 116, 43, 101, 250, 231, 28, 147, 173, 177, 187, 20, 181, 205, 22, 91, 83, 225, 1, 81, 99, 199, 246,
63, 48, 54, 13, 118, 79, 19, 170, 153, 165, 213, 110, 23, 121, 206, 159, 236, 2, 33, 71, 49, 56, 74, 60, 189, 53,
240, 17,
];
assert_eq!(team.clone_vals().to_vec(), team_val);
let namer = Namer::new_from_team_namer_unchecked(&team, "x"); let namer = Namer::new_from_team_namer_unchecked(&team, "x");
let val_vec: Vec<u8> = vec![ let val_vec: Vec<u8> = vec![
@ -740,45 +724,6 @@ mod test {
assert_eq!(namer.val.to_vec(), val_vec); assert_eq!(namer.val.to_vec(), val_vec);
} }
#[test]
fn more_val_test() {
let team = TeamNamer::new_unchecked("y");
let namer = Namer::new_from_team_namer_unchecked(&team, "y");
let val_vec: Vec<u8> = vec![
172, 201, 232, 76, 55, 209, 7, 109, 135, 97, 137, 96, 238, 117, 175, 52, 72, 207, 136, 16, 69, 108, 116, 11, 37, 79,
169, 46, 244, 57, 8, 67, 156, 21, 48, 43, 162, 185, 191, 141, 40, 65, 233, 211, 54, 42, 208, 28, 87, 251, 167, 53,
82, 160, 66, 125, 183, 128, 225, 168, 78, 252, 0, 81, 199, 236, 145, 177, 178, 131, 12, 27, 189, 62, 151, 182, 204,
83, 63, 202, 123, 148, 30, 41, 218, 196, 157, 77, 224, 229, 246, 104, 24, 93, 22, 216, 180, 171, 215, 144, 99, 193,
176, 17, 158, 44, 213, 103, 29, 70, 18, 120, 2, 231, 61, 50, 51, 74, 106, 247, 105, 166, 133, 205, 152, 235, 248, 71,
139, 237, 245, 38, 170, 60, 195, 119, 142, 84, 88, 13, 25, 33, 234, 154, 223, 110, 243, 203, 164, 227, 68, 138, 58,
146, 184, 39, 173, 26, 90, 242, 161, 89, 149, 126, 132, 80, 214, 147, 222, 219, 174, 121, 49, 220, 85, 230, 23, 15,
111, 32, 102, 75, 35, 98, 253, 56, 186, 9, 198, 118, 91, 1, 150, 112, 187, 190, 254, 10, 197, 212, 31, 113, 181, 153,
130, 240, 241, 155, 143, 210, 115, 228, 64, 159, 165, 114, 45, 94, 20, 221, 6, 192, 200, 92, 100, 127, 163, 179, 59,
34, 107, 124, 206, 250, 194, 36, 217, 73, 95, 86, 239, 129, 101, 134, 47, 226, 3, 14, 255, 4, 188, 249, 122, 5, 140,
19,
];
assert_eq!(namer.val.to_vec(), val_vec);
let team = TeamNamer::new_unchecked("z");
let namer = Namer::new_from_team_namer_unchecked(&team, "z");
let val_vec: Vec<u8> = vec![
0, 68, 111, 26, 132, 249, 229, 20, 250, 160, 63, 201, 94, 3, 46, 254, 79, 204, 248, 167, 6, 228, 102, 104, 246, 183,
37, 12, 75, 177, 140, 83, 240, 209, 124, 51, 117, 66, 251, 95, 152, 137, 33, 133, 197, 76, 70, 28, 222, 166, 99, 113,
27, 87, 82, 161, 34, 121, 212, 141, 143, 244, 35, 169, 30, 59, 31, 47, 13, 89, 236, 86, 192, 92, 237, 231, 8, 148,
206, 72, 194, 14, 149, 4, 50, 221, 112, 61, 71, 131, 190, 78, 90, 45, 128, 165, 198, 203, 239, 180, 118, 32, 25, 24,
15, 10, 19, 219, 200, 88, 146, 42, 1, 208, 185, 129, 179, 225, 154, 67, 130, 168, 245, 186, 178, 188, 44, 120, 126,
242, 110, 247, 49, 252, 211, 163, 193, 144, 241, 7, 91, 145, 199, 189, 115, 73, 226, 127, 184, 157, 138, 175, 40,
233, 218, 58, 147, 223, 36, 21, 106, 142, 43, 65, 255, 56, 39, 125, 220, 217, 109, 23, 151, 173, 156, 224, 230, 176,
53, 74, 158, 136, 62, 22, 119, 48, 29, 243, 52, 238, 2, 213, 77, 101, 116, 80, 114, 202, 187, 93, 54, 139, 135, 171,
196, 84, 108, 64, 174, 38, 16, 55, 96, 234, 182, 103, 195, 207, 235, 69, 122, 97, 100, 214, 18, 232, 205, 191, 162,
155, 57, 41, 98, 60, 123, 85, 164, 9, 81, 150, 253, 210, 227, 159, 134, 105, 107, 17, 5, 215, 153, 181, 172, 170, 11,
216,
];
assert_eq!(namer.val.to_vec(), val_vec);
}
#[test] #[test]
fn base_name_test() { fn base_name_test() {
let team = TeamNamer::new_unchecked("x"); let team = TeamNamer::new_unchecked("x");