You've already forked go-profiler-notes
mirror of
https://github.com/DataDog/go-profiler-notes.git
synced 2025-07-15 23:54:16 +02:00
Add bench dir
This commit is contained in:
3
bench/.gitignore
vendored
Normal file
3
bench/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/venv
|
||||||
|
/*.pb.gz
|
||||||
|
/.ipynb_checkpoints
|
23
bench/README.md
Normal file
23
bench/README.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Go Profiler Overheads
|
||||||
|
|
||||||
|
This page is documenting the benchmark methodology used to analyze the performance overhead of the various go profilers. The results are discussed in the documents for each individual profiler.
|
||||||
|
|
||||||
|
Benchmarking is done by invoking the Go program included in this directory. You can look at [run.sh](./run.sh) to see the current arguments that are being used, but here is an example for block profiling with various profiling rates:
|
||||||
|
|
||||||
|
```
|
||||||
|
go run . \
|
||||||
|
-workloads mutex,chan \
|
||||||
|
-ops 100000 \
|
||||||
|
-blockprofilerates 0,1,10,100,1000,10000,100000,1000000 \
|
||||||
|
-runs 20 \
|
||||||
|
-depths 16 \
|
||||||
|
> "result.csv"
|
||||||
|
```
|
||||||
|
|
||||||
|
The benchmark works by spawning a new child process for the given number of `-runs` and every unique combination of parameters. The child reports the results to the parent process which then combines all the results in a CSV file. The hope is that using a new child process for every config/run eliminates scheduler, GC and other runtime state building up as a source of errors.
|
||||||
|
|
||||||
|
Workloads are defined in the [workloads.go](./workloads.go) file. For now the workloads are designed to be **pathological**, i.e. they try to show the worst performance impact the profiler might have on applications that are not doing anything useful other than stressing the profiler. The numbers are not intended to scare you away from profiling in production, but to guide you towards universally **safe profiling rates** as a starting point.
|
||||||
|
|
||||||
|
The CSV files are visualized using the [analysis.ipynb](./analysis.ipynb) notebook that's included in this directory.
|
||||||
|
|
||||||
|
For now the data is only collected from my local MacBook Pro machine (using docker for mac), but more realistic environments will be included in the future. But it's probably a good setup for finding pathological scenarios : ).
|
116
bench/analysis.ipynb
Normal file
116
bench/analysis.ipynb
Normal file
File diff suppressed because one or more lines are too long
321
bench/block_darwin_x86_64.csv
Normal file
321
bench/block_darwin_x86_64.csv
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
workload,ops,goroutines,depth,blockprofilerate,run,ms
|
||||||
|
mutex,100000,12,16,0,1,49.681104
|
||||||
|
mutex,100000,12,16,0,2,50.078913
|
||||||
|
mutex,100000,12,16,0,3,47.927359
|
||||||
|
mutex,100000,12,16,0,4,59.656092
|
||||||
|
mutex,100000,12,16,0,5,50.291591
|
||||||
|
mutex,100000,12,16,0,6,65.488211
|
||||||
|
mutex,100000,12,16,0,7,58.640640
|
||||||
|
mutex,100000,12,16,0,8,65.101864
|
||||||
|
mutex,100000,12,16,0,9,49.520904
|
||||||
|
mutex,100000,12,16,0,10,65.811132
|
||||||
|
mutex,100000,12,16,0,11,42.707750
|
||||||
|
mutex,100000,12,16,0,12,64.331059
|
||||||
|
mutex,100000,12,16,0,13,63.190112
|
||||||
|
mutex,100000,12,16,0,14,64.777749
|
||||||
|
mutex,100000,12,16,0,15,39.752394
|
||||||
|
mutex,100000,12,16,0,16,47.413504
|
||||||
|
mutex,100000,12,16,0,17,43.184214
|
||||||
|
mutex,100000,12,16,0,18,65.530894
|
||||||
|
mutex,100000,12,16,0,19,50.728438
|
||||||
|
mutex,100000,12,16,0,20,58.386635
|
||||||
|
mutex,100000,12,16,1,1,50.944243
|
||||||
|
mutex,100000,12,16,1,2,42.542311
|
||||||
|
mutex,100000,12,16,1,3,50.638888
|
||||||
|
mutex,100000,12,16,1,4,48.546566
|
||||||
|
mutex,100000,12,16,1,5,40.317764
|
||||||
|
mutex,100000,12,16,1,6,65.192313
|
||||||
|
mutex,100000,12,16,1,7,52.266073
|
||||||
|
mutex,100000,12,16,1,8,46.385730
|
||||||
|
mutex,100000,12,16,1,9,52.624183
|
||||||
|
mutex,100000,12,16,1,10,45.297780
|
||||||
|
mutex,100000,12,16,1,11,60.336353
|
||||||
|
mutex,100000,12,16,1,12,52.750945
|
||||||
|
mutex,100000,12,16,1,13,47.256072
|
||||||
|
mutex,100000,12,16,1,14,56.113491
|
||||||
|
mutex,100000,12,16,1,15,59.158761
|
||||||
|
mutex,100000,12,16,1,16,43.212372
|
||||||
|
mutex,100000,12,16,1,17,50.031352
|
||||||
|
mutex,100000,12,16,1,18,67.085131
|
||||||
|
mutex,100000,12,16,1,19,66.665573
|
||||||
|
mutex,100000,12,16,1,20,47.070331
|
||||||
|
mutex,100000,12,16,10,1,57.264136
|
||||||
|
mutex,100000,12,16,10,2,67.843495
|
||||||
|
mutex,100000,12,16,10,3,45.464245
|
||||||
|
mutex,100000,12,16,10,4,53.264239
|
||||||
|
mutex,100000,12,16,10,5,52.047079
|
||||||
|
mutex,100000,12,16,10,6,62.050308
|
||||||
|
mutex,100000,12,16,10,7,41.263293
|
||||||
|
mutex,100000,12,16,10,8,54.802473
|
||||||
|
mutex,100000,12,16,10,9,51.945275
|
||||||
|
mutex,100000,12,16,10,10,61.168683
|
||||||
|
mutex,100000,12,16,10,11,51.177096
|
||||||
|
mutex,100000,12,16,10,12,48.406307
|
||||||
|
mutex,100000,12,16,10,13,49.220852
|
||||||
|
mutex,100000,12,16,10,14,60.442277
|
||||||
|
mutex,100000,12,16,10,15,51.963914
|
||||||
|
mutex,100000,12,16,10,16,66.966394
|
||||||
|
mutex,100000,12,16,10,17,41.372235
|
||||||
|
mutex,100000,12,16,10,18,42.587658
|
||||||
|
mutex,100000,12,16,10,19,49.171039
|
||||||
|
mutex,100000,12,16,10,20,51.542382
|
||||||
|
mutex,100000,12,16,100,1,68.791788
|
||||||
|
mutex,100000,12,16,100,2,51.846772
|
||||||
|
mutex,100000,12,16,100,3,48.625480
|
||||||
|
mutex,100000,12,16,100,4,68.580630
|
||||||
|
mutex,100000,12,16,100,5,60.722834
|
||||||
|
mutex,100000,12,16,100,6,44.417033
|
||||||
|
mutex,100000,12,16,100,7,47.027116
|
||||||
|
mutex,100000,12,16,100,8,48.420106
|
||||||
|
mutex,100000,12,16,100,9,59.013143
|
||||||
|
mutex,100000,12,16,100,10,50.902912
|
||||||
|
mutex,100000,12,16,100,11,46.468126
|
||||||
|
mutex,100000,12,16,100,12,68.390484
|
||||||
|
mutex,100000,12,16,100,13,62.588615
|
||||||
|
mutex,100000,12,16,100,14,60.629303
|
||||||
|
mutex,100000,12,16,100,15,67.084802
|
||||||
|
mutex,100000,12,16,100,16,58.628457
|
||||||
|
mutex,100000,12,16,100,17,67.506226
|
||||||
|
mutex,100000,12,16,100,18,43.632227
|
||||||
|
mutex,100000,12,16,100,19,59.380773
|
||||||
|
mutex,100000,12,16,100,20,49.425766
|
||||||
|
mutex,100000,12,16,1000,1,50.404625
|
||||||
|
mutex,100000,12,16,1000,2,42.048149
|
||||||
|
mutex,100000,12,16,1000,3,56.374296
|
||||||
|
mutex,100000,12,16,1000,4,43.777660
|
||||||
|
mutex,100000,12,16,1000,5,66.811352
|
||||||
|
mutex,100000,12,16,1000,6,55.521177
|
||||||
|
mutex,100000,12,16,1000,7,52.749122
|
||||||
|
mutex,100000,12,16,1000,8,67.634553
|
||||||
|
mutex,100000,12,16,1000,9,68.680265
|
||||||
|
mutex,100000,12,16,1000,10,52.183400
|
||||||
|
mutex,100000,12,16,1000,11,66.177865
|
||||||
|
mutex,100000,12,16,1000,12,46.797660
|
||||||
|
mutex,100000,12,16,1000,13,65.397480
|
||||||
|
mutex,100000,12,16,1000,14,54.648316
|
||||||
|
mutex,100000,12,16,1000,15,53.222728
|
||||||
|
mutex,100000,12,16,1000,16,56.852040
|
||||||
|
mutex,100000,12,16,1000,17,49.813221
|
||||||
|
mutex,100000,12,16,1000,18,53.560966
|
||||||
|
mutex,100000,12,16,1000,19,50.489613
|
||||||
|
mutex,100000,12,16,1000,20,44.719812
|
||||||
|
mutex,100000,12,16,10000,1,51.217334
|
||||||
|
mutex,100000,12,16,10000,2,47.542253
|
||||||
|
mutex,100000,12,16,10000,3,39.239273
|
||||||
|
mutex,100000,12,16,10000,4,53.096943
|
||||||
|
mutex,100000,12,16,10000,5,51.599820
|
||||||
|
mutex,100000,12,16,10000,6,58.732492
|
||||||
|
mutex,100000,12,16,10000,7,56.722604
|
||||||
|
mutex,100000,12,16,10000,8,58.905575
|
||||||
|
mutex,100000,12,16,10000,9,56.649334
|
||||||
|
mutex,100000,12,16,10000,10,58.762068
|
||||||
|
mutex,100000,12,16,10000,11,47.574787
|
||||||
|
mutex,100000,12,16,10000,12,66.860659
|
||||||
|
mutex,100000,12,16,10000,13,59.622704
|
||||||
|
mutex,100000,12,16,10000,14,54.709976
|
||||||
|
mutex,100000,12,16,10000,15,60.568121
|
||||||
|
mutex,100000,12,16,10000,16,45.257157
|
||||||
|
mutex,100000,12,16,10000,17,55.519563
|
||||||
|
mutex,100000,12,16,10000,18,55.277471
|
||||||
|
mutex,100000,12,16,10000,19,48.347631
|
||||||
|
mutex,100000,12,16,10000,20,58.185999
|
||||||
|
mutex,100000,12,16,100000,1,50.658573
|
||||||
|
mutex,100000,12,16,100000,2,51.870714
|
||||||
|
mutex,100000,12,16,100000,3,58.421035
|
||||||
|
mutex,100000,12,16,100000,4,51.292373
|
||||||
|
mutex,100000,12,16,100000,5,57.245658
|
||||||
|
mutex,100000,12,16,100000,6,46.146581
|
||||||
|
mutex,100000,12,16,100000,7,48.557333
|
||||||
|
mutex,100000,12,16,100000,8,47.831668
|
||||||
|
mutex,100000,12,16,100000,9,51.397730
|
||||||
|
mutex,100000,12,16,100000,10,48.835914
|
||||||
|
mutex,100000,12,16,100000,11,42.140227
|
||||||
|
mutex,100000,12,16,100000,12,40.080772
|
||||||
|
mutex,100000,12,16,100000,13,57.205709
|
||||||
|
mutex,100000,12,16,100000,14,51.206220
|
||||||
|
mutex,100000,12,16,100000,15,51.223188
|
||||||
|
mutex,100000,12,16,100000,16,59.830204
|
||||||
|
mutex,100000,12,16,100000,17,49.893225
|
||||||
|
mutex,100000,12,16,100000,18,53.510641
|
||||||
|
mutex,100000,12,16,100000,19,60.542843
|
||||||
|
mutex,100000,12,16,100000,20,44.301078
|
||||||
|
mutex,100000,12,16,1000000,1,66.655018
|
||||||
|
mutex,100000,12,16,1000000,2,60.439144
|
||||||
|
mutex,100000,12,16,1000000,3,60.095797
|
||||||
|
mutex,100000,12,16,1000000,4,60.363989
|
||||||
|
mutex,100000,12,16,1000000,5,56.208243
|
||||||
|
mutex,100000,12,16,1000000,6,68.455244
|
||||||
|
mutex,100000,12,16,1000000,7,55.554970
|
||||||
|
mutex,100000,12,16,1000000,8,50.359371
|
||||||
|
mutex,100000,12,16,1000000,9,54.162726
|
||||||
|
mutex,100000,12,16,1000000,10,60.034517
|
||||||
|
mutex,100000,12,16,1000000,11,39.253178
|
||||||
|
mutex,100000,12,16,1000000,12,50.693452
|
||||||
|
mutex,100000,12,16,1000000,13,67.508558
|
||||||
|
mutex,100000,12,16,1000000,14,52.433383
|
||||||
|
mutex,100000,12,16,1000000,15,51.282912
|
||||||
|
mutex,100000,12,16,1000000,16,43.642607
|
||||||
|
mutex,100000,12,16,1000000,17,41.722618
|
||||||
|
mutex,100000,12,16,1000000,18,65.895850
|
||||||
|
mutex,100000,12,16,1000000,19,57.618387
|
||||||
|
mutex,100000,12,16,1000000,20,50.055619
|
||||||
|
chan,100000,12,16,0,1,40.127441
|
||||||
|
chan,100000,12,16,0,2,41.455001
|
||||||
|
chan,100000,12,16,0,3,36.714570
|
||||||
|
chan,100000,12,16,0,4,40.933785
|
||||||
|
chan,100000,12,16,0,5,41.266292
|
||||||
|
chan,100000,12,16,0,6,40.234146
|
||||||
|
chan,100000,12,16,0,7,39.892225
|
||||||
|
chan,100000,12,16,0,8,41.455500
|
||||||
|
chan,100000,12,16,0,9,40.033096
|
||||||
|
chan,100000,12,16,0,10,38.649510
|
||||||
|
chan,100000,12,16,0,11,41.825958
|
||||||
|
chan,100000,12,16,0,12,39.205938
|
||||||
|
chan,100000,12,16,0,13,39.995307
|
||||||
|
chan,100000,12,16,0,14,41.446220
|
||||||
|
chan,100000,12,16,0,15,34.960096
|
||||||
|
chan,100000,12,16,0,16,39.238390
|
||||||
|
chan,100000,12,16,0,17,40.386993
|
||||||
|
chan,100000,12,16,0,18,41.067920
|
||||||
|
chan,100000,12,16,0,19,40.729058
|
||||||
|
chan,100000,12,16,0,20,38.150088
|
||||||
|
chan,100000,12,16,1,1,223.907638
|
||||||
|
chan,100000,12,16,1,2,224.186200
|
||||||
|
chan,100000,12,16,1,3,222.084690
|
||||||
|
chan,100000,12,16,1,4,225.533614
|
||||||
|
chan,100000,12,16,1,5,220.717298
|
||||||
|
chan,100000,12,16,1,6,224.827734
|
||||||
|
chan,100000,12,16,1,7,224.738237
|
||||||
|
chan,100000,12,16,1,8,222.894227
|
||||||
|
chan,100000,12,16,1,9,225.341929
|
||||||
|
chan,100000,12,16,1,10,221.645462
|
||||||
|
chan,100000,12,16,1,11,221.707640
|
||||||
|
chan,100000,12,16,1,12,217.618091
|
||||||
|
chan,100000,12,16,1,13,226.229364
|
||||||
|
chan,100000,12,16,1,14,220.475431
|
||||||
|
chan,100000,12,16,1,15,226.986811
|
||||||
|
chan,100000,12,16,1,16,223.550684
|
||||||
|
chan,100000,12,16,1,17,219.462757
|
||||||
|
chan,100000,12,16,1,18,222.596380
|
||||||
|
chan,100000,12,16,1,19,224.815037
|
||||||
|
chan,100000,12,16,1,20,251.754326
|
||||||
|
chan,100000,12,16,10,1,257.372765
|
||||||
|
chan,100000,12,16,10,2,236.868647
|
||||||
|
chan,100000,12,16,10,3,227.049072
|
||||||
|
chan,100000,12,16,10,4,226.898790
|
||||||
|
chan,100000,12,16,10,5,232.118180
|
||||||
|
chan,100000,12,16,10,6,231.541822
|
||||||
|
chan,100000,12,16,10,7,234.792215
|
||||||
|
chan,100000,12,16,10,8,225.647944
|
||||||
|
chan,100000,12,16,10,9,227.758307
|
||||||
|
chan,100000,12,16,10,10,225.524614
|
||||||
|
chan,100000,12,16,10,11,227.264732
|
||||||
|
chan,100000,12,16,10,12,226.755865
|
||||||
|
chan,100000,12,16,10,13,238.960593
|
||||||
|
chan,100000,12,16,10,14,232.485852
|
||||||
|
chan,100000,12,16,10,15,245.820344
|
||||||
|
chan,100000,12,16,10,16,236.798622
|
||||||
|
chan,100000,12,16,10,17,230.580822
|
||||||
|
chan,100000,12,16,10,18,242.449093
|
||||||
|
chan,100000,12,16,10,19,257.890520
|
||||||
|
chan,100000,12,16,10,20,295.985658
|
||||||
|
chan,100000,12,16,100,1,261.136609
|
||||||
|
chan,100000,12,16,100,2,252.078825
|
||||||
|
chan,100000,12,16,100,3,246.238164
|
||||||
|
chan,100000,12,16,100,4,247.750855
|
||||||
|
chan,100000,12,16,100,5,254.491770
|
||||||
|
chan,100000,12,16,100,6,250.919761
|
||||||
|
chan,100000,12,16,100,7,250.302032
|
||||||
|
chan,100000,12,16,100,8,255.029772
|
||||||
|
chan,100000,12,16,100,9,253.592142
|
||||||
|
chan,100000,12,16,100,10,248.644975
|
||||||
|
chan,100000,12,16,100,11,245.904687
|
||||||
|
chan,100000,12,16,100,12,244.819163
|
||||||
|
chan,100000,12,16,100,13,237.814405
|
||||||
|
chan,100000,12,16,100,14,234.217106
|
||||||
|
chan,100000,12,16,100,15,232.469570
|
||||||
|
chan,100000,12,16,100,16,238.851532
|
||||||
|
chan,100000,12,16,100,17,234.777584
|
||||||
|
chan,100000,12,16,100,18,279.274536
|
||||||
|
chan,100000,12,16,100,19,264.663054
|
||||||
|
chan,100000,12,16,100,20,245.324167
|
||||||
|
chan,100000,12,16,1000,1,248.366516
|
||||||
|
chan,100000,12,16,1000,2,244.915217
|
||||||
|
chan,100000,12,16,1000,3,251.256402
|
||||||
|
chan,100000,12,16,1000,4,257.033927
|
||||||
|
chan,100000,12,16,1000,5,244.988459
|
||||||
|
chan,100000,12,16,1000,6,246.223655
|
||||||
|
chan,100000,12,16,1000,7,246.739936
|
||||||
|
chan,100000,12,16,1000,8,247.733433
|
||||||
|
chan,100000,12,16,1000,9,243.534361
|
||||||
|
chan,100000,12,16,1000,10,244.229115
|
||||||
|
chan,100000,12,16,1000,11,241.631071
|
||||||
|
chan,100000,12,16,1000,12,248.066545
|
||||||
|
chan,100000,12,16,1000,13,246.004506
|
||||||
|
chan,100000,12,16,1000,14,258.074152
|
||||||
|
chan,100000,12,16,1000,15,285.097017
|
||||||
|
chan,100000,12,16,1000,16,261.730586
|
||||||
|
chan,100000,12,16,1000,17,249.478010
|
||||||
|
chan,100000,12,16,1000,18,257.300198
|
||||||
|
chan,100000,12,16,1000,19,249.390272
|
||||||
|
chan,100000,12,16,1000,20,249.321477
|
||||||
|
chan,100000,12,16,10000,1,50.979799
|
||||||
|
chan,100000,12,16,10000,2,54.086199
|
||||||
|
chan,100000,12,16,10000,3,53.419140
|
||||||
|
chan,100000,12,16,10000,4,51.705684
|
||||||
|
chan,100000,12,16,10000,5,53.428333
|
||||||
|
chan,100000,12,16,10000,6,53.513013
|
||||||
|
chan,100000,12,16,10000,7,52.756857
|
||||||
|
chan,100000,12,16,10000,8,52.737539
|
||||||
|
chan,100000,12,16,10000,9,54.526229
|
||||||
|
chan,100000,12,16,10000,10,54.683371
|
||||||
|
chan,100000,12,16,10000,11,49.746521
|
||||||
|
chan,100000,12,16,10000,12,54.400111
|
||||||
|
chan,100000,12,16,10000,13,50.665225
|
||||||
|
chan,100000,12,16,10000,14,54.629914
|
||||||
|
chan,100000,12,16,10000,15,54.911260
|
||||||
|
chan,100000,12,16,10000,16,66.959642
|
||||||
|
chan,100000,12,16,10000,17,141.198709
|
||||||
|
chan,100000,12,16,10000,18,66.301375
|
||||||
|
chan,100000,12,16,10000,19,67.760641
|
||||||
|
chan,100000,12,16,10000,20,66.273444
|
||||||
|
chan,100000,12,16,100000,1,51.768910
|
||||||
|
chan,100000,12,16,100000,2,51.049230
|
||||||
|
chan,100000,12,16,100000,3,54.008867
|
||||||
|
chan,100000,12,16,100000,4,50.219752
|
||||||
|
chan,100000,12,16,100000,5,52.629875
|
||||||
|
chan,100000,12,16,100000,6,52.502319
|
||||||
|
chan,100000,12,16,100000,7,52.029321
|
||||||
|
chan,100000,12,16,100000,8,52.309561
|
||||||
|
chan,100000,12,16,100000,9,53.655503
|
||||||
|
chan,100000,12,16,100000,10,52.028376
|
||||||
|
chan,100000,12,16,100000,11,52.477284
|
||||||
|
chan,100000,12,16,100000,12,53.906940
|
||||||
|
chan,100000,12,16,100000,13,51.966575
|
||||||
|
chan,100000,12,16,100000,14,48.919888
|
||||||
|
chan,100000,12,16,100000,15,52.520428
|
||||||
|
chan,100000,12,16,100000,16,51.418556
|
||||||
|
chan,100000,12,16,100000,17,51.322284
|
||||||
|
chan,100000,12,16,100000,18,52.619286
|
||||||
|
chan,100000,12,16,100000,19,50.113266
|
||||||
|
chan,100000,12,16,100000,20,51.770223
|
||||||
|
chan,100000,12,16,1000000,1,49.424379
|
||||||
|
chan,100000,12,16,1000000,2,46.381429
|
||||||
|
chan,100000,12,16,1000000,3,47.912844
|
||||||
|
chan,100000,12,16,1000000,4,44.600584
|
||||||
|
chan,100000,12,16,1000000,5,45.776060
|
||||||
|
chan,100000,12,16,1000000,6,43.522351
|
||||||
|
chan,100000,12,16,1000000,7,49.256773
|
||||||
|
chan,100000,12,16,1000000,8,45.960914
|
||||||
|
chan,100000,12,16,1000000,9,43.723385
|
||||||
|
chan,100000,12,16,1000000,10,43.966708
|
||||||
|
chan,100000,12,16,1000000,11,46.964555
|
||||||
|
chan,100000,12,16,1000000,12,44.939054
|
||||||
|
chan,100000,12,16,1000000,13,44.300620
|
||||||
|
chan,100000,12,16,1000000,14,48.752618
|
||||||
|
chan,100000,12,16,1000000,15,43.285205
|
||||||
|
chan,100000,12,16,1000000,16,50.477541
|
||||||
|
chan,100000,12,16,1000000,17,48.662168
|
||||||
|
chan,100000,12,16,1000000,18,43.123251
|
||||||
|
chan,100000,12,16,1000000,19,47.569443
|
||||||
|
chan,100000,12,16,1000000,20,46.944097
|
|
321
bench/block_linux_x86_64.csv
Normal file
321
bench/block_linux_x86_64.csv
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
workload,ops,goroutines,depth,blockprofilerate,run,ms
|
||||||
|
mutex,100000,12,16,0,1,46.467006
|
||||||
|
mutex,100000,12,16,0,2,44.290682
|
||||||
|
mutex,100000,12,16,0,3,60.522433
|
||||||
|
mutex,100000,12,16,0,4,43.181006
|
||||||
|
mutex,100000,12,16,0,5,66.170038
|
||||||
|
mutex,100000,12,16,0,6,53.691183
|
||||||
|
mutex,100000,12,16,0,7,60.011052
|
||||||
|
mutex,100000,12,16,0,8,40.319046
|
||||||
|
mutex,100000,12,16,0,9,65.361119
|
||||||
|
mutex,100000,12,16,0,10,51.639923
|
||||||
|
mutex,100000,12,16,0,11,59.055253
|
||||||
|
mutex,100000,12,16,0,12,43.185502
|
||||||
|
mutex,100000,12,16,0,13,48.958826
|
||||||
|
mutex,100000,12,16,0,14,41.164255
|
||||||
|
mutex,100000,12,16,0,15,55.206372
|
||||||
|
mutex,100000,12,16,0,16,41.935746
|
||||||
|
mutex,100000,12,16,0,17,37.673853
|
||||||
|
mutex,100000,12,16,0,18,62.385450
|
||||||
|
mutex,100000,12,16,0,19,59.583401
|
||||||
|
mutex,100000,12,16,0,20,54.834707
|
||||||
|
mutex,100000,12,16,1,1,58.657674
|
||||||
|
mutex,100000,12,16,1,2,52.858070
|
||||||
|
mutex,100000,12,16,1,3,59.098276
|
||||||
|
mutex,100000,12,16,1,4,38.037816
|
||||||
|
mutex,100000,12,16,1,5,41.329989
|
||||||
|
mutex,100000,12,16,1,6,45.926589
|
||||||
|
mutex,100000,12,16,1,7,66.885038
|
||||||
|
mutex,100000,12,16,1,8,71.064418
|
||||||
|
mutex,100000,12,16,1,9,39.864812
|
||||||
|
mutex,100000,12,16,1,10,58.841239
|
||||||
|
mutex,100000,12,16,1,11,41.621457
|
||||||
|
mutex,100000,12,16,1,12,54.008223
|
||||||
|
mutex,100000,12,16,1,13,43.136109
|
||||||
|
mutex,100000,12,16,1,14,55.008887
|
||||||
|
mutex,100000,12,16,1,15,59.459737
|
||||||
|
mutex,100000,12,16,1,16,40.826485
|
||||||
|
mutex,100000,12,16,1,17,55.233407
|
||||||
|
mutex,100000,12,16,1,18,41.926122
|
||||||
|
mutex,100000,12,16,1,19,41.365361
|
||||||
|
mutex,100000,12,16,1,20,46.630824
|
||||||
|
mutex,100000,12,16,10,1,43.069553
|
||||||
|
mutex,100000,12,16,10,2,38.297855
|
||||||
|
mutex,100000,12,16,10,3,52.256908
|
||||||
|
mutex,100000,12,16,10,4,60.145081
|
||||||
|
mutex,100000,12,16,10,5,56.299579
|
||||||
|
mutex,100000,12,16,10,6,60.084497
|
||||||
|
mutex,100000,12,16,10,7,54.629164
|
||||||
|
mutex,100000,12,16,10,8,42.944174
|
||||||
|
mutex,100000,12,16,10,9,54.674537
|
||||||
|
mutex,100000,12,16,10,10,39.989021
|
||||||
|
mutex,100000,12,16,10,11,50.573836
|
||||||
|
mutex,100000,12,16,10,12,55.384098
|
||||||
|
mutex,100000,12,16,10,13,53.032156
|
||||||
|
mutex,100000,12,16,10,14,44.197028
|
||||||
|
mutex,100000,12,16,10,15,42.568158
|
||||||
|
mutex,100000,12,16,10,16,52.525550
|
||||||
|
mutex,100000,12,16,10,17,53.649684
|
||||||
|
mutex,100000,12,16,10,18,49.050458
|
||||||
|
mutex,100000,12,16,10,19,45.225980
|
||||||
|
mutex,100000,12,16,10,20,44.752093
|
||||||
|
mutex,100000,12,16,100,1,45.931160
|
||||||
|
mutex,100000,12,16,100,2,37.846390
|
||||||
|
mutex,100000,12,16,100,3,60.378127
|
||||||
|
mutex,100000,12,16,100,4,44.674935
|
||||||
|
mutex,100000,12,16,100,5,52.985250
|
||||||
|
mutex,100000,12,16,100,6,45.260076
|
||||||
|
mutex,100000,12,16,100,7,54.978621
|
||||||
|
mutex,100000,12,16,100,8,42.909708
|
||||||
|
mutex,100000,12,16,100,9,42.451431
|
||||||
|
mutex,100000,12,16,100,10,49.504010
|
||||||
|
mutex,100000,12,16,100,11,55.671905
|
||||||
|
mutex,100000,12,16,100,12,43.706222
|
||||||
|
mutex,100000,12,16,100,13,60.108024
|
||||||
|
mutex,100000,12,16,100,14,49.619005
|
||||||
|
mutex,100000,12,16,100,15,40.618539
|
||||||
|
mutex,100000,12,16,100,16,42.889189
|
||||||
|
mutex,100000,12,16,100,17,67.473317
|
||||||
|
mutex,100000,12,16,100,18,51.419243
|
||||||
|
mutex,100000,12,16,100,19,45.107350
|
||||||
|
mutex,100000,12,16,100,20,40.771357
|
||||||
|
mutex,100000,12,16,1000,1,62.574475
|
||||||
|
mutex,100000,12,16,1000,2,59.028890
|
||||||
|
mutex,100000,12,16,1000,3,39.201583
|
||||||
|
mutex,100000,12,16,1000,4,43.290072
|
||||||
|
mutex,100000,12,16,1000,5,59.420073
|
||||||
|
mutex,100000,12,16,1000,6,49.342441
|
||||||
|
mutex,100000,12,16,1000,7,39.942119
|
||||||
|
mutex,100000,12,16,1000,8,64.363938
|
||||||
|
mutex,100000,12,16,1000,9,58.400210
|
||||||
|
mutex,100000,12,16,1000,10,56.234503
|
||||||
|
mutex,100000,12,16,1000,11,59.669313
|
||||||
|
mutex,100000,12,16,1000,12,49.968124
|
||||||
|
mutex,100000,12,16,1000,13,54.138841
|
||||||
|
mutex,100000,12,16,1000,14,66.744277
|
||||||
|
mutex,100000,12,16,1000,15,62.178203
|
||||||
|
mutex,100000,12,16,1000,16,37.697144
|
||||||
|
mutex,100000,12,16,1000,17,60.903586
|
||||||
|
mutex,100000,12,16,1000,18,55.463893
|
||||||
|
mutex,100000,12,16,1000,19,59.107085
|
||||||
|
mutex,100000,12,16,1000,20,59.657245
|
||||||
|
mutex,100000,12,16,10000,1,38.351896
|
||||||
|
mutex,100000,12,16,10000,2,55.266675
|
||||||
|
mutex,100000,12,16,10000,3,39.394658
|
||||||
|
mutex,100000,12,16,10000,4,39.566490
|
||||||
|
mutex,100000,12,16,10000,5,45.919325
|
||||||
|
mutex,100000,12,16,10000,6,53.719078
|
||||||
|
mutex,100000,12,16,10000,7,40.126134
|
||||||
|
mutex,100000,12,16,10000,8,44.742102
|
||||||
|
mutex,100000,12,16,10000,9,58.435704
|
||||||
|
mutex,100000,12,16,10000,10,49.598292
|
||||||
|
mutex,100000,12,16,10000,11,40.291477
|
||||||
|
mutex,100000,12,16,10000,12,38.899508
|
||||||
|
mutex,100000,12,16,10000,13,41.012172
|
||||||
|
mutex,100000,12,16,10000,14,53.289262
|
||||||
|
mutex,100000,12,16,10000,15,42.360970
|
||||||
|
mutex,100000,12,16,10000,16,48.811259
|
||||||
|
mutex,100000,12,16,10000,17,48.897078
|
||||||
|
mutex,100000,12,16,10000,18,66.828307
|
||||||
|
mutex,100000,12,16,10000,19,53.383452
|
||||||
|
mutex,100000,12,16,10000,20,55.778016
|
||||||
|
mutex,100000,12,16,100000,1,42.022044
|
||||||
|
mutex,100000,12,16,100000,2,54.665914
|
||||||
|
mutex,100000,12,16,100000,3,64.361148
|
||||||
|
mutex,100000,12,16,100000,4,38.066262
|
||||||
|
mutex,100000,12,16,100000,5,42.734374
|
||||||
|
mutex,100000,12,16,100000,6,46.523299
|
||||||
|
mutex,100000,12,16,100000,7,53.598462
|
||||||
|
mutex,100000,12,16,100000,8,55.809807
|
||||||
|
mutex,100000,12,16,100000,9,54.619479
|
||||||
|
mutex,100000,12,16,100000,10,53.632052
|
||||||
|
mutex,100000,12,16,100000,11,42.486463
|
||||||
|
mutex,100000,12,16,100000,12,54.097662
|
||||||
|
mutex,100000,12,16,100000,13,55.159648
|
||||||
|
mutex,100000,12,16,100000,14,62.351892
|
||||||
|
mutex,100000,12,16,100000,15,58.009944
|
||||||
|
mutex,100000,12,16,100000,16,44.162679
|
||||||
|
mutex,100000,12,16,100000,17,59.226323
|
||||||
|
mutex,100000,12,16,100000,18,47.907346
|
||||||
|
mutex,100000,12,16,100000,19,58.379319
|
||||||
|
mutex,100000,12,16,100000,20,39.935513
|
||||||
|
mutex,100000,12,16,1000000,1,62.233427
|
||||||
|
mutex,100000,12,16,1000000,2,51.523759
|
||||||
|
mutex,100000,12,16,1000000,3,52.125536
|
||||||
|
mutex,100000,12,16,1000000,4,42.658314
|
||||||
|
mutex,100000,12,16,1000000,5,58.751405
|
||||||
|
mutex,100000,12,16,1000000,6,60.473855
|
||||||
|
mutex,100000,12,16,1000000,7,63.479988
|
||||||
|
mutex,100000,12,16,1000000,8,45.191694
|
||||||
|
mutex,100000,12,16,1000000,9,59.018170
|
||||||
|
mutex,100000,12,16,1000000,10,40.870761
|
||||||
|
mutex,100000,12,16,1000000,11,58.517260
|
||||||
|
mutex,100000,12,16,1000000,12,39.826999
|
||||||
|
mutex,100000,12,16,1000000,13,49.954863
|
||||||
|
mutex,100000,12,16,1000000,14,63.449030
|
||||||
|
mutex,100000,12,16,1000000,15,48.601972
|
||||||
|
mutex,100000,12,16,1000000,16,54.753241
|
||||||
|
mutex,100000,12,16,1000000,17,51.878619
|
||||||
|
mutex,100000,12,16,1000000,18,57.975290
|
||||||
|
mutex,100000,12,16,1000000,19,59.064562
|
||||||
|
mutex,100000,12,16,1000000,20,40.398516
|
||||||
|
chan,100000,12,16,0,1,38.930788
|
||||||
|
chan,100000,12,16,0,2,38.962047
|
||||||
|
chan,100000,12,16,0,3,34.126573
|
||||||
|
chan,100000,12,16,0,4,38.575680
|
||||||
|
chan,100000,12,16,0,5,39.382191
|
||||||
|
chan,100000,12,16,0,6,38.717870
|
||||||
|
chan,100000,12,16,0,7,33.401885
|
||||||
|
chan,100000,12,16,0,8,37.744891
|
||||||
|
chan,100000,12,16,0,9,38.056009
|
||||||
|
chan,100000,12,16,0,10,37.215323
|
||||||
|
chan,100000,12,16,0,11,39.185289
|
||||||
|
chan,100000,12,16,0,12,39.001858
|
||||||
|
chan,100000,12,16,0,13,37.552412
|
||||||
|
chan,100000,12,16,0,14,38.814981
|
||||||
|
chan,100000,12,16,0,15,33.819264
|
||||||
|
chan,100000,12,16,0,16,33.419707
|
||||||
|
chan,100000,12,16,0,17,38.160386
|
||||||
|
chan,100000,12,16,0,18,37.685666
|
||||||
|
chan,100000,12,16,0,19,37.741301
|
||||||
|
chan,100000,12,16,0,20,38.073851
|
||||||
|
chan,100000,12,16,1,1,206.471094
|
||||||
|
chan,100000,12,16,1,2,231.492042
|
||||||
|
chan,100000,12,16,1,3,231.981320
|
||||||
|
chan,100000,12,16,1,4,229.927609
|
||||||
|
chan,100000,12,16,1,5,226.387498
|
||||||
|
chan,100000,12,16,1,6,227.298844
|
||||||
|
chan,100000,12,16,1,7,232.930180
|
||||||
|
chan,100000,12,16,1,8,291.535175
|
||||||
|
chan,100000,12,16,1,9,229.557539
|
||||||
|
chan,100000,12,16,1,10,233.672669
|
||||||
|
chan,100000,12,16,1,11,272.365943
|
||||||
|
chan,100000,12,16,1,12,277.553013
|
||||||
|
chan,100000,12,16,1,13,245.704673
|
||||||
|
chan,100000,12,16,1,14,236.444902
|
||||||
|
chan,100000,12,16,1,15,225.046998
|
||||||
|
chan,100000,12,16,1,16,228.734167
|
||||||
|
chan,100000,12,16,1,17,224.087757
|
||||||
|
chan,100000,12,16,1,18,223.530512
|
||||||
|
chan,100000,12,16,1,19,229.503426
|
||||||
|
chan,100000,12,16,1,20,237.962910
|
||||||
|
chan,100000,12,16,10,1,223.731611
|
||||||
|
chan,100000,12,16,10,2,227.887615
|
||||||
|
chan,100000,12,16,10,3,231.025652
|
||||||
|
chan,100000,12,16,10,4,224.036089
|
||||||
|
chan,100000,12,16,10,5,227.921960
|
||||||
|
chan,100000,12,16,10,6,227.370712
|
||||||
|
chan,100000,12,16,10,7,226.022368
|
||||||
|
chan,100000,12,16,10,8,224.131028
|
||||||
|
chan,100000,12,16,10,9,225.217383
|
||||||
|
chan,100000,12,16,10,10,279.362075
|
||||||
|
chan,100000,12,16,10,11,291.887899
|
||||||
|
chan,100000,12,16,10,12,275.184338
|
||||||
|
chan,100000,12,16,10,13,252.618587
|
||||||
|
chan,100000,12,16,10,14,262.680865
|
||||||
|
chan,100000,12,16,10,15,260.281824
|
||||||
|
chan,100000,12,16,10,16,257.447121
|
||||||
|
chan,100000,12,16,10,17,264.377578
|
||||||
|
chan,100000,12,16,10,18,263.156864
|
||||||
|
chan,100000,12,16,10,19,265.330119
|
||||||
|
chan,100000,12,16,10,20,261.613324
|
||||||
|
chan,100000,12,16,100,1,264.683930
|
||||||
|
chan,100000,12,16,100,2,248.410978
|
||||||
|
chan,100000,12,16,100,3,247.333410
|
||||||
|
chan,100000,12,16,100,4,243.845980
|
||||||
|
chan,100000,12,16,100,5,239.822354
|
||||||
|
chan,100000,12,16,100,6,237.553585
|
||||||
|
chan,100000,12,16,100,7,239.254743
|
||||||
|
chan,100000,12,16,100,8,247.328360
|
||||||
|
chan,100000,12,16,100,9,240.923141
|
||||||
|
chan,100000,12,16,100,10,271.284629
|
||||||
|
chan,100000,12,16,100,11,301.878625
|
||||||
|
chan,100000,12,16,100,12,251.946864
|
||||||
|
chan,100000,12,16,100,13,269.313950
|
||||||
|
chan,100000,12,16,100,14,271.742718
|
||||||
|
chan,100000,12,16,100,15,255.162142
|
||||||
|
chan,100000,12,16,100,16,257.510921
|
||||||
|
chan,100000,12,16,100,17,262.474641
|
||||||
|
chan,100000,12,16,100,18,252.028231
|
||||||
|
chan,100000,12,16,100,19,250.937361
|
||||||
|
chan,100000,12,16,100,20,248.552703
|
||||||
|
chan,100000,12,16,1000,1,248.275829
|
||||||
|
chan,100000,12,16,1000,2,251.210887
|
||||||
|
chan,100000,12,16,1000,3,261.993810
|
||||||
|
chan,100000,12,16,1000,4,251.872439
|
||||||
|
chan,100000,12,16,1000,5,259.897580
|
||||||
|
chan,100000,12,16,1000,6,253.564443
|
||||||
|
chan,100000,12,16,1000,7,256.638895
|
||||||
|
chan,100000,12,16,1000,8,268.917462
|
||||||
|
chan,100000,12,16,1000,9,300.712656
|
||||||
|
chan,100000,12,16,1000,10,261.745801
|
||||||
|
chan,100000,12,16,1000,11,265.995695
|
||||||
|
chan,100000,12,16,1000,12,251.408058
|
||||||
|
chan,100000,12,16,1000,13,247.174449
|
||||||
|
chan,100000,12,16,1000,14,243.270778
|
||||||
|
chan,100000,12,16,1000,15,253.691616
|
||||||
|
chan,100000,12,16,1000,16,249.893182
|
||||||
|
chan,100000,12,16,1000,17,254.181993
|
||||||
|
chan,100000,12,16,1000,18,244.305181
|
||||||
|
chan,100000,12,16,1000,19,255.793142
|
||||||
|
chan,100000,12,16,1000,20,253.440143
|
||||||
|
chan,100000,12,16,10000,1,49.174187
|
||||||
|
chan,100000,12,16,10000,2,52.105591
|
||||||
|
chan,100000,12,16,10000,3,50.705801
|
||||||
|
chan,100000,12,16,10000,4,53.687918
|
||||||
|
chan,100000,12,16,10000,5,47.649914
|
||||||
|
chan,100000,12,16,10000,6,49.906878
|
||||||
|
chan,100000,12,16,10000,7,52.485732
|
||||||
|
chan,100000,12,16,10000,8,52.100545
|
||||||
|
chan,100000,12,16,10000,9,47.447707
|
||||||
|
chan,100000,12,16,10000,10,50.818564
|
||||||
|
chan,100000,12,16,10000,11,52.480842
|
||||||
|
chan,100000,12,16,10000,12,50.284561
|
||||||
|
chan,100000,12,16,10000,13,49.105261
|
||||||
|
chan,100000,12,16,10000,14,46.196857
|
||||||
|
chan,100000,12,16,10000,15,47.066741
|
||||||
|
chan,100000,12,16,10000,16,46.997165
|
||||||
|
chan,100000,12,16,10000,17,52.446521
|
||||||
|
chan,100000,12,16,10000,18,45.764945
|
||||||
|
chan,100000,12,16,10000,19,50.824254
|
||||||
|
chan,100000,12,16,10000,20,51.996919
|
||||||
|
chan,100000,12,16,100000,1,44.288153
|
||||||
|
chan,100000,12,16,100000,2,43.813236
|
||||||
|
chan,100000,12,16,100000,3,43.250038
|
||||||
|
chan,100000,12,16,100000,4,44.461900
|
||||||
|
chan,100000,12,16,100000,5,44.226336
|
||||||
|
chan,100000,12,16,100000,6,44.792520
|
||||||
|
chan,100000,12,16,100000,7,46.235535
|
||||||
|
chan,100000,12,16,100000,8,46.886577
|
||||||
|
chan,100000,12,16,100000,9,45.389115
|
||||||
|
chan,100000,12,16,100000,10,44.910575
|
||||||
|
chan,100000,12,16,100000,11,45.848624
|
||||||
|
chan,100000,12,16,100000,12,45.041405
|
||||||
|
chan,100000,12,16,100000,13,45.046831
|
||||||
|
chan,100000,12,16,100000,14,44.356991
|
||||||
|
chan,100000,12,16,100000,15,45.245524
|
||||||
|
chan,100000,12,16,100000,16,44.935766
|
||||||
|
chan,100000,12,16,100000,17,44.303058
|
||||||
|
chan,100000,12,16,100000,18,42.888595
|
||||||
|
chan,100000,12,16,100000,19,43.469088
|
||||||
|
chan,100000,12,16,100000,20,44.596701
|
||||||
|
chan,100000,12,16,1000000,1,42.360033
|
||||||
|
chan,100000,12,16,1000000,2,44.479671
|
||||||
|
chan,100000,12,16,1000000,3,42.649025
|
||||||
|
chan,100000,12,16,1000000,4,37.405249
|
||||||
|
chan,100000,12,16,1000000,5,41.038673
|
||||||
|
chan,100000,12,16,1000000,6,40.985792
|
||||||
|
chan,100000,12,16,1000000,7,43.482838
|
||||||
|
chan,100000,12,16,1000000,8,38.535429
|
||||||
|
chan,100000,12,16,1000000,9,40.347623
|
||||||
|
chan,100000,12,16,1000000,10,41.903392
|
||||||
|
chan,100000,12,16,1000000,11,42.033115
|
||||||
|
chan,100000,12,16,1000000,12,41.610760
|
||||||
|
chan,100000,12,16,1000000,13,38.156949
|
||||||
|
chan,100000,12,16,1000000,14,42.229382
|
||||||
|
chan,100000,12,16,1000000,15,38.951487
|
||||||
|
chan,100000,12,16,1000000,16,44.341920
|
||||||
|
chan,100000,12,16,1000000,17,39.614923
|
||||||
|
chan,100000,12,16,1000000,18,37.024286
|
||||||
|
chan,100000,12,16,1000000,19,37.958312
|
||||||
|
chan,100000,12,16,1000000,20,37.434442
|
|
65
bench/csv.go
Normal file
65
bench/csv.go
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Record struct {
|
||||||
|
Workload string
|
||||||
|
Ops int
|
||||||
|
Goroutines int
|
||||||
|
Depth int
|
||||||
|
Blockprofilerate int
|
||||||
|
Run int
|
||||||
|
Duration time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
type Column struct {
|
||||||
|
Name string
|
||||||
|
MarshalValue func(*Record) (string, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
var Columns = []Column{
|
||||||
|
{"workload", func(r *Record) (string, error) {
|
||||||
|
return fmt.Sprintf("%s", r.Workload), nil
|
||||||
|
}},
|
||||||
|
{"ops", func(r *Record) (string, error) {
|
||||||
|
return fmt.Sprintf("%d", r.Ops), nil
|
||||||
|
}},
|
||||||
|
{"goroutines", func(r *Record) (string, error) {
|
||||||
|
return fmt.Sprintf("%d", r.Goroutines), nil
|
||||||
|
}},
|
||||||
|
{"depth", func(r *Record) (string, error) {
|
||||||
|
return fmt.Sprintf("%d", r.Depth), nil
|
||||||
|
}},
|
||||||
|
{"blockprofilerate", func(r *Record) (string, error) {
|
||||||
|
return fmt.Sprintf("%d", r.Blockprofilerate), nil
|
||||||
|
}},
|
||||||
|
{"run", func(r *Record) (string, error) {
|
||||||
|
return fmt.Sprintf("%d", r.Run), nil
|
||||||
|
}},
|
||||||
|
{"ms", func(r *Record) (string, error) {
|
||||||
|
return fmt.Sprintf("%f", r.Duration.Seconds()*1000), nil
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Record) MarshalRecord() ([]string, error) {
|
||||||
|
record := make([]string, len(Columns))
|
||||||
|
for i, col := range Columns {
|
||||||
|
val, err := col.MarshalValue(r)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
record[i] = val
|
||||||
|
}
|
||||||
|
return record, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Headers() []string {
|
||||||
|
headers := make([]string, len(Columns))
|
||||||
|
for i, col := range Columns {
|
||||||
|
headers[i] = col.Name
|
||||||
|
}
|
||||||
|
return headers
|
||||||
|
}
|
197
bench/main.go
Normal file
197
bench/main.go
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/csv"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
|
"runtime/pprof"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := run(); err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func run() error {
|
||||||
|
if os.Getenv("WORKER") == "" {
|
||||||
|
return leader()
|
||||||
|
} else {
|
||||||
|
return worker()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func leader() error {
|
||||||
|
var (
|
||||||
|
blockprofilerates = flagIntSlice("blockprofilerates", []int{0, 1, 10, 100, 1000, 10000, 100000, 1000000}, "The runtime.SetBlockProfileRate() values to benchmark.")
|
||||||
|
workloads = flagStringSlice("workloads", []string{"mutex", "chan"}, "The workloads to benchmark.")
|
||||||
|
ops = flag.Int("ops", 1000, "The number of operations to perform for each workload.")
|
||||||
|
goroutines = flagIntSlice("goroutines", []int{runtime.NumCPU()}, "The number of goroutine values to use for each workloads.")
|
||||||
|
runs = flag.Int("runs", 3, "The number of times to repeat the same benchmark to understand variance.")
|
||||||
|
depths = flagIntSlice("depths", []int{2, 4, 8, 16, 32}, "The different frame depths values to use for each workload.")
|
||||||
|
)
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
cw := csv.NewWriter(os.Stdout)
|
||||||
|
cw.Write(Headers())
|
||||||
|
cw.Flush()
|
||||||
|
|
||||||
|
for _, workload := range *workloads {
|
||||||
|
for _, goroutine := range *goroutines {
|
||||||
|
for _, blockprofilerate := range *blockprofilerates {
|
||||||
|
for _, depth := range *depths {
|
||||||
|
for run := 1; run <= *runs; run++ {
|
||||||
|
cmd := exec.Command(os.Args[0],
|
||||||
|
"-run", fmt.Sprintf("%d", run),
|
||||||
|
"-blockprofilerate", fmt.Sprintf("%d", blockprofilerate),
|
||||||
|
"-ops", fmt.Sprintf("%d", *ops),
|
||||||
|
"-goroutines", fmt.Sprintf("%d", goroutine),
|
||||||
|
"-depth", fmt.Sprintf("%d", depth),
|
||||||
|
"-workload", workload,
|
||||||
|
)
|
||||||
|
|
||||||
|
buf := &bytes.Buffer{}
|
||||||
|
cmd.Stdout = buf
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
cmd.Env = append(cmd.Env, "WORKER=yeah")
|
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
buf.WriteTo(os.Stdout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func worker() error {
|
||||||
|
var (
|
||||||
|
run = flag.Int("run", 1, "The number of run. Has no impact on the benchmark, but gets included in the csv output line.")
|
||||||
|
blockprofilerate = flag.Int("blockprofilerate", 1, "The block profile rate to use.")
|
||||||
|
workload = flag.String("workload", "mutex", "The workload to simulate.")
|
||||||
|
out = flag.String("blockprofile", "", "Path to a file for writing the block profile.")
|
||||||
|
depth = flag.Int("depth", 16, "The stack depth at which to perform blocking events.")
|
||||||
|
ops = flag.Int("ops", 100000, "The number of operations to perform.")
|
||||||
|
goroutines = flag.Int("goroutines", runtime.NumCPU(), "The number of goroutines to utilize.")
|
||||||
|
)
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if *blockprofilerate > 0 {
|
||||||
|
runtime.SetBlockProfileRate(*blockprofilerate)
|
||||||
|
}
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
switch *workload {
|
||||||
|
case "mutex":
|
||||||
|
if err := mutexWorkload(*goroutines, *ops, *depth); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case "chan":
|
||||||
|
if err := chanWorkload(*goroutines, *ops, *depth); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unknown workload: %q", *workload)
|
||||||
|
}
|
||||||
|
duration := time.Since(start)
|
||||||
|
|
||||||
|
if *blockprofilerate > 0 && *out != "" {
|
||||||
|
f, err := os.Create(*out)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
if err := pprof.Lookup("block").WriteTo(f, 0); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cw := csv.NewWriter(os.Stdout)
|
||||||
|
record, err := (&Record{
|
||||||
|
Workload: *workload,
|
||||||
|
Ops: *ops,
|
||||||
|
Goroutines: *goroutines,
|
||||||
|
Depth: *depth,
|
||||||
|
Blockprofilerate: *blockprofilerate,
|
||||||
|
Run: *run,
|
||||||
|
Duration: duration,
|
||||||
|
}).MarshalRecord()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cw.Write(record)
|
||||||
|
cw.Flush()
|
||||||
|
return cw.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
func atStackDepth(depth int, fn func()) {
|
||||||
|
pcs := make([]uintptr, depth*10)
|
||||||
|
n := runtime.Callers(1, pcs)
|
||||||
|
if n > depth {
|
||||||
|
panic("depth exceeded")
|
||||||
|
} else if n < depth {
|
||||||
|
atStackDepth(depth, fn)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fn()
|
||||||
|
}
|
||||||
|
|
||||||
|
func flagIntSlice(name string, value []int, usage string) *[]int {
|
||||||
|
val := &intSlice{vals: value}
|
||||||
|
flag.Var(val, name, usage)
|
||||||
|
return &val.vals
|
||||||
|
}
|
||||||
|
|
||||||
|
type intSlice struct {
|
||||||
|
vals []int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *intSlice) Set(val string) error {
|
||||||
|
var vals []int
|
||||||
|
for _, val := range strings.Split(val, ",") {
|
||||||
|
num, err := strconv.Atoi(val)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
vals = append(vals, num)
|
||||||
|
}
|
||||||
|
i.vals = vals
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *intSlice) String() string {
|
||||||
|
return fmt.Sprintf("%v", i.vals)
|
||||||
|
}
|
||||||
|
|
||||||
|
func flagStringSlice(name string, value []string, usage string) *[]string {
|
||||||
|
val := &strSlice{vals: value}
|
||||||
|
flag.Var(val, name, usage)
|
||||||
|
return &val.vals
|
||||||
|
}
|
||||||
|
|
||||||
|
type strSlice struct {
|
||||||
|
vals []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *strSlice) Set(val string) error {
|
||||||
|
s.vals = strings.Split(val, ",")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *strSlice) String() string {
|
||||||
|
return fmt.Sprintf("%v", s.vals)
|
||||||
|
}
|
11
bench/run.sh
Executable file
11
bench/run.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
os_arch() {
|
||||||
|
echo "$(uname | tr '[:upper:]' '[:lower:]')_$(uname -m)"
|
||||||
|
}
|
||||||
|
|
||||||
|
go run . \
|
||||||
|
-workloads mutex,chan \
|
||||||
|
-ops 100000 \
|
||||||
|
-blockprofilerates 0,1,10,100,1000,10000,100000,1000000 \
|
||||||
|
-runs 20 \
|
||||||
|
-depths 16 \
|
||||||
|
> "block_$(os_arch).csv"
|
62
bench/workloads.go
Normal file
62
bench/workloads.go
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
func chanWorkload(goroutines, ops, depth int) error {
|
||||||
|
if goroutines%2 != 0 {
|
||||||
|
return fmt.Errorf("bad goroutines: %d: must be a multiple of 2", goroutines)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg := &sync.WaitGroup{}
|
||||||
|
for j := 0; j < goroutines/2; j++ {
|
||||||
|
ch := make(chan struct{})
|
||||||
|
wg.Add(1)
|
||||||
|
go atStackDepth(depth, func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for i := 0; i < ops; i++ {
|
||||||
|
ch <- struct{}{}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
wg.Add(1)
|
||||||
|
go atStackDepth(depth, func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for i := 0; i < ops; i++ {
|
||||||
|
<-ch
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func mutexWorkload(goroutines, ops, depth int) error {
|
||||||
|
if goroutines%2 != 0 {
|
||||||
|
return fmt.Errorf("bad goroutines: %d: must be a multiple of 2", goroutines)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg := &sync.WaitGroup{}
|
||||||
|
for j := 0; j < goroutines/2; j++ {
|
||||||
|
m := &sync.Mutex{}
|
||||||
|
wg.Add(1)
|
||||||
|
go atStackDepth(depth, func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for i := 0; i < ops; i++ {
|
||||||
|
m.Lock()
|
||||||
|
m.Unlock()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
wg.Add(1)
|
||||||
|
go atStackDepth(depth, func() {
|
||||||
|
defer wg.Done()
|
||||||
|
for i := 0; i < ops; i++ {
|
||||||
|
m.Lock()
|
||||||
|
m.Unlock()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
return nil
|
||||||
|
}
|
Reference in New Issue
Block a user