summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-11-20 02:33:51 -0500
committerWill Hawkins <[email protected]>2022-11-20 02:39:09 -0500
commitbad6c4655200dacd75ce1451cd3f410fea3d8de2 (patch)
tree9e98ed51547d8e432c4a59f1ad1b2300bbc8c734
parent78fb5b1f49672d982208ddf80a0b77b8839ed0ae (diff)
[Feature] Add structure for wrapping collection of LGCs
Add a structure for wrapping a collection of load-generating connections so that two or more parallel tasks can access them safely.
-rw-r--r--lgc/lgc.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lgc/lgc.go b/lgc/lgc.go
index b4a632c..d61ddf2 100644
--- a/lgc/lgc.go
+++ b/lgc/lgc.go
@@ -22,6 +22,7 @@ import (
"io/ioutil"
"net/http"
"net/http/httptrace"
+ "sync"
"sync/atomic"
"time"
@@ -41,6 +42,15 @@ type LoadGeneratingConnection interface {
Stats() *stats.TraceStats
}
+type LoadGeneratingConnectionCollection struct {
+ Lock sync.Mutex
+ LGCs *[]LoadGeneratingConnection
+}
+
+func NewLoadGeneratingConnectionCollection() LoadGeneratingConnectionCollection {
+ return LoadGeneratingConnectionCollection{LGCs: new([]LoadGeneratingConnection)}
+}
+
// TODO: All 64-bit fields that are accessed atomically must
// appear at the top of this struct.
type LoadGeneratingConnectionDownload struct {