NewBenchmark initializes a Benchmark. After creating a bench call AddSubSample/AddPubSample. When done collecting samples, call EndBenchmark
(name string, subCnt, pubCnt int)
| 56 | // NewBenchmark initializes a Benchmark. After creating a bench call AddSubSample/AddPubSample. |
| 57 | // When done collecting samples, call EndBenchmark |
| 58 | func NewBenchmark(name string, subCnt, pubCnt int) *Benchmark { |
| 59 | bm := Benchmark{Name: name, RunID: nuid.Next()} |
| 60 | bm.Subs = NewSampleGroup() |
| 61 | bm.Pubs = NewSampleGroup() |
| 62 | bm.subChannel = make(chan *Sample, subCnt) |
| 63 | bm.pubChannel = make(chan *Sample, pubCnt) |
| 64 | return &bm |
| 65 | } |
| 66 | |
| 67 | // Close organizes collected Samples and calculates aggregates. After Close(), no more samples can be added. |
| 68 | func (bm *Benchmark) Close() { |