MCPcopy
hub / github.com/nats-io/nats.go / NewBenchmark

Function NewBenchmark

bench/bench.go:58–65  ·  view source on GitHub ↗

NewBenchmark initializes a Benchmark. After creating a bench call AddSubSample/AddPubSample. When done collecting samples, call EndBenchmark

(name string, subCnt, pubCnt int)

Source from the content-addressed store, hash-verified

56// NewBenchmark initializes a Benchmark. After creating a bench call AddSubSample/AddPubSample.
57// When done collecting samples, call EndBenchmark
58func 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.
68func (bm *Benchmark) Close() {

Callers 3

mainFunction · 0.92
TestBenchSetupFunction · 0.85
makeBenchFunction · 0.85

Calls 2

NewSampleGroupFunction · 0.85
NextMethod · 0.65

Tested by 2

TestBenchSetupFunction · 0.68
makeBenchFunction · 0.68